mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
replace /dev/null with _NO_LOG
This commit is contained in:
parent
0191df4e77
commit
4b321dc571
15 changed files with 82 additions and 80 deletions
|
@ -81,7 +81,7 @@ _auto_clock() {
|
|||
_check
|
||||
_SET_TIME=""
|
||||
# automatic setup
|
||||
if ping -c1 www.google.com &>/dev/null; then
|
||||
if ping -c1 www.google.com &>"${_NO_LOG}"; then
|
||||
_ZONE="$(curl -s "http://ip-api.com/csv/?fields=timezone")"
|
||||
_auto_clock | _dialog --title " Clock Configuration " --no-mouse --gauge "Setting Timezone to ${_ZONE}..." 6 60 0
|
||||
_SET_TIME="1"
|
||||
|
|
|
@ -96,7 +96,7 @@ build_image() {
|
|||
# this assumes that the new image is not more than 1¼ times the size of the old one
|
||||
(( $((curr_size + (curr_size/4))) < space_left_on_device )) && compressout="$out".tmp
|
||||
fi
|
||||
pushd "$BUILDROOT" >/dev/null || return
|
||||
pushd "$BUILDROOT" >"${_NO_LOG}" || return
|
||||
# Reproducibility: set all timestamps to 0
|
||||
find . -mindepth 1 -execdir touch -hcd "@0" "{}" +
|
||||
# If this pipeline changes, |pipeprogs| below needs to be updated as well.
|
||||
|
@ -107,7 +107,7 @@ build_image() {
|
|||
$compress "${COMPRESSION_OPTIONS[@]}" > "$compressout"
|
||||
pipestatus=("${PIPESTATUS[@]}")
|
||||
pipeprogs=('find' 'sort' 'bsdtar (step 1)' 'bsdtar (step 2)' "$compress")
|
||||
popd >/dev/null || return
|
||||
popd >"${_NO_LOG}" || return
|
||||
for (( i = 0; i < ${#pipestatus[*]}; ++i )); do
|
||||
if (( pipestatus[i] )); then
|
||||
errmsg="${pipeprogs[i]} reported an error"
|
||||
|
@ -215,7 +215,7 @@ fi
|
|||
_d_workdir="$(initialize_buildroot "$KERNELVERSION" "$_opttargetdir")" || exit 1
|
||||
BUILDROOT="${_opttargetdir:-$_d_workdir/root}"
|
||||
# shellcheck source=mkinitcpio.conf
|
||||
! . "$_f_config" 2>/dev/null && die "Failed to read configuration '%s'" "$_f_config"
|
||||
! . "$_f_config" 2>"${_NO_LOG}" && die "Failed to read configuration '%s'" "$_f_config"
|
||||
_hooks=("${HOOKS[@]}")
|
||||
if (( ${#_hooks[*]} == 0 )); then
|
||||
die "Invalid config: No hooks found"
|
||||
|
@ -239,7 +239,7 @@ preload_builtin_modules
|
|||
map run_build_hook "${_hooks[@]}" || (( ++_builderrors ))
|
||||
install_modules "${!_modpaths[@]}"
|
||||
# this is simply a nice-to-have -- it doesn't matter if it fails.
|
||||
ldconfig -r "$BUILDROOT" &>/dev/null
|
||||
ldconfig -r "$BUILDROOT" &>"${_NO_LOG}"
|
||||
# remove /var/cache/ldconfig/aux-cache for reproducability
|
||||
rm -f -- "$BUILDROOT/var/cache/ldconfig/aux-cache"
|
||||
# Set umask to create initramfs images as 600
|
||||
|
|
|
@ -65,10 +65,10 @@ _run() {
|
|||
echo "LANG=${_LOCALE}.UTF-8" > /etc/locale.conf
|
||||
echo "LANG=${_LOCALE}.UTF-8" > /.localize
|
||||
echo LC_COLLATE=C >> /etc/locale.conf
|
||||
localectl set-locale "${_LOCALE}.UTF-8" &>/dev/null
|
||||
localectl set-locale "${_LOCALE}.UTF-8" &>"${_NO_LOG}"
|
||||
sed -i -e "s:^[a-z]:#&:g" /etc/locale.gen
|
||||
sed -i -e "s:^#${_LOCALE}.UTF-8:${_LOCALE}.UTF-8:g" /etc/locale.gen
|
||||
locale-gen &>/dev/null
|
||||
locale-gen &>"${_NO_LOG}"
|
||||
_progress "33" "Setting locale to ${_LOCALE}.UTF-8..."
|
||||
sleep 2
|
||||
_progress "66" "Setting keymap to ${_KEYMAP}..."
|
||||
|
|
|
@ -131,7 +131,7 @@ _update_environment() {
|
|||
|
||||
_check
|
||||
if [[ ! -e "/var/cache/pacman/pkg/archboot.db" ]]; then
|
||||
if ! ping -c1 www.google.com &>/dev/null; then
|
||||
if ! ping -c1 www.google.com &>"${_NO_LOG}"; then
|
||||
_dialog --title " ERROR " --no-mouse --infobox "Your network is not working. Please reconfigure it." 3 60
|
||||
sleep 5
|
||||
_abort
|
||||
|
|
|
@ -39,11 +39,11 @@ _prepare_pacman() {
|
|||
mkdir -p "${_DESTDIR}/var/lib/pacman"
|
||||
fi
|
||||
# pacman-key process itself
|
||||
while pgrep -x pacman-key &>/dev/null; do
|
||||
while pgrep -x pacman-key &>"${_NO_LOG}"; do
|
||||
sleep 1
|
||||
done
|
||||
# gpg finished in background
|
||||
while pgrep -x gpg &>/dev/null; do
|
||||
while pgrep -x gpg &>"${_NO_LOG}"; do
|
||||
sleep 1
|
||||
done
|
||||
[[ -e /etc/systemd/system/pacman-init.service ]] && systemctl stop pacman-init.service
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
. /etc/archboot/defaults
|
||||
_BASENAME=${0##*/}
|
||||
_RUNNING_ARCH="$(uname -m)"
|
||||
_LOG="/dev/tty7"
|
||||
_NO_LOG="/dev/null"
|
||||
_KEYRING="archlinux-keyring"
|
||||
if echo "${_BASENAME}" | grep -qw aarch64; then
|
||||
_ARCHBOOT="archboot-arm"
|
||||
|
@ -111,7 +113,7 @@ _kver() {
|
|||
local -i offset
|
||||
offset="$(od -An -j0x20E -dN2 "$1")" || return
|
||||
read -r kver _ < \
|
||||
<(dd if="$1" bs=1 count=127 skip=$((offset + 0x200)) 2>/dev/null)
|
||||
<(dd if="$1" bs=1 count=127 skip=$((offset + 0x200)) 2>"${_NO_LOG}")
|
||||
else
|
||||
reader='cat'
|
||||
bytes="$(od -An -t x2 -N2 "$1" | tr -dc '[:alnum:]')"
|
||||
|
@ -151,10 +153,10 @@ _generate_keyring() {
|
|||
if ! grep -qw archboot /etc/hostname; then
|
||||
# generate pacman keyring
|
||||
echo "Generating pacman keyring in container..."
|
||||
${_NSPAWN} "${1}" pacman-key --init &>/dev/null
|
||||
${_NSPAWN} "${1}" pacman-key --populate &>/dev/null
|
||||
${_NSPAWN} "${1}" pacman-key --init &>"${_NO_LOG}"
|
||||
${_NSPAWN} "${1}" pacman-key --populate &>"${_NO_LOG}"
|
||||
else
|
||||
cp -ar /etc/pacman.d/gnupg "${1}"/etc/pacman.d &>/dev/null
|
||||
cp -ar /etc/pacman.d/gnupg "${1}"/etc/pacman.d &>"${_NO_LOG}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -230,16 +232,16 @@ _pacman_key() {
|
|||
[[ -d "${1}"/usr/share/archboot/gpg ]] || mkdir -p "${1}"/usr/share/archboot/gpg
|
||||
cp "${_GPG_KEY}" "${1}"/"${_GPG_KEY}"
|
||||
echo "Adding ${_GPG_KEY_ID} to container trusted keys..."
|
||||
${_NSPAWN} "${1}" pacman-key --add "${_GPG_KEY}" &>/dev/null
|
||||
${_NSPAWN} "${1}" pacman-key --lsign-key "${_GPG_KEY_ID}" &>/dev/null
|
||||
${_NSPAWN} "${1}" pacman-key --add "${_GPG_KEY}" &>"${_NO_LOG}"
|
||||
${_NSPAWN} "${1}" pacman-key --lsign-key "${_GPG_KEY_ID}" &>"${_NO_LOG}"
|
||||
echo "Removing ${_GPG_KEY} from container..."
|
||||
rm "${1}/${_GPG_KEY}"
|
||||
}
|
||||
|
||||
_pacman_key_system() {
|
||||
echo "Adding ${_GPG_KEY_ID} to trusted keys..."
|
||||
pacman-key --add "${_GPG_KEY}" &>/dev/null
|
||||
pacman-key --lsign-key "${_GPG_KEY_ID}" &>/dev/null
|
||||
pacman-key --add "${_GPG_KEY}" &>"${_NO_LOG}"
|
||||
pacman-key --lsign-key "${_GPG_KEY_ID}" &>"${_NO_LOG}"
|
||||
}
|
||||
|
||||
_cachedir_check() {
|
||||
|
|
|
@ -43,19 +43,19 @@ _clean_cache() {
|
|||
_pacman_chroot() {
|
||||
if ! [[ -f ${3} && -f ${3}.sig ]]; then
|
||||
echo "Downloading ${3}..."
|
||||
wget "${2}"/"${3}"{,.sig} &>/dev/null
|
||||
wget "${2}"/"${3}"{,.sig} &>"${_NO_LOG}"
|
||||
else
|
||||
echo "Using local ${3}..."
|
||||
fi
|
||||
echo "Verifying ${3}..."
|
||||
gpg --verify "${3}.sig" &>/dev/null || exit 1
|
||||
gpg --verify "${3}.sig" &>"${_NO_LOG}" || exit 1
|
||||
bsdtar -C "${1}" -xf "${3}"
|
||||
if [[ -f "${3}" && -f "${3}".sig ]]; then
|
||||
echo "Removing installation tarball ${3}..."
|
||||
rm "${3}"{,.sig}
|
||||
fi
|
||||
echo "Updating container to latest packages..."
|
||||
${_NSPAWN} "${1}" pacman -Syu --noconfirm &>/dev/null
|
||||
${_NSPAWN} "${1}" pacman -Syu --noconfirm &>"${_NO_LOG}"
|
||||
}
|
||||
|
||||
# clean container from not needed files
|
||||
|
@ -69,8 +69,8 @@ _clean_container() {
|
|||
find "${1}"/usr/share/locale/ -mindepth 2 ! -path '*/be/*' ! -path '*/bg/*' ! -path '*/cs/*' ! -path '*/da/*' ! -path '*/de/*' \
|
||||
! -path '*/en/*' ! -path '*/el/*' ! -path '*/es/*' ! -path '*/fi/*' ! -path '*/fr/*' ! -path '*/hu/*' ! -path '*/it/*' \
|
||||
! -path '*/lt/*' ! -path '*/lv/*' ! -path '*/mk/*' ! -path '*/nl/*' ! -path '*/nn/*' ! -path '*/pl/*' ! -path '*/pt/*' \
|
||||
! -path '*/ro/*' ! -path '*/ru/*' ! -path '*/sk/*' ! -path '*/sr/*' ! -path '*/sv/*' ! -path '*/uk/*' -delete &>/dev/null
|
||||
find "${1}"/usr/share/i18n/charmaps ! -name 'UTF-8.gz' -delete &>/dev/null
|
||||
! -path '*/ro/*' ! -path '*/ru/*' ! -path '*/sk/*' ! -path '*/sr/*' ! -path '*/sv/*' ! -path '*/uk/*' -delete &>"${_NO_LOG}"
|
||||
find "${1}"/usr/share/i18n/charmaps ! -name 'UTF-8.gz' -delete &>"${_NO_LOG}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ _prepare_pacman() {
|
|||
rm -f /var/lib/pacman/sync/archboot.db
|
||||
echo "Updating Arch Linux keyring..."
|
||||
#shellcheck disable=SC2086
|
||||
pacman -Sy --config ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} &>/dev/null
|
||||
pacman -Sy --config ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} &>"${_NO_LOG}"
|
||||
}
|
||||
|
||||
#shellcheck disable=SC2120
|
||||
|
@ -151,11 +151,11 @@ _install_base_packages() {
|
|||
if [[ "${2}" == "use_binfmt" ]]; then
|
||||
echo "Downloading ${_PACKAGES} ${_KEYRING} to ${1}..."
|
||||
#shellcheck disable=SC2086
|
||||
${_PACMAN} -Syw ${_PACKAGES} ${_KEYRING} ${_PACMAN_DEFAULTS} ${_PACMAN_DB} &>/dev/null || exit 1
|
||||
${_PACMAN} -Syw ${_PACKAGES} ${_KEYRING} ${_PACMAN_DEFAULTS} ${_PACMAN_DB} &>"${_NO_LOG}" || exit 1
|
||||
fi
|
||||
echo "Installing ${_PACKAGES} ${_KEYRING} to ${1}..."
|
||||
#shellcheck disable=SC2086
|
||||
${_PACMAN} -Sy ${_PACKAGES} ${_KEYRING} ${_PACMAN_DEFAULTS} &>/dev/null || exit 1
|
||||
${_PACMAN} -Sy ${_PACKAGES} ${_KEYRING} ${_PACMAN_DEFAULTS} &>"${_NO_LOG}" || exit 1
|
||||
}
|
||||
|
||||
_install_archboot() {
|
||||
|
@ -166,7 +166,7 @@ _install_archboot() {
|
|||
fi
|
||||
echo "Installing ${_ARCHBOOT} ${_MAN_INFO_PACKAGES} to ${1}..."
|
||||
#shellcheck disable=SC2086
|
||||
${_PACMAN} -Sy ${_ARCHBOOT} ${_MAN_INFO_PACKAGES} ${_PACMAN_DEFAULTS} &>/dev/null || exit 1
|
||||
${_PACMAN} -Sy ${_ARCHBOOT} ${_MAN_INFO_PACKAGES} ${_PACMAN_DEFAULTS} &>"${_NO_LOG}" || exit 1
|
||||
# cleanup
|
||||
if ! [[ "${2}" == "use_binfmt" ]]; then
|
||||
rm -r "${1}"/blankdb
|
||||
|
|
|
@ -122,7 +122,7 @@ all_modules() {
|
|||
mod="${mod##*/}"
|
||||
mod="${mod%.ko*}"
|
||||
printf '%s\n' "${mod//-/_}"
|
||||
done < <(find "$_d_kmoduledir" -name '*.ko*' -print0 2>/dev/null | grep -EZz "$@")
|
||||
done < <(find "$_d_kmoduledir" -name '*.ko*' -print0 2>"${_NO_LOG}" | grep -EZz "$@")
|
||||
(( count ))
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ add_firmware() {
|
|||
fwpath=/lib/firmware
|
||||
for fw; do
|
||||
# shellcheck disable=SC2154,SC2153
|
||||
if ! compgen -G "${BUILDROOT}${fwpath}/${fw}?(.*)" &>/dev/null; then
|
||||
if ! compgen -G "${BUILDROOT}${fwpath}/${fw}?(.*)" &>"${_NO_LOG}"; then
|
||||
if read -r fwfile < <(compgen -G "${fwpath}/${fw}?(.*)"); then
|
||||
map add_file "${fwfile[@]}"
|
||||
break
|
||||
|
@ -194,7 +194,7 @@ add_module() {
|
|||
done
|
||||
;;
|
||||
esac
|
||||
done < <(modinfo -b "$_optmoduleroot" -k "$KERNELVERSION" -0 "$target" 2>/dev/null)
|
||||
done < <(modinfo -b "$_optmoduleroot" -k "$KERNELVERSION" -0 "$target" 2>"${_NO_LOG}")
|
||||
if (( ${#firmware[*]} )); then
|
||||
add_firmware "${firmware[@]}"
|
||||
fi
|
||||
|
@ -284,7 +284,7 @@ add_binary() {
|
|||
dest="${2:-$binary}"
|
||||
add_file "$binary" "$dest"
|
||||
# non-binaries
|
||||
if ! lddout="$(ldd "$binary" 2>/dev/null)"; then
|
||||
if ! lddout="$(ldd "$binary" 2>"${_NO_LOG}")"; then
|
||||
return 0
|
||||
fi
|
||||
# resolve sodeps
|
||||
|
@ -355,7 +355,7 @@ run_build_hook() {
|
|||
error 'Failed to read %s' "$script"
|
||||
return 1
|
||||
fi
|
||||
if ! declare -f build >/dev/null; then
|
||||
if ! declare -f build >"${_NO_LOG}"; then
|
||||
error "Hook '%s' has no build function" "${script}"
|
||||
return 1
|
||||
fi
|
||||
|
@ -370,11 +370,11 @@ run_build_hook() {
|
|||
|
||||
try_enable_color() {
|
||||
local colors
|
||||
if ! colors="$(tput colors 2>/dev/null)"; then
|
||||
if ! colors="$(tput colors 2>"${_NO_LOG}")"; then
|
||||
warning "Failed to enable color. Check your TERM environment variable"
|
||||
return
|
||||
fi
|
||||
if (( colors > 0 )) && tput setaf 0 &>/dev/null; then
|
||||
if (( colors > 0 )) && tput setaf 0 &>"${_NO_LOG}"; then
|
||||
_color_none="$(tput sgr0)"
|
||||
_color_bold="$(tput bold)"
|
||||
_color_blue="$_color_bold$(tput setaf 4)"
|
||||
|
|
|
@ -176,7 +176,7 @@ _prepare_uefi_image() {
|
|||
IMGSZ=$((BOOTSIZE/1024 + 2048)) # image size in KB
|
||||
VFAT_IMAGE="${_ISODIR}/efi.img"
|
||||
## Creating efi.img
|
||||
mkfs.vfat --invariant -C "${VFAT_IMAGE}" "${IMGSZ}" >/dev/null
|
||||
mkfs.vfat --invariant -C "${VFAT_IMAGE}" "${IMGSZ}" >"${_NO_LOG}"
|
||||
## Copying all files to UEFI vfat image
|
||||
mcopy -m -i "${VFAT_IMAGE}" -s "${_ISODIR}"/EFI "${_ISODIR}"/boot ::/
|
||||
# leave EFI/ and /boot/kernel for virtualbox and other restricted VM emulators :(
|
||||
|
@ -217,14 +217,14 @@ _uboot() {
|
|||
IMGSZ=$((BOOTSIZE/1024 + 2048)) # image size in KB
|
||||
VFAT_IMAGE="${_ISODIR}/extlinux.img"
|
||||
dd if=/dev/zero of="${VFAT_IMAGE}" bs="${IMGSZ}" count=1024 status=none
|
||||
sfdisk "${VFAT_IMAGE}" &>/dev/null <<EOF
|
||||
sfdisk "${VFAT_IMAGE}" &>"${_NO_LOG}" <<EOF
|
||||
label: dos
|
||||
label-id: 0x12345678
|
||||
device: "${VFAT_IMAGE}"
|
||||
unit: sectors
|
||||
"${VFAT_IMAGE}"1 : start= 2048, type=83, bootable
|
||||
EOF
|
||||
mkfs.vfat --offset=2048 --invariant "${VFAT_IMAGE}" >/dev/null
|
||||
mkfs.vfat --offset=2048 --invariant "${VFAT_IMAGE}" >"${_NO_LOG}"
|
||||
## Copying all files to UEFI vfat image
|
||||
mcopy -m -i "${VFAT_IMAGE}"@@1048576 -s "${_ISODIR}"/boot ::/
|
||||
mv "${VFAT_IMAGE}" "${_IMAGENAME}.img"
|
||||
|
@ -247,11 +247,11 @@ _grub_mkrescue() {
|
|||
|
||||
_reproducibility_iso() {
|
||||
echo "Creating reproducible UUIDs on ${_IMAGENAME}.iso GPT..."
|
||||
sgdisk -u 1:1 "${_IMAGENAME}.iso" &>/dev/null
|
||||
sgdisk -u 2:2 "${_IMAGENAME}.iso" &>/dev/null
|
||||
sgdisk -u 3:3 "${_IMAGENAME}.iso" &>/dev/null
|
||||
sgdisk -u 4:4 "${_IMAGENAME}.iso" &>/dev/null
|
||||
sgdisk -U 1 "${_IMAGENAME}.iso" &>/dev/null
|
||||
sgdisk -u 1:1 "${_IMAGENAME}.iso" &>"${_NO_LOG}"
|
||||
sgdisk -u 2:2 "${_IMAGENAME}.iso" &>"${_NO_LOG}"
|
||||
sgdisk -u 3:3 "${_IMAGENAME}.iso" &>"${_NO_LOG}"
|
||||
sgdisk -u 4:4 "${_IMAGENAME}.iso" &>"${_NO_LOG}"
|
||||
sgdisk -U 1 "${_IMAGENAME}.iso" &>"${_NO_LOG}"
|
||||
}
|
||||
|
||||
_create_cksum() {
|
||||
|
|
|
@ -27,14 +27,14 @@ _switch_root_zram() {
|
|||
if [[ "${TTY}" = "tty1" ]]; then
|
||||
clear
|
||||
[[ -d /sysroot ]] || mkdir /sysroot
|
||||
modprobe zram &>/dev/null
|
||||
modprobe zstd &>/dev/null
|
||||
modprobe zram &>"${_NO_LOG}"
|
||||
modprobe zstd &>"${_NO_LOG}"
|
||||
echo "1" >/sys/block/zram0/reset
|
||||
echo "zstd" >/sys/block/zram0/comp_algorithm
|
||||
echo "5G" >/sys/block/zram0/disksize
|
||||
_progress "33" "Creating btrfs on /dev/zram0..."
|
||||
mkfs.btrfs /dev/zram0 &>/dev/null
|
||||
mount -o discard /dev/zram0 /sysroot &>/dev/null
|
||||
mkfs.btrfs /dev/zram0 &>"${_NO_LOG}"
|
||||
mount -o discard /dev/zram0 /sysroot &>"${_NO_LOG}"
|
||||
_progress "66" "Removing firmware and modules..."
|
||||
# cleanup firmware and modules
|
||||
mv /lib/firmware/regulatory* /tmp/
|
||||
|
@ -45,16 +45,16 @@ if [[ "${TTY}" = "tty1" ]]; then
|
|||
_progress "75" "Copying archboot rootfs to /sysroot..."
|
||||
tar -C / --exclude="./dev/*" --exclude="./proc/*" --exclude="./sys/*" \
|
||||
--exclude="./run/*" --exclude="./mnt/*" --exclude="./tmp/*" --exclude="./sysroot/*" \
|
||||
-clpf - . | tar -C /sysroot -xlspf - &>/dev/null
|
||||
-clpf - . | tar -C /sysroot -xlspf - &>"${_NO_LOG}"
|
||||
# cleanup mkinitcpio directories and files
|
||||
rm -rf /sysroot/{hooks,install,kernel,new_root,sysroot} &>/dev/null
|
||||
rm -f /sysroot/{VERSION,config,buildconfig,init} &>/dev/null
|
||||
rm -rf /sysroot/{hooks,install,kernel,new_root,sysroot} &>"${_NO_LOG}"
|
||||
rm -f /sysroot/{VERSION,config,buildconfig,init} &>"${_NO_LOG}"
|
||||
# systemd needs this for root_switch
|
||||
touch /etc/initrd-release
|
||||
_progress "100" "System is ready."
|
||||
read -r -t 2
|
||||
# fix clear screen on all terminals
|
||||
printf "\ec" | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>/dev/null
|
||||
printf "\ec" | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>"${_NO_LOG}"
|
||||
# https://www.freedesktop.org/software/systemd/man/bootup.html
|
||||
# enable systemd initrd functionality
|
||||
touch /etc/initrd-release
|
||||
|
@ -84,11 +84,11 @@ _enter_shell() {
|
|||
}
|
||||
|
||||
_run_latest() {
|
||||
update -latest | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>/dev/null
|
||||
update -latest | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>"${_NO_LOG}"
|
||||
}
|
||||
|
||||
_run_latest_install() {
|
||||
update -latest-install | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>/dev/null
|
||||
update -latest-install | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>"${_NO_LOG}"
|
||||
}
|
||||
|
||||
_run_update_installer() {
|
||||
|
@ -123,7 +123,7 @@ _run_update_installer() {
|
|||
|
||||
if ! [[ -e /.vconsole-run ]]; then
|
||||
touch /.vconsole-run
|
||||
FB_SIZE="$(cut -d 'x' -f 1 "$(find /sys -wholename '*fb0/modes')" 2>/dev/null | sed -e 's#.*:##g')"
|
||||
FB_SIZE="$(cut -d 'x' -f 1 "$(find /sys -wholename '*fb0/modes')" 2>"${_NO_LOG}" | sed -e 's#.*:##g')"
|
||||
if [[ "${FB_SIZE}" -gt '1900' ]]; then
|
||||
SIZE="32"
|
||||
else
|
||||
|
@ -141,14 +141,14 @@ if ! [[ -e /.clean-pacman-db ]]; then
|
|||
memtest86+-efi mkinitcpio-busybox mtools libsysprof-capture libnsl libksba gdbm binutils \
|
||||
cdrtools systemd-ukify python python-pefile limine man-pages libev libpipeline groff db db5.3"
|
||||
for i in ${_RM_PACMAN_DB}; do
|
||||
rm -rf /var/lib/pacman/local/"${i}"-[0-9]* &>/dev/null
|
||||
rm -rf /var/lib/pacman/local/"${i}"-[0-9]* &>"${_NO_LOG}"
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "${TTY}" = "tty1" ]] ; then
|
||||
if ! mount | grep -q zram0; then
|
||||
_TITLE="Archboot $(uname -m) | Basic Setup | ZRAM"
|
||||
_switch_root_zram | _dialog --title " Initializing System... " --gauge "Creating /dev/zram0 with zstd compression..." 6 75 0 | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>/dev/null
|
||||
_switch_root_zram | _dialog --title " Initializing System... " --gauge "Creating /dev/zram0 with zstd compression..." 6 75 0 | tee -a /dev/ttyS0 /dev/ttyAMA0 /dev/ttyUSB0 /dev/pts/0 2>"${_NO_LOG}"
|
||||
else
|
||||
if ! [[ -e "${_CACHEDIR}/archboot.db" ]]; then
|
||||
systemctl start systemd-networkd
|
||||
|
|
|
@ -41,7 +41,7 @@ _create_iso() {
|
|||
# generate tarball in container, umount tmp container tmpfs, else weird things could happen
|
||||
# removing not working lvm2 from latest and local image first
|
||||
echo "Removing lvm2 from container ${_W_DIR}..."
|
||||
${_NSPAWN} "${_W_DIR}" pacman -Rdd lvm2 --noconfirm &>/dev/null
|
||||
${_NSPAWN} "${_W_DIR}" pacman -Rdd lvm2 --noconfirm &>"${_NO_LOG}"
|
||||
echo "Generating local ISO..."
|
||||
# generate local iso in container
|
||||
#if [[ "${_ARCH}" == "x86_64" ]]; then
|
||||
|
@ -56,15 +56,15 @@ _create_iso() {
|
|||
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;rm -rf /tmp/*;archboot-${_ARCH}-iso.sh -g \
|
||||
-p=${_PRESET_LATEST} -i=${_ISONAME}-latest-${_ARCH}" || exit 1
|
||||
echo "Installing lvm2 to container ${_W_DIR}..."
|
||||
${_NSPAWN} "${_W_DIR}" pacman -Sy lvm2 --noconfirm &>/dev/null
|
||||
${_NSPAWN} "${_W_DIR}" pacman -Sy lvm2 --noconfirm &>"${_NO_LOG}"
|
||||
fi
|
||||
echo "Generating normal ISO..."
|
||||
# generate iso in container
|
||||
${_NSPAWN} "${_W_DIR}" /bin/bash -c "umount /tmp;archboot-${_ARCH}-iso.sh -g -s \
|
||||
-i=${_ISONAME}-${_ARCH}" || exit 1
|
||||
# move iso out of container
|
||||
mv "${_W_DIR}"/*.iso ./ &>/dev/null
|
||||
mv "${_W_DIR}"/*.img ./ &>/dev/null
|
||||
mv "${_W_DIR}"/*.iso ./ &>"${_NO_LOG}"
|
||||
mv "${_W_DIR}"/*.img ./ &>"${_NO_LOG}"
|
||||
# create boot directory with ramdisks
|
||||
echo "Creating boot directory..."
|
||||
mkdir -p boot/
|
||||
|
@ -83,16 +83,16 @@ _create_iso() {
|
|||
else
|
||||
for i in *.iso; do
|
||||
if echo "${i}" | grep -v local | grep -vq latest; then
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>/dev/null > efi.img
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
||||
mcopy -m -i efi.img ::/"${_AMD_UCODE}" ./"${_AMD_UCODE}"
|
||||
[[ "${_ARCH}" == "aarch64" ]] || mcopy -m -i efi.img ::/"${_INTEL_UCODE}" ./"${_INTEL_UCODE}"
|
||||
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD}"
|
||||
mcopy -m -i efi.img ::/"${_KERNEL}" ./"${_KERNEL_ARCHBOOT}"
|
||||
elif echo "${i}" | grep -q latest; then
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>/dev/null > efi.img
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
||||
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD_LATEST}"
|
||||
elif echo "${i}" | grep -q local; then
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>/dev/null > efi.img
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
||||
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD_LOCAL}"
|
||||
fi
|
||||
rm efi.img
|
||||
|
@ -131,7 +131,7 @@ _create_iso() {
|
|||
#shellcheck disable=SC2086
|
||||
${_NSPAWN} "${_W_DIR}" /usr/lib/systemd/ukify ${_KERNEL_ARCHBOOT} \
|
||||
${_UCODE} ${initrd} --cmdline @${_CMDLINE} --splash ${_SPLASH} \
|
||||
--os-release @${_OSREL} --stub ${_EFISTUB} --output ${_UKI} &>/dev/null || exit 1
|
||||
--os-release @${_OSREL} --stub ${_EFISTUB} --output ${_UKI} &>"${_NO_LOG}" || exit 1
|
||||
done
|
||||
# fix permission and timestamp
|
||||
mv "${_W_DIR}"/boot ./
|
||||
|
|
|
@ -22,7 +22,7 @@ _download_packages() {
|
|||
_PACKAGES="${_PACKAGES} ${_ARCHBOOT} ${_KEYRING} ${_MAN_INFO_PACKAGES}"
|
||||
echo "Downloading ${_PACKAGES} to ${1}..."
|
||||
#shellcheck disable=SC2086
|
||||
${_PACMAN} -Syw ${_PACKAGES} ${_PACMAN_DEFAULTS} ${_PACMAN_DB} &>/dev/null || exit 1
|
||||
${_PACMAN} -Syw ${_PACKAGES} ${_PACMAN_DEFAULTS} ${_PACMAN_DB} &>"${_NO_LOG}" || exit 1
|
||||
}
|
||||
|
||||
_move_packages() {
|
||||
|
|
|
@ -36,11 +36,11 @@ _root_check
|
|||
|
||||
echo "Starting container creation..."
|
||||
# remove old files
|
||||
[[ -f ${_PACMAN_ARCH_CHROOT} ]] && rm "${_PACMAN_ARCH_CHROOT}"{,.sig} 2>/dev/null
|
||||
[[ -f ${_PACMAN_ARCH_CHROOT} ]] && rm "${_PACMAN_ARCH_CHROOT}"{,.sig} 2>"${_NO_LOG}"
|
||||
echo "Creating directory ${1}..."
|
||||
mkdir -p "${1}"/"${_PACMAN_ARCH}"
|
||||
echo "Downloading archlinux ${_ARCH}..."
|
||||
! [[ -f ${_ARCH_VERSION} ]] && wget "${_LATEST_ARCH}" &>/dev/null
|
||||
! [[ -f ${_ARCH_VERSION} ]] && wget "${_LATEST_ARCH}" &>"${_NO_LOG}"
|
||||
bsdtar -xf "${_ARCH_VERSION}" -C "${1}"
|
||||
echo "Removing installation tarball..."
|
||||
rm "${_ARCH_VERSION}"
|
||||
|
@ -52,13 +52,13 @@ _fix_network "${1}"
|
|||
echo "Installing pacman to container..."
|
||||
mkdir -p "${1}/${_PACMAN_ARCH}/var/lib/pacman"
|
||||
#shellcheck disable=SC2086
|
||||
systemd-nspawn -D "${1}" pacman --root "/${_PACMAN_ARCH}" -Sy awk ${_KEYRING} --ignore systemd-resolvconf --noconfirm &>/dev/null
|
||||
systemd-nspawn -D "${1}" pacman --root "/${_PACMAN_ARCH}" -Sy awk ${_KEYRING} --ignore systemd-resolvconf --noconfirm &>"${_NO_LOG}"
|
||||
_generate_keyring "${1}/${_PACMAN_ARCH}" || exit 1
|
||||
_fix_network "${1}/${_PACMAN_ARCH}"
|
||||
_CLEANUP_CONTAINER="1" _clean_container "${1}/${_PACMAN_ARCH}" 2>/dev/null
|
||||
_CLEANUP_CACHE="1" _clean_cache "${1}/${_PACMAN_ARCH}" 2>/dev/null
|
||||
_CLEANUP_CONTAINER="1" _clean_container "${1}/${_PACMAN_ARCH}" 2>"${_NO_LOG}"
|
||||
_CLEANUP_CACHE="1" _clean_cache "${1}/${_PACMAN_ARCH}" 2>"${_NO_LOG}"
|
||||
echo "Generating tarball..."
|
||||
tar -acf "${_PACMAN_ARCH_CHROOT}" -C "${1}"/"${_PACMAN_ARCH}" . &>/dev/null || exit 1
|
||||
tar -acf "${_PACMAN_ARCH_CHROOT}" -C "${1}"/"${_PACMAN_ARCH}" . &>"${_NO_LOG}" || exit 1
|
||||
echo "Removing ${1}..."
|
||||
rm -r "${1}"
|
||||
echo "Finished container tarball."
|
||||
|
|
|
@ -48,7 +48,7 @@ else
|
|||
_install_base_packages "${1}" "use_binfmt" || exit 1
|
||||
_install_archboot "${1}" "use_binfmt" || exit 1
|
||||
_clean_mkinitcpio "${1}"
|
||||
_clean_container "${1}" 2>/dev/null
|
||||
_clean_container "${1}" 2>"${_NO_LOG}"
|
||||
else
|
||||
echo "Error: binfmt usage is only supported on x86_64!"
|
||||
exit 1
|
||||
|
|
|
@ -21,21 +21,21 @@ _update_pacman_chroot() {
|
|||
cd "${_ISO_HOME}" || exit 1
|
||||
[[ -d "${_ARCH_DIR}" ]] || mkdir "${_ARCH_DIR}"
|
||||
echo "Downloading pacman ${_ARCH} chroot..."
|
||||
[[ -f pacman-${_ARCH}-chroot-latest.tar.zst ]] && rm pacman-"${_ARCH}"-chroot-latest.tar.zst{,.sig} 2>/dev/null
|
||||
wget "${_ARCH_CHROOT_PUBLIC}"/"${_PACMAN_CHROOT}"{,.sig} &>/dev/null
|
||||
[[ -f pacman-${_ARCH}-chroot-latest.tar.zst ]] && rm pacman-"${_ARCH}"-chroot-latest.tar.zst{,.sig} 2>"${_NO_LOG}"
|
||||
wget "${_ARCH_CHROOT_PUBLIC}"/"${_PACMAN_CHROOT}"{,.sig} &>"${_NO_LOG}"
|
||||
# verify download
|
||||
sudo -u "${_USER}" gpg --verify "${_PACMAN_CHROOT}.sig" &>/dev/null || exit 1
|
||||
bsdtar -C "${_ARCH_DIR}" -xf "${_PACMAN_CHROOT}" &>/dev/null
|
||||
sudo -u "${_USER}" gpg --verify "${_PACMAN_CHROOT}.sig" &>"${_NO_LOG}" || exit 1
|
||||
bsdtar -C "${_ARCH_DIR}" -xf "${_PACMAN_CHROOT}" &>"${_NO_LOG}"
|
||||
echo "Removing installation tarball..."
|
||||
rm "${_PACMAN_CHROOT}"{,.sig} &>/dev/null
|
||||
rm "${_PACMAN_CHROOT}"{,.sig} &>"${_NO_LOG}"
|
||||
# update container to latest packages
|
||||
echo "Updating container to latest packages..."
|
||||
# fix mirrorlist
|
||||
[[ "${_ARCH}" == "riscv64" ]] && sed -i -e 's|^#Server = https://riscv|Server = https://riscv|g' "${_ARCH_DIR}"/etc/pacman.d/mirrorlist
|
||||
${_NSPAWN} "${_ARCH_DIR}" pacman -Syu --noconfirm &>/dev/null || exit 1
|
||||
${_NSPAWN} "${_ARCH_DIR}" pacman -Syu --noconfirm &>"${_NO_LOG}" || exit 1
|
||||
_fix_network "${_ARCH_DIR}"
|
||||
_CLEANUP_CONTAINER="1" _clean_container "${_ARCH_DIR}" &>/dev/null
|
||||
_CLEANUP_CACHE="1" _clean_cache "${_ARCH_DIR}" &>/dev/null
|
||||
_CLEANUP_CONTAINER="1" _clean_container "${_ARCH_DIR}" &>"${_NO_LOG}"
|
||||
_CLEANUP_CACHE="1" _clean_cache "${_ARCH_DIR}" &>"${_NO_LOG}"
|
||||
echo "Generating tarball..."
|
||||
tar -acf "${_PACMAN_CHROOT}" -C "${_ARCH_DIR}" .
|
||||
echo "Removing ${_ARCH_DIR}..."
|
||||
|
@ -60,7 +60,7 @@ _server_upload() {
|
|||
echo "Removing old .${1}/${_ARCH}/${_DIR} directory..."
|
||||
rm -r ".${1}"/"${_ARCH}"/"${_DIR}"
|
||||
echo "Removing old purge date reached .${1}/${_ARCH}/$(date -d "$(date +) - ${_PURGE_DATE}" +%Y.%m) directory..."
|
||||
rm -r ".${1}"/"${_ARCH}"/"$(date -d "$(date +) - ${_PURGE_DATE}" +%Y.%m)" 2>/dev/null
|
||||
rm -r ".${1}"/"${_ARCH}"/"$(date -d "$(date +) - ${_PURGE_DATE}" +%Y.%m)" 2>"${_NO_LOG}"
|
||||
echo "Moving ./${_ARCH}/${_DIR} to .${1}/${_ARCH}..."
|
||||
mv "./${_ARCH}/${_DIR}" ".${1}"/"${_ARCH}"
|
||||
echo "Removing ./${_ARCH} directory..."
|
||||
|
|
Loading…
Reference in a new issue