Convert package lists to arrays to fix some issues.

This commit is contained in:
natemaia 2020-04-23 21:03:44 -07:00
parent 9c04406346
commit 2dec81e0a8

View File

@ -7,7 +7,7 @@
# shellcheck disable=SC2086,SC2046 # shellcheck disable=SC2086,SC2046
VER=2.1.28 VER=2.1.30
# default values { # default values {
@ -29,31 +29,44 @@ USER_CMD="" # optional command(s) entered by the user to
export DIALOGOPTS="--cr-wrap" # dialog environment variable to hold default options, see `man dialog` export DIALOGOPTS="--cr-wrap" # dialog environment variable to hold default options, see `man dialog`
typeset -a PACKAGES USER_PKGS
# packages installed for all installation types as a baseline # packages installed for all installation types as a baseline
BASE_PKGS="base base-devel xorg xorg-drivers git gvfs gtk3 libmad libmatroska tumbler " typeset -a BASE_PKGS=(
BASE_PKGS+="playerctl pulseaudio pulseaudio-alsa pavucontrol sudo pamixer scrot xdg-user-dirs " "base" "base-devel" "xorg" "xorg-drivers" "sudo" "git" "gvfs" "gtk3"
BASE_PKGS+="ffmpeg gstreamer gst-libav gst-plugins-base gst-plugins-good bash-completion xterm" "libmad" "libmatroska" "tumbler" "ffmpeg" "gstreamer" "gst-libav" "pamixer"
"gst-plugins-base" "scrot" "gst-plugins-good" "bash-completion" "xterm"
"playerctl" "pulseaudio" "pulseaudio-alsa" "pavucontrol" "xdg-user-dirs"
)
# packages installed specific to archlabs, installed when any session is chosen # packages installed specific to archlabs, installed when any session is chosen
AL_BASE_PKGS="archlabs-keyring archlabs-icons archlabs-fonts archlabs-themes " typeset -a AL_PKGS=(
AL_BASE_PKGS+="archlabs-baph archlabs-wallpapers archlabs-scripts archlabs-skel-base" "archlabs-keyring" "archlabs-icons" "archlabs-fonts" "archlabs-themes"
"archlabs-baph" "archlabs-wallpapers" "archlabs-scripts" "archlabs-skel-base"
)
# packages installed for most window managers to provide some basic functionality # packages installed for most window managers to provide some basic functionality
WM_BASE_PKGS="arandr nitrogen polkit-gnome network-manager-applet " typeset -a WM_PKGS=(
WM_BASE_PKGS+="volumeicon xclip exo laptop-detect xdotool picom wmctrl feh " "arandr" "nitrogen" "polkit-gnome" "network-manager-applet" "feh"
WM_BASE_PKGS+="gnome-keyring dunst gsimplecal xfce4-power-manager xfce4-settings" "volumeicon" "xclip" "exo" "laptop-detect" "xdotool" "picom" "wmctrl"
"gnome-keyring" "dunst" "gsimplecal" "xfce4-power-manager" "xfce4-settings"
)
# packages installed when choosing to use pacstrap # packages installed when choosing to use pacstrap
ISO_PKGS="arch-install-scripts b43-firmware b43-fwcutter broadcom-wl btrfs-progs " typeset -a ISO_PKGS=(
ISO_PKGS+="clonezilla crda darkhttpd ddrescue dhclient dhcpcd dialog diffutils dmraid " "arch-install-scripts" "b43-firmware" "b43-fwcutter" "broadcom-wl" "btrfs-progs"
ISO_PKGS+="dnsmasq dnsutils dosfstools elinks ethtool exfat-utils f2fs-tools fsarchiver " "clonezilla" "crda" "darkhttpd" "ddrescue" "dhclient" "dhcpcd" "dialog" "diffutils"
ISO_PKGS+="ppp pptpclient refind-efi reiserfsprogs rp-pppoe rsync sdparm sg3_utils smartmontools " "dmraid" "dnsmasq" "dnsutils" "dosfstools" "elinks" "ethtool" "exfat-utils" "f2fs-tools"
ISO_PKGS+="linux-firmware lsscsi lvm2 man-db man-pages mc mdadm mtools nano ndisc6 netctl nfs-utils " "fsarchiver" "ppp" "pptpclient" "reiserfsprogs" "rp-pppoe" "rsync" "sdparm" "sg3_utils"
ISO_PKGS+="nilfs-utils nmap ntfs-3g ntp openconnect openssh openvpn p7zip partclone parted partimage " "smartmontools" "linux-firmware" "lsscsi" "lvm2" "man-db" "man-pages" "mc" "mdadm" "mtools"
ISO_PKGS+="gpm gptfdisk hdparm htop ipw2100-fw ipw2200-fw irssi iwd jfsutils lftp linux-atm gnu-netcat " "nano" "ndisc6" "netctl" "nfs-utils" "nilfs-utils" "nmap" "ntfs-3g" "ntp" "openconnect"
ISO_PKGS+="tcpdump testdisk unrar usb_modeswitch usbutils vi vim vpnc wget wireless-regdb wireless_tools " "openssh" "openvpn" "p7zip" "partclone" "parted" "partimage" "gpm" "gptfdisk" "hdparm"
ISO_PKGS+="wpa_supplicant wvdial xfsprogs xl2tpd alsa-firmware alsa-lib alsa-plugins geoclue2 lm_sensors " "htop" "ipw2100-fw" "ipw2200-fw" "irssi" "iwd" "jfsutils" "iputils" "lftp" "linux-atm"
ISO_PKGS+="lsb-release networkmanager pacman-contrib reflector terminus-font ttf-dejavu archlabs-keyring " "gnu-netcat" "tcpdump" "testdisk" "unrar" "usb_modeswitch" "usbutils" "vi" "vim" "vpnc"
"wget" "wvdial" "wireless-regdb" "wireless_tools" "wpa_supplicant" "xfsprogs" "xl2tpd"
"alsa-firmware" "alsa-lib" "alsa-plugins" "geoclue2" "lsb-release" "networkmanager"
"pacman-contrib" "reflector" "terminus-font" "ttf-dejavu" "archlabs-keyring" "lm_sensors"
)
SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)" SYS_MEM="$(awk '/MemTotal/ {print int($2 / 1024) "M"}' /proc/meminfo)"
LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if ($1) {print $1 " - "}}' /etc/locale.gen)" LOCALES="$(awk '/\.UTF-8/ {gsub(/# .*|#/, ""); if ($1) {print $1 " - "}}' /etc/locale.gen)"
@ -240,7 +253,7 @@ main()
select_show() select_show()
{ {
local pkgs="${USER_PKGS// / } ${PACKAGES// / }" local pkgs="${USER_PKGS[*]} ${PACKAGES[*]}"
[[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs" [[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs"
pkgs="${pkgs// / }" pkgs="${pkgs# }" pkgs="${pkgs// / }" pkgs="${pkgs# }"
msg "Show Configuration" " msg "Show Configuration" "
@ -473,9 +486,9 @@ select_sessions()
cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")" cinnamon "A desktop environment combining traditional desktop with modern effects" "$(ofn cinnamon "${INSTALL_WMS[*]}")"
[[ $INSTALL_WMS ]] || return 0 [[ $INSTALL_WMS ]] || return 0
WM_PKGS="${INSTALL_WMS/dwm/}" for i in ${INSTALL_WMS/dwm/}; do
WM_PKGS="${WM_PKGS// / }" WM_PKGS+=("$i")
WM_PKGS="${WM_PKGS# }" done
for i in $INSTALL_WMS; do for i in $INSTALL_WMS; do
LOGIN_CHOICES+="$i - " LOGIN_CHOICES+="$i - "
@ -484,21 +497,25 @@ select_sessions()
yesno "${i^} Extra" \ yesno "${i^} Extra" \
"\nThere are some extra packages available for $i that you may want installed: ${WM_EXT[$i]}\n\n$txt\n\nWould you like to install them?\n" || continue "\nThere are some extra packages available for $i that you may want installed: ${WM_EXT[$i]}\n\n$txt\n\nWould you like to install them?\n" || continue
fi fi
[[ ${WM_EXT[$i]} && $WM_PKGS != *"${WM_EXT[$i]}"* ]] && WM_PKGS+=" ${WM_EXT[$i]}" if [[ ${WM_EXT[$i]} ]]; then
for j in ${WM_EXT[$i]}; do
[[ ${WM_PKGS[*]} != *"$j"* ]] && WM_PKGS+=("$j")
done
fi
done done
select_login || return 1 select_login || return 1
while IFS=' ' read -r pkg; do for pkg in "${WM_PKGS[@]}"; do
[[ $PACKAGES != *"$pkg"* ]] && PACKAGES+=" $pkg" [[ ${PACKAGES[*]} != *"$pkg"* ]] && PACKAGES+=("$pkg")
done <<< "$WM_PKGS" done
return 0 return 0
} }
select_packages() select_packages()
{ {
dlg USER_PKGS check " Packages " "$_packages" \ dlg UPKGS check " Packages " "$_packages" \
abiword "A Fully-featured word processor" "$(ofn abiword "${USER_PKGS[*]}")" \ abiword "A Fully-featured word processor" "$(ofn abiword "${USER_PKGS[*]}")" \
alacritty "A cross-platform, GPU-accelerated terminal emulator" "$(ofn alacritty "${USER_PKGS[*]}")" \ alacritty "A cross-platform, GPU-accelerated terminal emulator" "$(ofn alacritty "${USER_PKGS[*]}")" \
atom "An open-source text editor developed by GitHub" "$(ofn atom "${USER_PKGS[*]}")" \ atom "An open-source text editor developed by GitHub" "$(ofn atom "${USER_PKGS[*]}")" \
@ -586,9 +603,13 @@ select_packages()
xreader "Document viewer for files like PDF and Postscript. X-Apps Project." "$(ofn xed "${USER_PKGS[*]}")" \ xreader "Document viewer for files like PDF and Postscript. X-Apps Project." "$(ofn xed "${USER_PKGS[*]}")" \
zathura "Minimalistic document viewer" "$(ofn zathura "${USER_PKGS[*]}")" zathura "Minimalistic document viewer" "$(ofn zathura "${USER_PKGS[*]}")"
if [[ $USER_PKGS ]]; then # add any needed PKG_EXT to the list if [[ $UPKGS ]]; then # add any needed PKG_EXT to the list
for i in $USER_PKGS; do for i in $UPKGS; do
[[ ${PKG_EXT[$i]} && $USER_PKGS != *"${PKG_EXT[$i]}"* ]] && USER_PKGS+=" ${PKG_EXT[$i]}" if [[ ${PKG_EXT[$i]} ]]; then
for j in ${PKG_EXT[$i]}; do
[[ ${USER_PKGS[*]} != *"$j"* ]] && USER_PKGS+=("$j")
done
fi
done done
fi fi
@ -1257,8 +1278,13 @@ install_base()
if [[ $PACSTRAP == 1 ]]; then if [[ $PACSTRAP == 1 ]]; then
# we have some customizations in /etc on the iso we want to preserve # we have some customizations in /etc on the iso we want to preserve
if [[ $DIST == "ArchLabs" ]]; then if [[ $DIST == "ArchLabs" ]]; then
cp -aTvf /etc/skel/ "$MNT/etc/" cp -vf /etc/dialogrc "$MNT/etc/dialogrc"
rm -rf "$MNT/etc/mkinitcpio-archiso.conf" cp -vf /etc/os-release "$MNT/etc/os-release"
cp -vf /etc/lsb-release "$MNT/etc/lsb-release"
cp -vf /etc/skel/.zshrc "$MNT/etc/skel/.zshrc"
cp -vf /etc/pacman.conf "$MNT/etc/pacman.conf"
cp -vf /etc/modprobe.d/* "$MNT/etc/modprobe.d/"
cp -vf /etc/X11/xorg.conf.d/* "$MNT/etc/X11/xorg.conf.d/"
fi fi
else else
# archiso files # archiso files
@ -1268,17 +1294,17 @@ install_base()
# vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio # vmlinuz, if this isn't copied the standard kernel may fail mkinitcpio
cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> "$ERR" cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2> "$ERR"
errshow 1 "cp -vf '$RUN/x86_64/vmlinuz' '$MNT/boot/vmlinuz-linux'" errshow 1 "cp -vf '$RUN/x86_64/vmlinuz' '$MNT/boot/vmlinuz-linux'"
fi
# remove/disable customizations done to airootfs during building # remove/disable customizations done to airootfs during building
chrun "systemctl disable pacman-init.service choose-mirror.service" > /dev/null 2>&1 chrun "systemctl disable pacman-init.service choose-mirror.service" > /dev/null 2>&1
rm -f "$MNT/etc/systemd/scripts/choose-mirror" rm -f "$MNT/etc/systemd/scripts/choose-mirror"
rm -f "$MNT/etc/systemd/system/"{choose-mirror.service,etc-pacman.d-gnupg.mount,pacman-init.service} rm -f "$MNT/etc/systemd/system/"{choose-mirror.service,etc-pacman.d-gnupg.mount,pacman-init.service}
sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf" sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf"
sed -i 's/\(HandleLidSwitch=\)ignore/#\1suspend/' "$MNT/etc/systemd/logind.conf" sed -i 's/\(HandleLidSwitch=\)ignore/#\1suspend/' "$MNT/etc/systemd/logind.conf"
sed -i 's/\(HandleSuspendKey=\)ignore/#\1suspend/' "$MNT/etc/systemd/logind.conf" sed -i 's/\(HandleSuspendKey=\)ignore/#\1suspend/' "$MNT/etc/systemd/logind.conf"
sed -i 's/\(HandleHibernateKey=\)ignore/#\1hibernate/' "$MNT/etc/systemd/logind.conf" sed -i 's/\(HandleHibernateKey=\)ignore/#\1hibernate/' "$MNT/etc/systemd/logind.conf"
find "$MNT/boot" -name '*-ucode.img' -delete find "$MNT/boot" -name '*-ucode.img' -delete
fi
# changing distro name? # changing distro name?
[[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release} [[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release}
@ -1387,7 +1413,7 @@ install_cleanup()
[[ $INSTALL_WMS =~ (fluxbox|bspwm|openbox) ]] || rm -rf "$MNT/home/$user/.config/jgmenu" [[ $INSTALL_WMS =~ (fluxbox|bspwm|openbox) ]] || rm -rf "$MNT/home/$user/.config/jgmenu"
# remove geany configs if it wasn't installed # remove geany configs if it wasn't installed
[[ $USER_PKGS != *geany* ]] && rm -rf "$MNT/home/$user/.config/geany" [[ ${USER_PKGS[*]} != *geany* ]] && rm -rf "$MNT/home/$user/.config/geany"
# remove shell stuff for unused shells # remove shell stuff for unused shells
[[ $NEWSHELL != 'bash' ]] && rm -rf "$MNT/home/$user/.bash"* [[ $NEWSHELL != 'bash' ]] && rm -rf "$MNT/home/$user/.bash"*
@ -1402,7 +1428,7 @@ install_cleanup()
[[ $LOGIN_WM == 'dwm' ]] && sed -i '/super/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile" [[ $LOGIN_WM == 'dwm' ]] && sed -i '/super/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile"
# remove some commands from ~/.xprofile when using self contained sessions # remove some commands from ~/.xprofile when using self contained sessions
if [[ $LOGIN_WM =~ ($SELF_CONTAINED_SES) || ($LOGIN_TYPE != 'xinit' && $WM_PKGS =~ ($SELF_CONTAINED)) ]]; then if [[ $LOGIN_WM =~ ($SELF_CONTAINED_SES) || ($LOGIN_TYPE != 'xinit' && ${WM_PKGS[*]} =~ ($SELF_CONTAINED)) ]]; then
sed -i '/super/d; /nitrogen/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile" sed -i '/super/d; /nitrogen/d; /picom/d' "$MNT/home/$user/.xprofile" "$MNT/root/.xprofile"
fi fi
@ -1466,32 +1492,52 @@ install_bootldr()
install_packages() install_packages()
{ {
local rmpkg="" typeset -a inpkg rmpkg loginpkg
local inpkg="$PACKAGES $USER_PKGS $AL_BASE_PKGS "
for i in "${PACKAGES[@]}"; do
inpkg+=("$i")
done
for i in "${USER_PKGS[@]}"; do
inpkg+=("$i")
done
for i in "${AL_PKGS[@]}"; do
inpkg+=("$i")
done
for i in ${LOGIN_PKGS[$LOGIN_TYPE]}; do
loginpkg+=("$i")
done
if [[ $NEWSHELL == 'zsh' ]]; then if [[ $INSTALL_WMS =~ ($WM_PKG_SES) ]]; then
inpkg+="zsh-completions " for i in "${WM_PKGS[@]}"; do
elif [[ $PACSTRAP != 1 ]]; then inpkg+=("$i")
rmpkg+="archlabs-installer zsh " done
fi fi
[[ $INSTALL_WMS =~ ($WM_PKG_SES) ]] && inpkg+="$WM_BASE_PKGS " if [[ $NEWSHELL == 'zsh' ]]; then
inpkg+=("zsh-completions")
elif [[ $PACSTRAP != 1 ]]; then
rmpkg+=("archlabs-installer" "zsh")
fi
# update and install crucial packages first to avoid issues # update and install crucial packages first to avoid issues
chrun "pacman -Syyu --noconfirm" 2> "$ERR" 2>&1 chrun "pacman -Syyu --noconfirm" 2> "$ERR" 2>&1
chrun "pacman -S $BASE_PKGS $ISO_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $NEWSHELL --noconfirm --needed" 2> "$ERR" 2>&1 errshow 1 "chrun 'pacman -Syyu --noconfirm'"
errshow 1 "chrun 'pacman -S $BASE_PKGS $ISO_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $NEWSHELL --noconfirm --needed'" chrun "pacman -S ${BASE_PKGS[*]} ${loginpkg[*]} $NEWSHELL --noconfirm --needed" 2> "$ERR" 2>&1
errshow 1 "chrun 'pacman -S ${BASE_PKGS[*]} ${loginpkg[*]} $NEWSHELL --noconfirm --needed'"
if [[ $PACSTRAP == 1 ]]; then
chrun "pacman -S ${ISO_PKGS[*]} --noconfirm --needed" 2> "$ERR" 2>&1
errshow 1 "chrun 'pacman -S ${ISO_PKGS[*]} --noconfirm --needed'"
fi
# reinstalling iputils fixes the network issue for non-root users # reinstalling iputils fixes the network issue for non-root users
chrun "pacman -S iputils $UCODE $KERNEL --noconfirm" chrun "pacman -S iputils $UCODE $KERNEL --noconfirm"
# remove the packages we don't want on the installed system # remove the packages we don't want on the installed system
[[ $rmpkg ]] && chrun "pacman -Rnsc $rmpkg --noconfirm" [[ ${rmpkg[*]} ]] && chrun "pacman -Rnsc ${rmpkg[*]} --noconfirm"
# install the packages chosen throughout the install # install the packages chosen throughout the install
chrun "pacman -S $inpkg --needed --noconfirm" 2> "$ERR" 2>&1 chrun "pacman -S ${inpkg[*]} --needed --noconfirm" 2> "$ERR" 2>&1
errshow 1 "chrun 'pacman -S $inpkg --needed --noconfirm'" errshow 1 "chrun 'pacman -S ${inpkg[*]} --needed --noconfirm'"
# bootloader packages # bootloader packages
if [[ $BOOTLDR == 'grub' ]]; then if [[ $BOOTLDR == 'grub' ]]; then
@ -1679,8 +1725,9 @@ install_background()
PACSTRAP=1 PACSTRAP=1
( (
install_mirrorlist "/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 && install_mirrorlist "/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 &&
pacstrap /mnt $BASE_PKGS > /tmp/bgout 2>&1 && pacstrap /mnt ${BASE_PKGS[*]} > /tmp/bgout 2>&1 &&
cp /etc/pacman.d/mirrorlist "$MNT/etc/pacman.d/mirrorlist" cp /etc/pacman.d/mirrorlist "$MNT/etc/pacman.d/mirrorlist"
cp /etc/pacman.conf "$MNT/etc/pacman.conf"
al_repo "$MNT/etc/pacman.conf" al_repo "$MNT/etc/pacman.conf"
chrun "systemctl enable NetworkManager.service" > /tmp/bgout 2>&1 chrun "systemctl enable NetworkManager.service" > /tmp/bgout 2>&1
) & ) &
@ -1691,7 +1738,7 @@ install_background()
rsync -a /run/archiso/sfs/airootfs/ "$MNT/" && rsync -a /run/archiso/sfs/airootfs/ "$MNT/" &&
install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 && install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" > /tmp/bgout 2>&1 &&
al_repo "$MNT/etc/pacman.conf" && al_repo "$MNT/etc/pacman.conf" &&
chrun "pacman -Sy && pacman -Syyu $BASE_PKGS --noconfirm --needed" > /tmp/bgout 2>&1 chrun "pacman -Sy && pacman -Syyu ${BASE_PKGS[*]} --noconfirm --needed" > /tmp/bgout 2>&1
) & ) &
BG_PID=$! BG_PID=$!
fi fi
@ -2410,10 +2457,11 @@ live()
al_repo "/etc/pacman.conf" al_repo "/etc/pacman.conf"
pacman -Syyu --noconfirm || die 1 pacman -Syyu --noconfirm || die 1
rm -rf /var/cache/pacman/pkg/* rm -rf /var/cache/pacman/pkg/*
pacman -S ${BASE_PKGS/base-devel /} $AL_BASE_PKGS xorg-xinit --needed --noconfirm || die 1 local pkgs="${BASE_PKGS[*]}"
pacman -S ${pkgs/base-devel /} ${AL_PKGS[*]} xorg-xinit --needed --noconfirm || die 1
rm -rf /var/cache/pacman/pkg/* rm -rf /var/cache/pacman/pkg/*
case "$ses" in case "$ses" in
$WM_PKG_SES) pacman -S "$ses" $WM_BASE_PKGS ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;; $WM_PKG_SES) pacman -S "$ses" ${WM_PKGS[*]} ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;;
$SELF_CONTAINED) pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;; $SELF_CONTAINED) pacman -S "$ses" ${WM_EXT[$ses]} --needed --noconfirm || die 1 ;;
dwm) { pacman -S git --needed --noconfirm || die 1; }; install_suckless "/root" nochroot ;; dwm) { pacman -S git --needed --noconfirm || die 1; }; install_suckless "/root" nochroot ;;
esac esac