From 079e36c4c0160728b9b200feb0f0c7f8d7a40744 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sun, 22 Dec 2019 17:41:42 -0800 Subject: [PATCH] Fix: function name collision --- archlabs-installer | 107 +++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 77 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 9044848..56a5613 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -8,7 +8,7 @@ # check for syntax errors # set -n -VER=2.1.8 +VER=2.1.10 # default values { @@ -207,7 +207,7 @@ main() 3) luks_menu || (( SEL-- )) ;; 4) lvm_menu || (( SEL-- )) ;; 5) mount_menu || (( SEL-- )) ;; - 6) prechecks 0 && { select_boot || (( SEL-- )); } ;; + 6) prechecks 0 && { select_bootldr || (( SEL-- )); } ;; 7) prechecks 1 && { select_mkuser || (( SEL-- )); } ;; 8) prechecks 2 && { select_config || (( SEL-- )); } ;; 9) prechecks 3 && { select_sessions || (( SEL-- )); } ;; @@ -219,23 +219,6 @@ main() esac } -select_boot() -{ - if [[ $SYS == 'BIOS' ]]; then - dlg BOOTLDR menu "BIOS Bootloader" "\nSelect which bootloader to use." \ - "grub" "The Grand Unified Bootloader, standard among many Linux distributions" \ - "syslinux" "A collection of boot loaders for booting drives, CDs, or over the network" || return 1 - else - dlg BOOTLDR menu "UEFI Bootloader" "\nSelect which bootloader to use." \ - "systemd-boot" "A simple UEFI boot manager which executes configured EFI images" \ - "grub" "The Grand Unified Bootloader, standard among many Linux distributions" \ - "refind-efi" "A UEFI boot manager that aims to be platform neutral and simplify multi-boot" \ - "efistub" "Boot the kernel image directly (no chainloading support)" \ - "syslinux" "A collection of boot loaders for booting drives, CDs, or over the network (no chainloading support)" || return 1 - fi - setup_${BOOTLDR} -} - select_show() { local pkgs="${USER_PKGS// / } ${PACKAGES// / }" @@ -434,6 +417,23 @@ select_usercmd() dlg USER_CMD input "Command" "$_usercmd" "$USER_CMD" nolimit } +select_bootldr() +{ + if [[ $SYS == 'BIOS' ]]; then + dlg BOOTLDR menu "BIOS Bootloader" "\nSelect which bootloader to use." \ + "grub" "The Grand Unified Bootloader, standard among many Linux distributions" \ + "syslinux" "A collection of boot loaders for booting drives, CDs, or over the network" || return 1 + else + dlg BOOTLDR menu "UEFI Bootloader" "\nSelect which bootloader to use." \ + "systemd-boot" "A simple UEFI boot manager which executes configured EFI images" \ + "grub" "The Grand Unified Bootloader, standard among many Linux distributions" \ + "refind-efi" "A UEFI boot manager that aims to be platform neutral and simplify multi-boot" \ + "efistub" "Boot the kernel image directly (no chainloading support)" \ + "syslinux" "A collection of boot loaders for booting drives, CDs, or over the network (no chainloading support)" || return 1 + fi + setup_${BOOTLDR} +} + select_sessions() { LOGIN_CHOICES='' @@ -1175,7 +1175,7 @@ install_main() install_packages install_tearfree "$MNT/etc/X11/xorg.conf.d" install_mkinitcpio - install_boot + install_bootldr chrun "hwclock --systohc --utc" || chrun "hwclock --systohc --utc --directisa" install_user install_login @@ -1292,51 +1292,6 @@ install_base() EOF } -install_boot() -{ - echo "Installing $BOOTLDR" - - if [[ $ROOT == /dev/mapper* ]]; then - ROOT_ID="$ROOT" - else - local uuid_type="UUID" - [[ $BOOTLDR =~ (systemd-boot|refind-efi|efistub) ]] && uuid_type="PARTUUID" - ROOT_ID="$uuid_type=$(blkid -s $uuid_type -o value $ROOT)" - fi - - if [[ $SYS == 'UEFI' ]]; then - # remove our old install and generic BOOT/ dir - echo "Removing conflicting boot directories" - find "$MNT/boot/EFI/" -maxdepth 1 -mindepth 1 -iname "$DIST" -type d -delete -printf "remove %p\n" - find "$MNT/boot/EFI/" -maxdepth 1 -mindepth 1 -iname 'BOOT' -type d -delete -printf "remove %p\n" - fi - - prerun_$BOOTLDR - chrun "${BCMDS[$BOOTLDR]}" 2> "$ERR" 2>&1 - errshow 1 "chrun '${BCMDS[$BOOTLDR]}'" - - if [[ -d $MNT/hostrun ]]; then - echo "Unmounting chroot directories" - # cleanup the bind mounts we made earlier for the grub-probe module - umount_dir "$MNT/hostrun/"{udev,lvm} - rm -rf "$MNT/hostrun" > /dev/null 2>&1 - fi - - if [[ $SYS == 'UEFI' ]]; then - # some UEFI firmware requires a generic esp/BOOT/BOOTX64.EFI - mkdir -pv "$MNT/boot/EFI/BOOT" - case "$BOOTLDR" in - grub) cp -fv "$MNT/boot/EFI/$DIST/grubx64.efi" "$MNT/boot/EFI/BOOT/BOOTX64.EFI" ;; - syslinux) cp -rf "$MNT/boot/EFI/syslinux/"* "$MNT/boot/EFI/BOOT/" && cp -f "$MNT/boot/EFI/syslinux/syslinux.efi" "$MNT/boot/EFI/BOOT/BOOTX64.EFI" ;; - refind-efi) - sed -i '/#extra_kernel_version_strings/ c extra_kernel_version_strings linux-hardened,linux-zen,linux-lts,linux' "$MNT/boot/EFI/refind/refind.conf" - cp -fv "$MNT/boot/EFI/refind/refind_x64.efi" "$MNT/boot/EFI/BOOT/BOOTX64.EFI" ;; - esac - fi - - return 0 -} - install_user() { local groups='audio,video,floppy,log,network,rfkill,scanner,storage,optical,power,wheel' @@ -1384,7 +1339,7 @@ install_login() errshow 1 "chrun 'systemctl enable $LOGIN_TYPE.service'" fi - ${LOGIN_TYPE}_config + config_${LOGIN_TYPE} } install_cleanup() @@ -1642,22 +1597,22 @@ install_background() # these are called based on which DM is chosen after it is installed # additional config can be handled here, for now only lightdm and xinit. -ly_config() +config_ly() { : #TODO } -gdm_config() +config_gdm() { : #TODO } -sddm_config() +config_sddm() { : #TODO } -xinit_config() +config_xinit() { if [[ $INSTALL_WMS ]]; then sed -i "/exec/ c exec ${LOGIN_WM}" "$MNT/home/$NEWUSER/.xinitrc" @@ -1689,7 +1644,7 @@ xinit_config() EOF } -lightdm_config() +config_lightdm() { sed -i "/greeter-session=/ c greeter-session=lightdm-$LIGHTDM_GREETER" "$MNT/etc/lightdm/lightdm.conf" @@ -2008,11 +1963,8 @@ lvm_lv_size() esac fi fi - if (( ERR_SIZE )); then - msg "Invalid Logical Volume Size" "$_lvmerrlvsize" - else - break - fi + (( ERR_SIZE )) || break + msg "Invalid Logical Volume Size" "$_lvmerrlvsize" done return $ERR_SIZE @@ -2082,7 +2034,8 @@ lvm_delgroup() lvm_extra_lvs() { while (( VOL_COUNT > 1 )); do - lvm_volume_name "$_lvmlvname" && lvm_lv_size || return 1 + lvm_volume_name "$_lvmlvname" || return 1 + lvm_lv_size || return 1 msg "$_lvmnew (LV:$VOL_COUNT)" "\nCreating a $VOLUME_SIZE volume $VNAME in $VGROUP\n" 0 lvcreate -L "$VOLUME_SIZE" "$VGROUP" -n "$VNAME" > /dev/null 2> "$ERR" errshow 0 "lvcreate -L '$VOLUME_SIZE' '$VGROUP' -n '$VNAME'" || return 1