Fix: package install syntax error

This commit is contained in:
natemaia 2019-03-19 00:22:06 -07:00
parent 18a1170af7
commit 4f3f9b8f03

View File

@ -5,7 +5,7 @@
# Some ideas and code reworked from other resources # Some ideas and code reworked from other resources
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
VER="2.0.27" # version VER="2.0.28" # version
DIST="ArchLabs" # distributor DIST="ArchLabs" # distributor
MNT="/mnt" # mountpoint MNT="/mnt" # mountpoint
ANS="/tmp/ans" ANS="/tmp/ans"
@ -91,12 +91,11 @@ AUTO_BOOT_PART='' # boot value from auto partition
# iso base, pacstrap when running the installer from a stock arch iso # iso base, pacstrap when running the installer from a stock arch iso
ISO_BASE="arch-install-scripts b43-firmware b43-fwcutter broadcom-wl clonezilla dhclient dhcpcd ethtool " ISO_BASE="arch-install-scripts b43-firmware b43-fwcutter broadcom-wl clonezilla dhclient dhcpcd ethtool "
ISO_BASE+="exfat-utils f2fs-tools gptfdisk vim hdparm ipw2100-fw ipw2200-fw nfs-utils nilfs-utils ntfs-3g " ISO_BASE+="exfat-utils f2fs-tools gptfdisk vim hdparm ipw2100-fw ipw2200-fw nfs-utils nilfs-utils ntfs-3g "
ISO_BASE+="pacman-contrib parted rsync sdparm smartmontools wget wireless_tools wpa_actiond xl2tpd dialog " ISO_BASE+="pacman-contrib parted rsync sdparm smartmontools wget wireless_tools wpa_actiond xl2tpd dialog parted "
ISO_BASE+="parted alsa-firmware alsa-lib alsa-plugins pulseaudio pulseaudio-alsa networkmanager " ISO_BASE+="alsa-firmware alsa-lib alsa-plugins pulseaudio pulseaudio-alsa networkmanager w3m htop wireless-regdb "
ISO_BASE+="wireless-regdb wpa_supplicant lm_sensors lsb-release p7zip pamixer reflector unrar htop ranger " ISO_BASE+="wpa_supplicant lm_sensors lsb-release p7zip pamixer reflector unrar ranger terminus-font ttf-dejavu archlabs-keyring"
ISO_BASE+="w3m terminus-font ttf-dejavu archlabs-keyring"
# baseline # baseline (usually installed in the background)
BASE_PKGS="archlabs-skel-base archlabs-themes archlabs-dARK archlabs-icons archlabs-wallpapers " BASE_PKGS="archlabs-skel-base archlabs-themes archlabs-dARK archlabs-icons archlabs-wallpapers "
BASE_PKGS+="base-devel xorg xorg-drivers sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler " BASE_PKGS+="base-devel xorg xorg-drivers sudo git gvfs gtk3 gtk-engines gtk-engine-murrine pavucontrol tumbler "
BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot" BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-base gst-plugins-good scrot"
@ -363,7 +362,7 @@ select_show()
{ {
local mnt="none" local mnt="none"
local cmd="${BCMDS[$BOOTLDR]}" local cmd="${BCMDS[$BOOTLDR]}"
local pkgs="$USER_PKGS $PACKAGES" local pkgs="${USER_PKGS// / } ${PACKAGES// / }"
[[ $BOOT_PART ]] && mnt="/$BOOTDIR" [[ $BOOT_PART ]] && mnt="/$BOOTDIR"
[[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs" [[ $INSTALL_WMS == *dwm* ]] && pkgs="dwm st dmenu $pkgs"
msg "Show Configuration" " msg "Show Configuration" "
@ -486,8 +485,8 @@ select_config()
select_mkuser() select_mkuser()
{ {
local v='' u='' p='' p2='' rp='' rp2=''
NEWUSER='' NEWUSER=''
local v='' u='' p='' p2='' rp='' rp2=''
until [[ $NEWUSER ]]; do until [[ $NEWUSER ]]; do
i=0 i=0
@ -602,11 +601,9 @@ select_sessions()
select_login || return 1 select_login || return 1
# add unique wm packages to main package list while IFS=' ' read -r pkg; do
for i in $WM_PKGS; do [[ $PACKAGES != *"$pkg"* ]] && PACKAGES+=" $pkg"
[[ $PACKAGES == *$i* ]] || PACKAGES+=" ${i# }" done <<< "$WM_PKGS"
done
return 0 return 0
} }
@ -1240,21 +1237,13 @@ select_boot_partition()
select_root_partition() select_root_partition()
{ {
typeset -i num
local pts
pts="$(awk '/[0-9.]*[GT]$/ {sub(/[GT]$/, ""); if ($2 > 8) {print $0 "G"} }' <<< "$PARTS")"
while read -r line; do
(( num++ ))
done <<< "$pts"
if [[ $AUTO_ROOT_PART && ! $LVM && ! $LUKS ]]; then if [[ $AUTO_ROOT_PART && ! $LVM && ! $LUKS ]]; then
ROOT_PART="$AUTO_ROOT_PART" ROOT_PART="$AUTO_ROOT_PART"
elif (( num == 1 )); then elif (( COUNT == 1 )); then
ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$pts")" ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$PARTS")"
else else
dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $pts dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $PARTS
fi fi
[[ $ROOT_PART ]] || return 1 [[ $ROOT_PART ]] || return 1
select_filesystem "$ROOT_PART" || { ROOT_PART=''; return 1; } select_filesystem "$ROOT_PART" || { ROOT_PART=''; return 1; }
@ -1337,9 +1326,7 @@ install_base()
{ {
if [[ $RSYNC_PID || $MIRROR_PID ]]; then if [[ $RSYNC_PID || $MIRROR_PID ]]; then
while kill -0 "$RSYNC_PID" 2>/dev/null || kill -0 "$MIRROR_PID" 2>/dev/null; do while kill -0 "$RSYNC_PID" 2>/dev/null || kill -0 "$MIRROR_PID" 2>/dev/null; do
clear clear; printf "\nOne or more background install processes are still running...\n"; sleep 1
printf "\nBackground install process is currently running...\n"
sleep 1
done done
trap - EXIT trap - EXIT
unset RSYNC_PID MIRROR_PID unset RSYNC_PID MIRROR_PID
@ -1347,8 +1334,7 @@ install_base()
rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>$ERR rsync -ahv /run/archiso/sfs/airootfs/ $MNT/ 2>$ERR
errshow 1 "rsync -ahv /run/archiso/sfs/airootfs/ $MNT/" errshow 1 "rsync -ahv /run/archiso/sfs/airootfs/ $MNT/"
install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" install_mirrorlist "$MNT/etc/pacman.d/mirrorlist"
chrun "pacman -Syyu --noconfirm" chrun "pacman -Syyu --noconfirm && pacman -S $BASE_PKGS --needed --noconfirm"
chrun "pacman -S $BASE_PKGS --needed --noconfirm"
else else
mkdir -p /etc/pacman.d/mirrorlist mkdir -p /etc/pacman.d/mirrorlist
install_mirrorlist "/etc/pacman.d/mirrorlist" install_mirrorlist "/etc/pacman.d/mirrorlist"
@ -1356,14 +1342,12 @@ install_base()
errshow 1 "pacstrap $MNT base $KERNEL $ISO_BASE" errshow 1 "pacstrap $MNT base $KERNEL $ISO_BASE"
mkdir -p $MNT/etc/pacman.d/mirrorlist mkdir -p $MNT/etc/pacman.d/mirrorlist
cp -f "/etc/pacman.d/mirrorlist" "$MNT/etc/pacman.d/mirrorlist" cp -f "/etc/pacman.d/mirrorlist" "$MNT/etc/pacman.d/mirrorlist"
chrun "pacman -Syyu --noconfirm" chrun "pacman -Syyu --noconfirm && pacman -S $BASE_PKGS --needed --noconfirm"
chrun "pacman -S $BASE_PKGS --needed --noconfirm"
fi fi
rm -rf $MNT/etc/mkinitcpio-archiso.conf rm -rf $MNT/etc/mkinitcpio-archiso.conf
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -delete find $MNT/usr/lib/initcpio -name 'archiso*' -type f -delete
sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf sed -i 's/volatile/auto/g' $MNT/etc/systemd/journald.conf
find $MNT/boot -name '*-ucode.img' -delete find $MNT/boot -name '*-ucode.img' -delete
if [[ $VM ]]; then if [[ $VM ]]; then
@ -1565,10 +1549,8 @@ install_lightdm()
{ {
rm -rf $SERVICE rm -rf $SERVICE
rm -rf $MNT/home/$NEWUSER/.{xinitrc,profile,zprofile,bash_profile} rm -rf $MNT/home/$NEWUSER/.{xinitrc,profile,zprofile,bash_profile}
chrun 'systemctl set-default graphical.target' 2>$ERR chrun 'systemctl set-default graphical.target && systemctl enable lightdm.service' 2>$ERR
errshow 1 "systemctl set-default graphical.target" errshow 1 "systemctl set-default graphical.target && systemctl enable lightdm.service"
chrun 'systemctl enable lightdm.service' 2>$ERR
errshow 1 "systemctl enable lightdm.service"
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf << EOF
# LightDM GTK+ Configuration # LightDM GTK+ Configuration
@ -1594,37 +1576,35 @@ install_packages()
rm -f "$MNT/usr/bin/archlabs-installer" rm -f "$MNT/usr/bin/archlabs-installer"
fi fi
[[ $UCODE ]] && inpkg+="$UCODE" [[ $UCODE ]] && inpkg+=" $UCODE"
[[ $MYSHELL == *mksh ]] && inpkg+=" mksh" [[ $MYSHELL == *mksh ]] && inpkg+=" mksh"
[[ $KERNEL == 'linux' ]] || { inpkg+=" $KERNEL"; rmpkg+=" linux"; } [[ $KERNEL == 'linux' ]] || { inpkg+=" $KERNEL"; rmpkg+=" linux"; }
# add xterm when not installing a terminal emulator or de that provides one
[[ $inpkg =~ (term|urxvt|tilix|alacritty|sakura|tilda|plasma|cinnamon) || $INSTALL_WMS == *dwm* ]] || inpkg+=" xterm" [[ $inpkg =~ (term|urxvt|tilix|alacritty|sakura|tilda|plasma|cinnamon) || $INSTALL_WMS == *dwm* ]] || inpkg+=" xterm"
[[ $MYSHELL == '/usr/bin/zsh' ]] && inpkg+=" zsh-completions" [[ $MYSHELL == '/usr/bin/zsh' ]] && inpkg+=" zsh-completions"
[[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+=" archlabs-ksuperkey" [[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+=" archlabs-ksuperkey"
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm|fluxbox) ]] && inpkg+=" $WM_BASE_PKGS" [[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm|fluxbox) ]] && inpkg+=" $WM_BASE_PKGS"
chrun "pacman -Syyu --noconfirm" chrun "pacman -Syyu --noconfirm"
if [[ $rmpkg ]]; then [[ $rmpkg ]] && chrun "pacman -Rns $rmpkg --noconfirm"
chrun "pacman -Rns $rmpkg --noconfirm"
fi
chrun "pacman -S iputils --noconfirm" chrun "pacman -S iputils --noconfirm"
chrun "pacman -S $inpkg --needed --noconfirm" chrun "pacman -S $inpkg --needed --noconfirm" 2>$ERR
errshow 1 "pacman -S $inpkg --needed --noconfirm"
if [[ $BOOTLDR == 'grub' ]]; then if [[ $BOOTLDR == 'grub' ]]; then
if [[ $SYS == 'BIOS' ]]; then if [[ $SYS == 'BIOS' ]]; then
chrun "pacman -S grub os-prober --needed --noconfirm" chrun "pacman -S grub os-prober --needed --noconfirm" 2>$ERR
errshow 1 "pacman -S grub os-prober --needed --noconfirm"
else else
chrun "pacman -S grub os-prober efibootmgr --needed --noconfirm" chrun "pacman -S grub os-prober efibootmgr --needed --noconfirm" 2>$ERR
errshow 1 "pacman -S grub os-prober efibootmgr --needed --noconfirm"
fi fi
elif [[ $BOOTLDR == 'refind-efi' ]]; then elif [[ $BOOTLDR == 'refind-efi' ]]; then
chrun "pacman -S refind-efi efibootmgr --needed --noconfirm" chrun "pacman -S refind-efi efibootmgr --needed --noconfirm" 2>$ERR
errshow 1 "pacman -S refind-efi efibootmgr --needed --noconfirm"
elif [[ $SYS == 'UEFI' ]]; then elif [[ $SYS == 'UEFI' ]]; then
chrun "pacman -S efibootmgr --needed --noconfirm" chrun "pacman -S efibootmgr --needed --noconfirm" 2>$ERR
errshow 1 "pacman -S efibootmgr --needed --noconfirm"
fi fi
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers
return 0 return 0
} }
@ -1683,10 +1663,10 @@ install_mirrorlist()
install_background() install_background()
{ {
if [[ -d /run/archiso/sfs/airootfs/etc/skel ]] && grep -qw "$MNT" /proc/mounts && (grep -qw "$MNT/$BOOTDIR" /proc/mounts || [[ $SYS == 'BIOS' && -z $LUKS ]]); then if [[ -d /run/archiso/sfs/airootfs/etc/skel ]] && grep -qw "$MNT" /proc/mounts && (grep -qw "$MNT/$BOOTDIR" /proc/mounts || [[ $SYS == 'BIOS' && -z $LUKS ]]); then
yesno "Background Install" "\nSome slower steps of the install can be done in the background before other configuration is needed, base system unpack, mirrorlist sort, updates, and base packages.\n\nThis will allow you to continue setting up the configuration and proceed at your own pace, while the installer is working.\n\nDo you want to use/start the background process?\n" || return 0 yesno "Background Install" "\nSome parts of the install can be done in the background now, base unpack, mirrorlist sort, system update, and base packages.\n\nDo you want to start the background process?\n" || return 0
rsync -a /run/archiso/sfs/airootfs/ $MNT/ & rsync -a /run/archiso/sfs/airootfs/ $MNT/ &
RSYNC_PID=$! RSYNC_PID=$!
( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && chrun "pacman -Syyu --noconfirm && pacman -S $BASE_PKGS --needed --noconfirm" ) >/dev/null 2>&1 & ( install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" && chrun "pacman -Syyu $BASE_PKGS --needed --noconfirm" ) >/dev/null 2>&1 &
MIRROR_PID=$! MIRROR_PID=$!
trap "kill $RSYNC_PID 2>/dev/null; kill $MIRROR_PID 2>/dev/null" EXIT trap "kill $RSYNC_PID 2>/dev/null; kill $MIRROR_PID 2>/dev/null" EXIT
fi fi
@ -1756,7 +1736,6 @@ prerun_efistub()
BCMDS[systemd-boot]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars >/dev/null 2>&1 BCMDS[systemd-boot]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars >/dev/null 2>&1
efibootmgr -v -d $BOOT_DEV -p $BOOT_PART_NUM -c -L '${DIST} Linux' -l /vmlinuz-${KERNEL} \ efibootmgr -v -d $BOOT_DEV -p $BOOT_PART_NUM -c -L '${DIST} Linux' -l /vmlinuz-${KERNEL} \
-u 'root=$ROOT_PART_ID rw $([[ $UCODE ]] && printf 'initrd=\%s.img ' "$UCODE")initrd=\initramfs-${KERNEL}.img'" -u 'root=$ROOT_PART_ID rw $([[ $UCODE ]] && printf 'initrd=\%s.img ' "$UCODE")initrd=\initramfs-${KERNEL}.img'"
return 0 return 0
} }
@ -2292,6 +2271,7 @@ die()
{ {
local exitcode="$1" local exitcode="$1"
trap - INT trap - INT
trap - TSTP
tput cnorm tput cnorm
if [[ -d $MNT ]] && command cd /; then if [[ -d $MNT ]] && command cd /; then
umount_dir $MNT umount_dir $MNT
@ -2390,6 +2370,19 @@ sigint()
die 1 die 1
} }
sigtstp()
{
printf "\n^Z caught, cleaning up before backgrounding...\n"
tput cnorm
if [[ $TERM == 'linux' ]]; then
colors=("\e]P0191919" "\e]P1D15355" "\e]P2609960" "\e]P3FFCC66"
"\e]P4255A9B" "\e]P5AF86C8" "\e]P62EC8D3" "\e]P7949494" "\e]P8191919" "\e]P9D15355"
"\e]PA609960" "\e]PBFF9157" "\e]PC4E88CF" "\e]PDAF86C8" "\e]PE2ec8d3" "\e]PFE1E1E1")
printf "%b" "${colors[@]}" && clear && unset col
fi
kill -s TSTP $$ # pass through the signal
}
print4() print4()
{ {
local str="$*" local str="$*"
@ -2565,7 +2558,8 @@ elif [[ $1 =~ (-d|--debug) ]]; then
debug debug
fi fi
trap sigint INT trap sigint INT # ^C trap cleanup
trap sigtstp TSTP # ^Z trap cleanup
system_identify system_identify
system_devices system_devices