From 9074cc4c4a362cc4643bfb3d9d01cd84b7c17a92 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Sun, 8 Sep 2024 14:34:33 +0200 Subject: [PATCH] make arrays for better reading --- etc/archboot/defaults | 65 ++++++++++++++++--- usr/bin/archboot-pacsetup.sh | 4 +- usr/bin/archboot-quickinst.sh | 11 +--- usr/bin/archboot-update.sh | 2 +- usr/lib/archboot/common.sh | 30 +++++++-- usr/lib/archboot/container.sh | 22 +++---- usr/lib/archboot/installer/base.sh | 8 +-- usr/lib/archboot/installer/bootloader.sh | 20 +++--- usr/lib/archboot/installer/bootloader_grub.sh | 8 +-- .../archboot/installer/bootloader_limine.sh | 4 +- .../archboot/installer/bootloader_refind.sh | 4 +- usr/lib/archboot/installer/bootloader_uki.sh | 4 +- usr/lib/archboot/installer/common.sh | 30 ++++----- usr/lib/archboot/installer/configuration.sh | 8 +-- usr/lib/archboot/installer/pacman.sh | 15 ++--- usr/lib/archboot/login.sh | 2 +- usr/lib/archboot/repository.sh | 6 +- usr/lib/archboot/run/container-tarball.sh | 2 +- usr/lib/archboot/update/desktop.sh | 22 +++---- usr/lib/archboot/update/gnome.sh | 4 +- usr/lib/archboot/update/manage.sh | 4 +- usr/lib/archboot/update/plasma.sh | 4 +- usr/lib/archboot/update/sway.sh | 4 +- usr/lib/archboot/update/xfce.sh | 2 +- 24 files changed, 171 insertions(+), 114 deletions(-) diff --git a/etc/archboot/defaults b/etc/archboot/defaults index c105685af..71852ad71 100644 --- a/etc/archboot/defaults +++ b/etc/archboot/defaults @@ -1,33 +1,82 @@ # Created by Tobias Powalowski # SPDX-License-Identifier: GPL-3.0-or-later # packages to install (eg. firmware, kernel packages) -_PACKAGES="base linux linux-firmware linux-firmware-marvell polkit" +_PACKAGES=( + base + linux + linux-firmware + linux-firmware-marvell + polkit +) # grub setup _GRUB_CONFIG="/usr/share/archboot/grub/archboot-main-grub.cfg" _GRUB_BACKGROUND="/usr/share/archboot/grub/archboot-background.png" ### Graphical environment defaults # ignore packages to upgrade before graphical startup eg. kernel and firmware -_GRAPHIC_IGNORE="linux linux-firmware linux-firmware-marvell" +_GRAPHIC_IGNORE=( + linux + linux-firmware + linux-firmware-marvell +) # VNC password _VNC_PW="archboot" ### Standard Web Browser: chromium or firefox _STANDARD_BROWSER="firefox" ### GNOME defaults # GNOME packages -_GNOME_PACKAGES="gnome-desktop-4 gnome-shell gnome-terminal gnome-control-center nautilus gvfs-smb gthumb file-roller gnome-keyring gedit" +_GNOME_PACKAGES=( + file-roller + gedit + gnome-control-center + gnome-desktop-4 + gnome-keyring + gnome-shell + gnome-terminal + gthumb + gvfs-smb + nautilus +) ### KDE/Plasma defaults # KDE/Plasma packages -_PLASMA_PACKAGES="plasma-wayland-session plasma-desktop konsole kscreen kate dolphin powerdevil ark gwenview" +_PLASMA_PACKAGES=( + ark + dolphin + gwenview + kate + konsole + kscreen + plasma-desktop + plasma-wayland-session + powerdevil +) ### SWAY defaults # Sway packages -_SWAY_PACKAGES="sway swaybg foot bemenu-wayland j4-dmenu-desktop wayvnc waybar ttf-font-awesome" +_SWAY_PACKAGES=( + bemenu-wayland + foot + j4-dmenu-desktop + sway + swaybg + ttf-font-awesome + waybar + wayvnc +) ### XFCE defaults # Xfce packages -_XFCE_PACKAGES="xfce4 breeze-icons gvfs-smb thunar-archive-plugin file-roller gnome-keyring mousepad ristretto" +_XFCE_PACKAGES=( + breeze-icons + file-roller + gnome-keyring + gvfs-smb + mousepad + ristretto + thunar-archive-plugin + xfce4 +) ### Custom Graphical defaults # Custom packages -_CUSTOM_XORG="" -_CUSTOM_WAYLAND="" +_CUSTOM_XORG=() +_CUSTOM_WAYLAND=() ### server setup # release directory _DIR="$(date +%Y.%m)" diff --git a/usr/bin/archboot-pacsetup.sh b/usr/bin/archboot-pacsetup.sh index 8a6efe8c8..58c2d706f 100755 --- a/usr/bin/archboot-pacsetup.sh +++ b/usr/bin/archboot-pacsetup.sh @@ -72,10 +72,8 @@ _enable_testing() { _task_pacman_keyring_install() { _pacman_keyring - _KEYRING="archlinux-keyring" - [[ "${_RUNNING_ARCH}" == "aarch64" ]] && _KEYRING="${_KEYRING} archlinuxarm-keyring" #shellcheck disable=SC2086 - pacman -Sy --noconfirm --noprogressbar ${_KEYRING} &>"${_LOG}" + pacman -Sy --noconfirm --noprogressbar ${_KEYRING[@]} &>"${_LOG}" rm /.archboot } _prepare_pacman() { diff --git a/usr/bin/archboot-quickinst.sh b/usr/bin/archboot-quickinst.sh index c6aff5511..e29967999 100755 --- a/usr/bin/archboot-quickinst.sh +++ b/usr/bin/archboot-quickinst.sh @@ -36,21 +36,16 @@ _prepare_pacman() { fi _pacman_keyring ${_PACMAN} -Sy - _KEYRING="archlinux-keyring" - [[ "${_RUNNING_ARCH}" == "aarch64" ]] && _KEYRING="${_KEYRING} archlinuxarm-keyring" #shellcheck disable=SC2086 - pacman -Sy ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} || exit 1 + pacman -Sy ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING[@]} || exit 1 } # package_installation _install_packages() { - # add packages from Archboot defaults - _PACKAGES="$(rg -o '^_PACKAGES="(.*)"' -r '$1' /etc/archboot/defaults)" - # fallback if _PACKAGES is empty - [[ -z "${_PACKAGES}" ]] && _PACKAGES="base linux linux-firmware" + . /etc/archboot/defaults _auto_packages #shellcheck disable=SC2086 - ${_PACMAN} -S ${_PACKAGES} + ${_PACMAN} -S ${_PACKAGES[@]} } _post_installation() { diff --git a/usr/bin/archboot-update.sh b/usr/bin/archboot-update.sh index 6c9bb37ee..f3514f40d 100755 --- a/usr/bin/archboot-update.sh +++ b/usr/bin/archboot-update.sh @@ -26,7 +26,7 @@ while [ $# -gt 0 ]; do -gnome|--gnome) _L_GNOME="1";; -plasma|--plasma) _L_PLASMA="1" ;; -custom-xorg|--custom-xorg) _CUSTOM_X="1" ;; - -custom-wayland|--custom-wayland) _CUSTOM_WAYLAND="1" ;; + -custom-wayland|--custom-wayland) _CUSTOM_WL="1" ;; -full-system|--full-system) _FULL_SYSTEM="1" ;; -h|--h|-help|--help|?) _usage ;; *) _usage ;; diff --git a/usr/lib/archboot/common.sh b/usr/lib/archboot/common.sh index dabda043c..a382941cf 100644 --- a/usr/lib/archboot/common.sh +++ b/usr/lib/archboot/common.sh @@ -6,14 +6,29 @@ _AMD_UCODE="boot/amd-ucode.img" _CACHEDIR="/var/cache/pacman/pkg" _CONFIG_DIR="/etc/archboot" _DLPROG="curl -L -s" -_FIX_PACKAGES="libelf libevent talloc gcc-libs glibc glib2 icu pcre2 nss terminus-font" +_FIX_PACKAGES=( + libelf + libevent + talloc + gcc-libs + glibc + glib2 + icu + pcre2 + nss + terminus-font +) _INTEL_UCODE="boot/intel-ucode.img" _KERNELPKG="linux" -_KEYRING="archlinux-keyring" +_KEYRING=(archlinux-keyring) _LABEL="Exit" _LOCAL_DB="${_CACHEDIR}/archboot.db" _LOG="/dev/tty11" -_MAN_INFO_PACKAGES="man-db man-pages texinfo" +_MAN_INFO_PACKAGES=( + man-db + man-pages + texinfo +) _MEM_TOTAL="$(rg -o 'MemTotal.* (\d+)' -r '$1' /proc/meminfo)" _NO_LOG="/dev/null" _OSREL="/usr/share/archboot/base/etc/os-release" @@ -25,7 +40,12 @@ _RSYNC="rsync -a -q --delete --delete-delay" _RUNNING_ARCH="$(uname -m)" _RUNNING_KERNEL="$(uname -r)" _SPLASH="/usr/share/archboot/uki/archboot-background.bmp" -_STANDARD_PACKAGES="gparted xorg-xhost mtools noto-fonts" +_STANDARD_PACKAGES=( + gparted + xorg-xhost + mtools + noto-fonts +) _VNC_PACKAGE="tigervnc" _WAYLAND_PACKAGE="egl-wayland" _XORG_PACKAGE="xorg" @@ -36,7 +56,7 @@ _VC_NUM="${_LOG/\/dev\/tty/}" _VC="VC${_VC_NUM}" if echo "${_BASENAME}" | rg -qw aarch64; then _ARCHBOOT="archboot-arm" - _KEYRING="${_KEYRING} archlinuxarm-keyring" + _KEYRING+="archlinuxarm-keyring" _ARCH="aarch64" elif echo "${_BASENAME}" | rg -qw riscv64; then _ARCHBOOT="archboot-riscv" diff --git a/usr/lib/archboot/container.sh b/usr/lib/archboot/container.sh index 368fad246..22fc93b63 100644 --- a/usr/lib/archboot/container.sh +++ b/usr/lib/archboot/container.sh @@ -95,7 +95,7 @@ _prepare_pacman() { rm -f "${_PACMAN_LIB}"/sync/archboot.db echo "Updating Arch Linux keyring..." #shellcheck disable=SC2086 - pacman -Sy --config ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING} &>"${_NO_LOG}" + pacman -Sy --config ${_PACMAN_CONF} --noconfirm --noprogressbar ${_KEYRING[@]} &>"${_NO_LOG}" } #shellcheck disable=SC2120 @@ -160,28 +160,28 @@ _install_base_packages() { _MKINITCPIO=initramfs fi if [[ "${2}" == "use_binfmt" ]]; then - echo "Downloading ${_KEYRING} ${_PACKAGES} to ${1}..." + echo "Downloading ${_KEYRING[@]} ${_PACKAGES[@]} to ${1}..." if rg -qw 'archboot' /etc/hostname; then #shellcheck disable=SC2086 - ${_PACMAN} -Syw ${_KEYRING} ${_PACKAGES} ${_PACMAN_DEFAULTS} \ + ${_PACMAN} -Syw ${_KEYRING[@]} ${_PACKAGES[@]} ${_PACMAN_DEFAULTS} \ ${_PACMAN_DB} &>"${_LOG}" || exit 1 else #shellcheck disable=SC2086 - ${_PACMAN} -Syw ${_KEYRING} ${_PACKAGES} ${_PACMAN_DEFAULTS} \ + ${_PACMAN} -Syw ${_KEYRING[@]} ${_PACKAGES[@]} ${_PACMAN_DEFAULTS} \ ${_PACMAN_DB} &>"${_NO_LOG}" || exit 1 fi fi - echo "Installing ${_KEYRING} ${_PACKAGES} to ${1}..." + echo "Installing ${_KEYRING[@]} ${_PACKAGES[@]} to ${1}..." if rg -qw 'archboot' /etc/hostname; then #shellcheck disable=SC2086 - ${_PACMAN} -Sy --assume-installed ${_MKINITCPIO} ${_KEYRING} ${_PACKAGES} \ + ${_PACMAN} -Sy --assume-installed ${_MKINITCPIO} ${_KEYRING[@]} ${_PACKAGES[@]} \ ${_PACMAN_DEFAULTS} &>"${_LOG}" || exit 1 echo "Downloading mkinitcpio to ${1}..." #shellcheck disable=SC2086 ${_PACMAN} -Syw mkinitcpio ${_PACMAN_DEFAULTS} >"${_LOG}" 2>&1 || exit 1 else #shellcheck disable=SC2086 - ${_PACMAN} -Sy --assume-installed ${_MKINITCPIO} ${_KEYRING} ${_PACKAGES} \ + ${_PACMAN} -Sy --assume-installed ${_MKINITCPIO} ${_KEYRING[@]} ${_PACKAGES[@]} \ ${_PACMAN_DEFAULTS} &>"${_NO_LOG}" || exit 1 echo "Downloading mkinitcpio to ${1}..." #shellcheck disable=SC2086 @@ -199,16 +199,16 @@ _install_archboot() { if rg -qw 'archboot' /etc/hostname; then #shellcheck disable=SC2086 ${_PACMAN} -Sy ${_ARCHBOOT} ${_PACMAN_DEFAULTS} &>"${_LOG}" || exit 1 - echo "Downloading ${_MAN_INFO_PACKAGES} to ${1}..." + echo "Downloading ${_MAN_INFO_PACKAGES[@]} to ${1}..." #shellcheck disable=SC2086 - ${_PACMAN} -Syw ${_MAN_INFO_PACKAGES} ${_PACMAN_DEFAULTS} \ + ${_PACMAN} -Syw ${_MAN_INFO_PACKAGES[@]} ${_PACMAN_DEFAULTS} \ ${_PACMAN_DB} &>"${_LOG}" || exit 1 else #shellcheck disable=SC2086 ${_PACMAN} -Sy ${_ARCHBOOT} ${_PACMAN_DEFAULTS} &>"${_NO_LOG}" || exit 1 - echo "Downloading ${_MAN_INFO_PACKAGES} to ${1}..." + echo "Downloading ${_MAN_INFO_PACKAGES[@]} to ${1}..." #shellcheck disable=SC2086 - ${_PACMAN} -Syw ${_MAN_INFO_PACKAGES} ${_PACMAN_DEFAULTS} \ + ${_PACMAN} -Syw ${_MAN_INFO_PACKAGES[@]} ${_PACMAN_DEFAULTS} \ ${_PACMAN_DB} &>"${_NO_LOG}" || exit 1 fi # cleanup diff --git a/usr/lib/archboot/installer/base.sh b/usr/lib/archboot/installer/base.sh index 3d11bb0dc..b2048001e 100644 --- a/usr/lib/archboot/installer/base.sh +++ b/usr/lib/archboot/installer/base.sh @@ -33,8 +33,8 @@ _geteditor() { case $(cat "${_ANSWER}") in "NANO") _EDITOR="nano" if ! [[ -f "${_DESTDIR}/usr/bin/nano" ]]; then - _PACKAGES="nano" - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(nano) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error _dialog --no-mouse --title " Autoconfiguration " --infobox "Enable nano's syntax highlighting on installed system..." 3 70 rg -q '^include' "${_DESTDIR}/etc/nanorc" || \ @@ -44,8 +44,8 @@ _geteditor() { ;; "NEOVIM") _EDITOR="nvim" if ! [[ -f "${_DESTDIR}/usr/bin/nvim" ]]; then - _PACKAGES="neovim" - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(neovim) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi ;; diff --git a/usr/lib/archboot/installer/bootloader.sh b/usr/lib/archboot/installer/bootloader.sh index edcf953ea..97aa7b22e 100644 --- a/usr/lib/archboot/installer/bootloader.sh +++ b/usr/lib/archboot/installer/bootloader.sh @@ -130,18 +130,18 @@ _abort_bcachefs_bootpart() { } _uefi_common() { - _PACKAGES="" + _PACKAGES=() _DEV="" _BOOTDEV="" - [[ -f "${_DESTDIR}/usr/bin/mkfs.vfat" ]] || _PACKAGES="${_PACKAGES} dosfstools" - [[ -f "${_DESTDIR}/usr/bin/efivar" ]] || _PACKAGES="${_PACKAGES} efivar" - [[ -f "${_DESTDIR}/usr/bin/efibootmgr" ]] || _PACKAGES="${_PACKAGES} efibootmgr" + [[ -f "${_DESTDIR}/usr/bin/mkfs.vfat" ]] || _PACKAGES+="dosfstools" + [[ -f "${_DESTDIR}/usr/bin/efivar" ]] || _PACKAGES+="efivar" + [[ -f "${_DESTDIR}/usr/bin/efibootmgr" ]] || _PACKAGES+="efibootmgr" if [[ -n "${_UEFI_SECURE_BOOT}" ]]; then - [[ -f "${_DESTDIR}/usr/bin/mokutil" ]] || _PACKAGES="${_PACKAGES} mokutil" - [[ -f "${_DESTDIR}/usr/bin/sbsign" ]] || _PACKAGES="${_PACKAGES} sbsigntools" + [[ -f "${_DESTDIR}/usr/bin/mokutil" ]] || _PACKAGES+="mokutil" + [[ -f "${_DESTDIR}/usr/bin/sbsign" ]] || _PACKAGES+="sbsigntools" fi - if [[ -n "${_PACKAGES}" ]]; then - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + if [[ -n "${_PACKAGES[@]}" ]]; then + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi # automounted /boot and ESP needs to be mounted first, trigger mount with ls @@ -244,8 +244,8 @@ _install_bootloader() { fi if [[ -n "${_UCODE}" ]]; then if ! [[ -f "${_DESTDIR}/boot/${_UCODE}" ]]; then - _PACKAGES="${_UCODE_PKG}" - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(${_UCODE_PKG}) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi fi diff --git a/usr/lib/archboot/installer/bootloader_grub.sh b/usr/lib/archboot/installer/bootloader_grub.sh index 0e5e339c9..8b6933982 100644 --- a/usr/lib/archboot/installer/bootloader_grub.sh +++ b/usr/lib/archboot/installer/bootloader_grub.sh @@ -26,13 +26,13 @@ _grub_common_before() { _common_bootloader_checks _abort_bcachefs_bootpart || return 1 if [[ ! -d "${_DESTDIR}/usr/lib/grub" ]]; then - _PACKAGES="grub" - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(grub) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi if [[ ! -f "${_DESTDIR}/usr/share/grub/ter-u16n.pf2" ]]; then - _PACKAGES=terminus-font - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(terminus-font) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi } diff --git a/usr/lib/archboot/installer/bootloader_limine.sh b/usr/lib/archboot/installer/bootloader_limine.sh index 378c068fe..8a2b223fa 100644 --- a/usr/lib/archboot/installer/bootloader_limine.sh +++ b/usr/lib/archboot/installer/bootloader_limine.sh @@ -3,8 +3,8 @@ # created by Tobias Powalowski _limine_common() { if [[ ! -f "${_DESTDIR}/usr/bin/limine" ]]; then - _PACKAGES="limine" - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(limine) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi } diff --git a/usr/lib/archboot/installer/bootloader_refind.sh b/usr/lib/archboot/installer/bootloader_refind.sh index 842fd671a..d43a8e529 100644 --- a/usr/lib/archboot/installer/bootloader_refind.sh +++ b/usr/lib/archboot/installer/bootloader_refind.sh @@ -3,8 +3,8 @@ # created by Tobias Powalowski _refind_uefi() { if [[ ! -f "${_DESTDIR}/usr/bin/refind-install" ]]; then - _PACKAGES="refind" - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(refind) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi _dialog --no-mouse --infobox "Setting up rEFInd now..." 3 60 diff --git a/usr/lib/archboot/installer/bootloader_uki.sh b/usr/lib/archboot/installer/bootloader_uki.sh index 58d84dcc8..9c8979692 100644 --- a/usr/lib/archboot/installer/bootloader_uki.sh +++ b/usr/lib/archboot/installer/bootloader_uki.sh @@ -36,8 +36,8 @@ _uki_install() { _uki_uefi() { if [[ ! -f "${_DESTDIR}/usr/lib/systemd/ukify" ]]; then - _PACKAGES="systemd-ukify" - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 7 75 0 + _PACKAGES=(systemd-ukify) + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 7 75 0 _pacman_error fi _uki_config diff --git a/usr/lib/archboot/installer/common.sh b/usr/lib/archboot/installer/common.sh index fb6af75f6..bd998ca89 100644 --- a/usr/lib/archboot/installer/common.sh +++ b/usr/lib/archboot/installer/common.sh @@ -30,11 +30,11 @@ fi _PACMAN="pacman --root ${_DESTDIR} --cachedir=${_DESTDIR}${_CACHEDIR} --noconfirm" _linux_firmware() { - _PACKAGES="${_PACKAGES// linux-firmware / }" + _PACKAGES[@]="${_PACKAGES[@]// linux-firmware / }" #shellcheck disable=SC2013 for i in $(choose 0 "${_LOG}" && : > /tmp/.pacman-success + ${_PACMAN} -Sy ${_PACKAGES[@]} &>"${_LOG}" && : > /tmp/.pacman-success rm /.archboot } @@ -16,7 +16,7 @@ _run_pacman(){ [[ ! -d "${_DESTDIR}${_PACMAN_LIB}" ]] && mkdir -p "${_DESTDIR}${_PACMAN_LIB}" : > /.archboot _pacman & - _progress_wait "0" "99" "Installing package(s):\n${_PACKAGES}..." "2" + _progress_wait "0" "99" "Installing package(s):\n${_PACKAGES[@]}..." "2" # pacman finished, display scrollable output if [[ -e "/tmp/.pacman-success" ]]; then _progress "100" "Package installation complete." 6 75 @@ -61,16 +61,11 @@ _run_autoconfig() { _install_packages() { _destdir_mounts || return 1 - _PACKAGES="" # add packages from Archboot defaults - _PACKAGES="$(rg -o '^_PACKAGES="(.*)"' -r '$1' /etc/archboot/defaults)" - # fallback if _PACKAGES is empty - [[ -z "${_PACKAGES}" ]] && _PACKAGES="base linux linux-firmware" + . /etc/arhboot/defaults _auto_packages - # fix double spaces - _PACKAGES="${_PACKAGES// / }" - _dialog --title " Summary " --yesno "Next step will install the following packages for a minimal system:\n${_PACKAGES}\n\nYou can watch the progress on your ${_VC} console." 9 75 || return 1 - _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES}..." 8 75 0 + _dialog --title " Summary " --yesno "Next step will install the following packages for a minimal system:\n${_PACKAGES[@]}\n\nYou can watch the progress on your ${_VC} console." 9 75 || return 1 + _run_pacman | _dialog --title " Logging to ${_VC} | ${_LOG} " --gauge "Installing package(s):\n${_PACKAGES[@]}..." 8 75 0 _pacman_error || return 1 _NEXTITEM=3 _chroot_mount diff --git a/usr/lib/archboot/login.sh b/usr/lib/archboot/login.sh index 942fe3f5f..482238dca 100644 --- a/usr/lib/archboot/login.sh +++ b/usr/lib/archboot/login.sh @@ -138,7 +138,7 @@ _run_autorun() { _pacman_keyring echo "Updating pacman keyring..." #shellcheck disable=SC2086 - pacman -Sy --noconfirm ${_KEYRING} &>"${_LOG}" + pacman -Sy --noconfirm ${_KEYRING[@]} &>"${_LOG}" chmod 755 /etc/archboot/run/autorun.sh echo "Running custom autorun.sh..." /etc/archboot/run/./autorun.sh diff --git a/usr/lib/archboot/repository.sh b/usr/lib/archboot/repository.sh index 5afd41766..7bdde9f64 100644 --- a/usr/lib/archboot/repository.sh +++ b/usr/lib/archboot/repository.sh @@ -19,10 +19,10 @@ _download_packages() { else _pacman_key_system fi - _PACKAGES="${_KEYRING} ${_ARCHBOOT} ${_PACKAGES} ${_MAN_INFO_PACKAGES}" - echo "Downloading ${_PACKAGES} to ${1}..." + _PACKAGES+="${_KEYRING[@]} ${_ARCHBOOT} ${_MAN_INFO_PACKAGES[@]}" + echo "Downloading ${_PACKAGES[@]} to ${1}..." #shellcheck disable=SC2086 - ${_PACMAN} -Syw ${_PACKAGES} ${_PACMAN_DEFAULTS} ${_PACMAN_DB} &>"${_NO_LOG}" || exit 1 + ${_PACMAN} -Syw ${_PACKAGES[@]} ${_PACMAN_DEFAULTS} ${_PACMAN_DB} &>"${_NO_LOG}" || exit 1 } _move_packages() { diff --git a/usr/lib/archboot/run/container-tarball.sh b/usr/lib/archboot/run/container-tarball.sh index ef38879f2..3e9a6976e 100755 --- a/usr/lib/archboot/run/container-tarball.sh +++ b/usr/lib/archboot/run/container-tarball.sh @@ -51,7 +51,7 @@ _fix_network "${1}" echo "Installing pacman to container..." mkdir -p "${1}/${_PACMAN_ARCH}${_PACMAN_LIB}" #shellcheck disable=SC2086 -systemd-nspawn -D "${1}" pacman --root "/${_PACMAN_ARCH}" -Sy awk ${_KEYRING} \ +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}" diff --git a/usr/lib/archboot/update/desktop.sh b/usr/lib/archboot/update/desktop.sh index 10aec6af4..25e00069b 100644 --- a/usr/lib/archboot/update/desktop.sh +++ b/usr/lib/archboot/update/desktop.sh @@ -34,14 +34,14 @@ _run_pacman() { } _update_packages() { -_IGNORE="" - if [[ -n "${_GRAPHIC_IGNORE}" ]]; then - for i in ${_GRAPHIC_IGNORE}; do - _IGNORE="${_IGNORE} --ignore ${i}" +_IGNORE=() + if [[ -n "${_GRAPHIC_IGNORE[@]}" ]]; then + for i in ${_GRAPHIC_IGNORE[@]}; do + _IGNORE+="--ignore ${i}" done fi #shellcheck disable=SC2086 - LC_ALL=C.UTF-8 pacman -Syu ${_IGNORE} --noconfirm &>"${_LOG}" + LC_ALL=C.UTF-8 pacman -Syu ${_IGNORE[@]} --noconfirm &>"${_LOG}" if [[ ! -e "/.full_system" ]]; then _cleanup fi @@ -49,16 +49,16 @@ _IGNORE="" } _install_fix_packages() { - _run_pacman "${_FIX_PACKAGES}" + _run_pacman "${_FIX_PACKAGES[@]}" rm /.archboot } _install_graphic() { # check for qxl module if rg -q qxl /proc/modules; then - _GRAPHIC="${_GRAPHIC} xf86-video-qxl" + _GRAPHIC+="xf86-video-qxl" fi - _run_pacman "${_GRAPHIC}" + _run_pacman "${_GRAPHIC[@]}" rm /.archboot } @@ -124,15 +124,15 @@ _prepare_browser() { } _custom_wayland_xorg() { - if [[ -n "${_CUSTOM_WAYLAND}" ]]; then + if [[ -n "${_CUSTOM_WL}" ]]; then echo -e "\e[1mStep 1/2:\e[m Installing custom wayland..." echo " This will need some time..." - _prepare_graphic "${_WAYLAND_PACKAGE} ${_CUSTOM_WAYLAND}" > "${_LOG}" 2>&1 + _prepare_graphic "${_WAYLAND_PACKAGE} ${_CUSTOM_WAYLAND[@]}" > "${_LOG}" 2>&1 fi if [[ -n "${_CUSTOM_X}" ]]; then echo -e "\e[1mStep 1/2:\e[m Installing custom xorg..." echo " This will need some time..." - _prepare_graphic "${_XORG_PACKAGE} ${_CUSTOM_XORG}" > "${_LOG}" 2>&1 + _prepare_graphic "${_XORG_PACKAGE} ${_CUSTOM_XORG[@]}" > "${_LOG}" 2>&1 fi echo -e "\e[1mStep 2/2:\e[m Setting up browser...\e[m" command -v firefox &>"${_NO_LOG}" && _firefox_flags diff --git a/usr/lib/archboot/update/gnome.sh b/usr/lib/archboot/update/gnome.sh index e56bc8b80..0d14eb909 100644 --- a/usr/lib/archboot/update/gnome.sh +++ b/usr/lib/archboot/update/gnome.sh @@ -28,14 +28,14 @@ EOF _prepare_gnome() { if ! [[ -e /usr/bin/gnome-session ]]; then - _prepare_graphic "${_PACKAGES}" + _prepare_graphic "${_PACKAGES[@]}" fi _prepare_browser >"${_LOG}" 2>&1 _configure_gnome >"${_LOG}" 2>&1 } _install_gnome() { - _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_GNOME_PACKAGES}" + _PACKAGES=(${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES[@]} ${_GNOME_PACKAGES[@]}) _prepare_gnome } diff --git a/usr/lib/archboot/update/manage.sh b/usr/lib/archboot/update/manage.sh index 47c819142..a29d4c22e 100644 --- a/usr/lib/archboot/update/manage.sh +++ b/usr/lib/archboot/update/manage.sh @@ -306,7 +306,7 @@ _new_environment() { _full_system() { _progress "1" "Refreshing pacman package database..." pacman -Sy >"${_LOG}" 2>&1 || exit 1 - _PACKAGES="$(pacman -Qqn)" + _PACKAGES=($(pacman -Qqn)) _COUNT=0 _PACKAGE_COUNT="$(pacman -Qqn | wc -l)" if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then @@ -314,7 +314,7 @@ _full_system() { else _MKINITCPIO="initramfs" fi - for i in ${_PACKAGES}; do + for i in ${_PACKAGES[@]}; do if [[ "$((_COUNT*100/_PACKAGE_COUNT-4))" -gt 1 ]]; then _progress "$((_COUNT*100/_PACKAGE_COUNT-4))" "Reinstalling all packages, installing ${i} now..." fi diff --git a/usr/lib/archboot/update/plasma.sh b/usr/lib/archboot/update/plasma.sh index ebd18d2de..e66ead712 100644 --- a/usr/lib/archboot/update/plasma.sh +++ b/usr/lib/archboot/update/plasma.sh @@ -63,14 +63,14 @@ EOF _prepare_plasma() { if ! [[ -e /usr/bin/startplasma-x11 ]]; then - _prepare_graphic "${_PACKAGES}" + _prepare_graphic "${_PACKAGES[@]}" fi _prepare_browser >"${_LOG}" 2>&1 _configure_plasma >"${_LOG}" 2>&1 } _install_plasma() { - _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_PLASMA_PACKAGES}" + _PACKAGES=(${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES[@]} ${_PLASMA_PACKAGES[@]}) _prepare_plasma } diff --git a/usr/lib/archboot/update/sway.sh b/usr/lib/archboot/update/sway.sh index 44bc9b823..a3da21f59 100644 --- a/usr/lib/archboot/update/sway.sh +++ b/usr/lib/archboot/update/sway.sh @@ -102,9 +102,9 @@ EOF } _install_sway() { - _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_SWAY_PACKAGES}" + _PACKAGES=(${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES[@]} ${_SWAY_PACKAGES[@]}) if ! [[ -e /usr/bin/sway ]]; then - _prepare_graphic "${_PACKAGES}" + _prepare_graphic "${_PACKAGES[@]}" fi _prepare_browser >"${_LOG}" 2>&1 _configure_sway >"${_LOG}" 2>&1 diff --git a/usr/lib/archboot/update/xfce.sh b/usr/lib/archboot/update/xfce.sh index b3866fbc1..6546628cf 100644 --- a/usr/lib/archboot/update/xfce.sh +++ b/usr/lib/archboot/update/xfce.sh @@ -3,7 +3,7 @@ # created by Tobias Powalowski _install_xfce() { if ! [[ -e /usr/bin/startxfce4 ]]; then - _prepare_graphic "${_XORG_PACKAGE} ${_VNC_PACKAGE} ${_STANDARD_PACKAGES} ${_XFCE_PACKAGES}" + _prepare_graphic "${_XORG_PACKAGE} ${_VNC_PACKAGE} ${_STANDARD_PACKAGES[@]} ${_XFCE_PACKAGES[@]}" fi _prepare_browser >"${_LOG}" 2>&1 _configure_xfce >"${_LOG}" 2>&1