From e211c5c4c28341ba6aa1459eab0871429751c200 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sun, 22 Dec 2019 21:52:07 -0800 Subject: [PATCH] Fix: missing function for bootloader install, more cleanup --- archlabs-installer | 232 +++++++++++++++++++++------------------------ 1 file changed, 109 insertions(+), 123 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 56a5613..9ff8d85 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -8,7 +8,7 @@ # check for syntax errors # set -n -VER=2.1.10 +VER=2.1.11 # default values { @@ -119,12 +119,12 @@ declare -A PKG_EXT=( # Basics (somewhat in order) _welcome="\nThis will help you get $DIST installed and setup on your system.\n\nIf you are unsure about a section the default option will be listed or\nthe first selected item will be the default.\n\n\nMenu Navigation:\n\n - Select items with the arrow keys or the option number.\n - Use [Space] to toggle check boxes and [Enter] to accept.\n - Switch between fields using [Tab] or the arrow keys.\n - Use [Page Up] and [Page Down] to jump whole pages\n - Press the highlighted key of an option to select it.\n" _keymap="\nPick which keymap to use for the system from the list below\n\nThis is used once a graphical environment is running (Xorg).\n\nSystem default: us" -_vconsole="\nSelect the console keymap, the console is the tty shell you reach before starting a graphical environment (Xorg).\n\nIts keymap is seperate from the one used by the graphical environments, though many do use the same such as 'us' English.\n\nSystem default: us" +_vconsole="\nSelect the console keymap, the console is the tty shell you reach before starting a graphical environment (Xorg).\n\nIts keymap is separate from the one used by the graphical environments, though many do use the same such as 'us' English.\n\nSystem default: us" _prep="\nThis is the installer main menu, once a step is complete you will return here.\n\nOn successful completion of a step the cursor will be advanced to the next step\nOn failure the cursor will be placed on the step required to advance (when possible).\n\nSteps beginning with an asterix (*) are required.\n\nOnce you're happy with the choices and the required steps are complete, selecting the final step will begin the install." _device="\nSelect a device to use from the list below.\n\nDevices (/dev) are the available drives on the system. /sda, /sdb, /sdc ..." _resize="\nSelect a new filesystem size in MB, a new partition will be created from the free space but will be left unformatted.\nThe lowest size is just enough to fit the currently in use space on the partition while the default is set to split the free space evenly.\n\nUse Tab or the arrow keys move the cursor between the buttons and the value, when the cursor is on the value, you can edit it by:\n\n - left/right cursor movement to select a digit to modify\n - +/- characters to increment/decrement the digit by one\n - 0 through 9 to set the digit to the given value\n\nSome keys are also recognized in all cursor positions:\n\n - Home/End set the value to its maximum or minimum\n - Pageup/Pagedown increment the value so that the slider moves by one column." _mount="\nUse [Space] to toggle mount options from below, press [Enter] when done to confirm selection.\n\nNot selecting any and confirming will run an automatic mount." -_warn="\nIMPORTANT:\n\nChoose carefully when editing, formatting, and mounting partitions or your DATA MAY BE LOST.\n\nTo mount a partition without formatting it, select 'skip' when prompted to choose a filesystem during the mounting stage.\nThis can only be used for partitions that already contain a filesystem and cannot be the root (/) partition, it needs to be formatted before install.\n" +_warn="\nIMPORTANT: Choose carefully when editing, formatting, and mounting partitions or your DATA MAY BE LOST.\n\nTo mount a partition without formatting it, select 'skip' when prompted to choose a filesystem during the mounting stage.\nThis can only be used for partitions that already contain a filesystem and cannot be the root (/) partition, it needs to be formatted before install.\n" _part="\nFull device auto partitioning is available for beginners otherwise cfdisk is recommended.\n\n - All systems will require a root partition (8G or greater).\n - UEFI or BIOS using LUKS without LVM require a separate boot partition (100-512M)." _uefi="\nSelect the EFI boot partition (/boot), required for UEFI boot.\n\nIt's usually the first partition on the device, 100-512M, and will be formatted as vfat/fat32 if not already." _bios="\nDo you want to use a separate boot partition? (optional)\n\nIt's usually the first partition on the device, 100-512M, and will be formatted as ext3/4 if not already." @@ -134,14 +134,14 @@ _swapsize="\nEnter the size of the swapfile in megabytes (M) or gigabytes (G).\n _expart="\nYou can now choose any additional partitions you want mounted, you'll be asked for a mountpoint after.\n\nSelect 'done' to finish the mounting step and begin unpacking the base system in the background." _exmnt="\nWhere do you want the partition mounted?\n\nEnsure the name begins with a slash (/).\nExamples include: /usr, /home, /var, etc." _user="\nEnter a name and password for the new user account.\n\nThe name must not use capital letters, contain any periods (.), end with a hyphen (-), or include any colons (:)\n\nNOTE: Use [Up], [Down], or [Tab] to switch between fields, and [Enter] to accept." -_hostname="\nEnter a hostname for the new system.\n\nA hostname is used to identify systems on the network.\n\nIt's restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beggining or end." -_locale="\nLocale determines the system language and currency formats.\n\nThe format for locale names is languagecode_COUNTRYCODE\n\neg. en_US is: english United States\n en_GB is: english Great Britain" -_timez="\nThe time zone is used to set the system clock.\n\nSelect your country or continent from the list below" -_timesubz="\nSelect the nearest city to you or one with the same time zone.\n\nTIP: Pressing the first letter of the city name repeatedly will navigate between entries beggining with that letter." +_hostname="\nEnter a hostname for the new system.\n\nA hostname is used to identify systems on the network.\n\nIt's restricted to alphanumeric characters (a-z, A-Z, 0-9).\nIt can contain hyphens (-) BUT NOT at the beginning or end." +_locale="\nLocale determines the system language and currency formats.\n\nThe format for locale names is languagecode_COUNTRYCODE\n\neg. en_US is: English United States\n en_GB is: English Great Britain" +_timez="\nSelect your timezone country or continent from the list below" +_timesubz="\nSelect your time zone city.\n\nTIP: Pressing a letter key repeatedly navigates between entries beginning with that letter." _sessions="\nUse [Space] to toggle available sessions, use [Enter] to accept the selection and continue.\n\nA basic package set will be installed for compatibility and functionality." _login="\nSelect which of your session choices to use for the initial login.\n\nYou can be change this later by editing your ~/.xinitrc" _autologin="\nDo you want autologin enabled for USER?\n\nIf so the following two files will be created (disable autologin by removing them):\n\n - /home/USER/RC (run startx when logging in on tty1)\n - /etc/systemd/system/getty@tty1.service.d/autologin.conf (login USER without password)\n" -_packages="\nUse [Space] to move a package into the selected area and press [Enter] to accept the selection.\n\nPackages may be installed by your DE/WM (if any), or for the packages you select." +_packages="\nUse [Space] to toggle packages then press [Enter] to accept.\n\nPackages may be installed by your DE/WM (if any), or for the packages you select." _usercmd="\nEnter command to be run in the newly installed system (chroot) below.\n\nAn example use case would be installing packages or editing files not offered in the menus.\n\nBecause the command will be run in a chroot not every command will function correctly, additionally the command will not be sanity checked, it's your system so exercise caution.\n\nMore than one command may be run using standard bash syntax.\n" _edit="\nBefore exiting you can select configuration files to review/change.\n\nIf you need to make other changes with the drives still mounted, use Ctrl-z to pause the installer, when finished type 'fg' and [Enter] to resume the installer, if you want to avoid the automatic reboot using Ctrl-c will cleanly exit." @@ -149,8 +149,8 @@ _edit="\nBefore exiting you can select configuration files to review/change.\n\n _luksnew="Basic LUKS Encryption" _luksadv="Advanced LUKS Encryption" _luksopen="Open Existing LUKS Partition" -_luksmenu="\nA seperate boot partition without encryption or logical volume management (LVM) is required (except BIOS systems using grub).\n\nBasic uses the default encryption settings, and is recommended for beginners. Advanced allows cypher and key size parameters to be entered manually." -_luksomenu="\nEnter a name and password for the encrypted device.\n\nIt is not necessary to prefix the name with /dev/mapper/,an example has been provided." +_luksmenu="\nA separate boot partition without encryption or logical volume management (LVM) is required (except BIOS systems using grub).\n\nBasic uses the default encryption settings, and is recommended for beginners. Advanced allows cypher and key size parameters to be entered manually." +_luksomenu="\nEnter a name and password for the encrypted device.\n\nIt is not necessary to prefix the name with /dev/mapper/, an example has been provided." _lukskey="Once the specified flags have been amended, they will automatically be used with the 'cryptsetup -q luksFormat /dev/...' command.\n\nNOTE: Do not specify any additional flags such as -v (--verbose) or -y (--verify-passphrase)." # LVM @@ -164,8 +164,8 @@ _lvmlvsize="\nEnter what size you want the logical volume (LV) to be in megabyte _lvmdelask="\nConfirm deletion of volume group(s) and logical volume(s).\n\nDeleting a volume group, will delete all logical volumes within it.\n" # Errors -_errexpart="\nCannot mount partition due to a problem with the mountpoint.\n\nEnsure it begins with a slash (/) followed by atleast one character.\n" -_errpart="\nYou need create the partiton(s) first.\n\n\nBIOS systems require at least one partition (ROOT).\n\nUEFI systems require at least two (ROOT and EFI).\n" +_errexpart="\nCannot mount partition due to a problem with the mountpoint.\n\nEnsure it begins with a slash (/) followed by at least one character.\n" +_errpart="\nYou need create the partition(s) first.\n\n\nBIOS systems require at least one partition (ROOT).\n\nUEFI systems require at least two (ROOT and EFI).\n" _lukserr="\nA minimum of two partitions are required for encryption:\n\n 1. root (/) - standard or LVM.\n 2. boot (/boot) - standard (unless using LVM on BIOS systems).\n" _lvmerr="\nThere are no viable partitions available to use for LVM, a minimum of one is required.\n\nIf LVM is already in use, deactivating it will allow the partition(s) to be used again.\n" _lvmerrvgname="\nInvalid name entered.\n\nThe volume group name may be alpha-numeric, but may not contain spaces, start with a '/', or already be in use.\n" @@ -458,6 +458,11 @@ select_sessions() for i in $INSTALL_WMS; do LOGIN_CHOICES+="$i - " + if [[ $i =~ (plasma|deepin) ]]; then + local txt="These are larger package groups containing applications that are a part of $i, but are not included in the $i package group." + 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 + fi [[ ${WM_EXT[$i]} && $WM_PKGS != *"${WM_EXT[$i]}"* ]] && WM_PKGS+=" ${WM_EXT[$i]}" done @@ -591,16 +596,20 @@ part_menu() "parted" "GNU partition editor" $([[ $DISPLAY ]] && hash gparted >/dev/null 2>&1 && printf "gparted 'A gui front end to parted'") \ "fdisk" "Dialog-driven creation and manipulation of partitions" \ "done" "Return to the main menu" - # "shrink" "Shrink an existing ext or ntfs partition" \ if [[ -z $choice || $choice == 'done' ]]; then return 0 - elif [[ $choice == 'shrink' ]]; then - part_shrink "$device" elif [[ $choice == 'auto' ]]; then local root_size txt label boot_fs boot_type - root_size=$(lsblk -lno SIZE "$device" | awk 'NR == 1 {if ($1 ~ "G") {sub(/G/, ""); print ($1 * 1000 - 512) / 1000 "G"} else {sub(/M/, ""); print ($1 - 512) "M"}}') - txt="\nWARNING:\n\nALL data on $device will be destroyed and the following partitions will be created\n\n- " + root_size=$(lsblk -lno SIZE "$device" | awk 'NR == 1 { + if ($1 ~ "G") { + sub(/G/, "") + print ($1 * 1000 - 512) / 1000 "G" + } else { + sub(/M/, "") + print ($1 - 512) "M" + }}') + txt="\nWARNING: ALL data on $device will be destroyed and the following partitions will be created\n\n- " if [[ $SYS == 'BIOS' ]]; then label="msdos" boot_fs="ext4" boot_type="primary" txt+="An $boot_fs boot partition with the boot flag enabled (512M)\n- " @@ -678,70 +687,6 @@ part_auto() msg "Auto Partition" "\nProcess complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE "$device")\n" } -part_shrink() -{ - part="" - typeset -i size num - local device="$1" fs="" - - part_find "${device##*/}[^ ]" || return 1 - (( COUNT == 1 )) && part="$(awk '{print $1}' <<< "${PARTS[@]}" )" - - if (( COUNT == 1 )) || dlg part menu "Resize" "\nWhich partition on $device do you want to resize?" $PARTS; then - fs=$(lsblk -lno FSTYPE "$part") - case "$fs" in - ext*|ntfs) - msg "Resize" "\nGathering device size info.\n" 0 - num="${part: -1}" - end=$(parted -s "$device" unit KiB print | awk '/^\s*'"$num"'/ {print $3}') # part size in KiB - devsize=$(parted -s "$device" unit KiB print | awk '/Disk '"${device//\//\\/}"':/ {print $3}') # whole device size in KiB - mount "$part" "$MNT" > /dev/null 2>&1; sleep 0.5 - min=$(df --output=used --block-size=MiB "$part" | awk 'NR == 2 {print int($1) + 256}') - max=$(df --output=avail --block-size=MiB "$part" | awk 'NR == 2 {print int($1)}') - umount_dir "$MNT" - tput cnorm - if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$min" "$max" $((max / 2)) 2> $ANS; then - size=$(< "$ANS") - size=$((size * 1024)) - else - return 1 - fi - clear - case "$fs" in - ntfs) - if ntfsresize -fc "$part"; then - ntfsresize -ff --size $(( (size * 1024) / 1000 ))k "$part" 2> "$ERR" # k=10^3 bytes - errshow 0 "ntfsresize -f -s $(( (size * 1024) / 1000 ))k $part" || return 1 - else - msg "Resize" "\nThe ntfs partition $part cannot be resized because it is scheduled for a consistency check.\n\nTo do a consistency check in windows open command prompt as admin and run:\n\n\tchkdsk /f /r /x\n" - return 1 - fi - ;; - *) - e2fsck -f "$part"; sleep 0.5 - resize2fs -f "$part" ${size}K 2> "$ERR" # K=2^10 bytes - errshow 0 "resize2fs -f '$part' ${size}K" || return 1 - ;; - esac - sleep 0.5 - parted "$device" resizepart "$num" ${size}KiB || return 1 - (( size++ )) - sleep 0.5 - if [[ $devsize == "$end" ]]; then - parted -s "$device" mkpart primary ext4 ${size}KiB 100% 2> "$ERR" - errshow 0 "parted -s '$device' mkpart primary ext4 ${size}KiB 100%" || return 1 - else - parted -s "$device" mkpart primary ext4 ${size}KiB ${end}KiB 2> "$ERR" - errshow 0 "parted -s '$device' mkpart primary ext4 ${size}KiB ${end}KiB" || return 1 - fi - msg "Resize Complete" "\n$part has been successfully resized to $((size / 1024))M.\n" 1 - ;; - "") msg "No Filesystem" "\nFor unformatted partitions, cfdisk can be used in the partition menu.\n" ;; - *) msg "Invalid Filesystem: $fs" "\nResizing only supports ext and ntfs.\n" ;; - esac - fi -} - ############################################################################### # partition management functions # these are helpers for use by other functions to do essential setup/teardown @@ -995,7 +940,7 @@ select_boot() fi if ([[ $SYS == 'BIOS' ]] && grep -q 'ext[34]' <<< "$(fsck -N "$BOOT")") || ([[ $SYS == 'UEFI' ]] && grep -q 'fat' <<< "$(fsck -N "$BOOT")"); then - yesno "Format Boot Partition" "\nIMPORTANT:\n\nThe boot partition $BOOT $_format" "Format $BOOT" "Skip Formatting" 1 || return 0 + yesno "Format Boot Partition" "\nIMPORTANT: The boot partition $BOOT $_format" "Format $BOOT" "Skip Formatting" 1 || return 0 fi case "$SYS" in @@ -1371,6 +1316,51 @@ install_cleanup() } +install_bootldr() +{ + 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_packages() { local rmpkg="" @@ -1673,19 +1663,15 @@ setup_grub() if [[ $SYS == 'BIOS' ]]; then [[ $BOOT_D ]] || { part_device 1 || return 1; } - BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_D" + BCMDS[grub]="grub-install --verbose --recheck --force --target=i386-pc $BOOT_D" else BCMDS[grub]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1 - grub-install --recheck --force --target=x86_64-efi --efi-directory=/boot --bootloader-id=$DIST" + grub-install --verbose --recheck --force --target=x86_64-efi --efi-directory=/boot --bootloader-id='$DIST'" grep -q /sys/firmware/efi/efivars /proc/mounts || mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1 fi - BCMDS[grub]="mkdir -p /run/udev /run/lvm && - mount --bind /hostrun/udev /run/udev && - mount --bind /hostrun/lvm /run/lvm && - ${BCMDS[grub]} && - grub-mkconfig -o /boot/grub/grub.cfg && - sleep 1 && umount /run/udev /run/lvm" + BCMDS[grub]="mkdir -p /run/udev /run/lvm && mount --bind /hostrun/udev /run/udev && mount --bind /hostrun/lvm /run/lvm && + ${BCMDS[grub]} && grub-mkconfig -o /boot/grub/grub.cfg && sleep 1 && umount /run/udev /run/lvm" return 0 } @@ -1693,17 +1679,12 @@ setup_grub() prerun_grub() { sed -i "s/GRUB_DISTRIBUTOR=.*/GRUB_DISTRIBUTOR=\"${DIST}\"/g; s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/g" "$MNT/etc/default/grub" - if [[ $LUKS_DEV ]]; then - sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" "$MNT/etc/default/grub" 2> "$ERR" 2>&1 - errshow 1 "sed -i 's~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g' '$MNT/etc/default/grub'" + sed -i "s~#GRUB_ENABLE_CRYPTODISK~GRUB_ENABLE_CRYPTODISK~g; s~GRUB_CMDLINE_LINUX=.*~GRUB_CMDLINE_LINUX=\"${LUKS_DEV}\"~g" "$MNT/etc/default/grub" fi - if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then - sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" "$MNT/etc/default/grub" 2> "$ERR" 2>&1 - errshow 1 "sed -i 's/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g' '$MNT/etc/default/grub'" + sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" "$MNT/etc/default/grub" fi - # setup for os-prober module mkdir -p /run/{lvm,udev} "$MNT/hostrun/"{lvm,udev} mount --bind /run/lvm "$MNT/hostrun/lvm" @@ -1737,17 +1718,16 @@ setup_syslinux() prerun_syslinux() { - local c="$MNT/boot/syslinux" - local s="/usr/lib/syslinux/bios" - local d=".." + local c="$MNT/boot/syslinux" s="/usr/lib/syslinux/bios" d=".." + if [[ $SYS == 'UEFI' ]]; then - c="$MNT/boot/EFI/syslinux" - s="/usr/lib/syslinux/efi64" - d=''; + c="$MNT/boot/EFI/syslinux" s="/usr/lib/syslinux/efi64" d=''; fi - mkdir -pv "$c" 2> "$ERR" 2>&1 - cp -rfv "$s/"* "$c/" 2> "$ERR" 2>&1 - cp -fv "$RUN/syslinux/splash.png" "$c/" 2> "$ERR" 2>&1 + + mkdir -pv "$c" + cp -rfv "$s/"* "$c/" + cp -fv "$RUN/syslinux/splash.png" "$c/" + cat > "$c/syslinux.cfg" <<- EOF UI vesamenu.c32 MENU TITLE $DIST Boot Menu @@ -1806,7 +1786,9 @@ prerun_refind-efi() printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] && printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL-fallback.img" EOF + mkdir -p "$MNT/etc/pacman.d/hooks" + cat > "$MNT/etc/pacman.d/hooks/refind.hook" <<- EOF [Trigger] Operation = Upgrade @@ -1823,30 +1805,35 @@ prerun_refind-efi() setup_systemd-boot() { EDIT_FILES[bootloader]="/boot/loader/entries/$DIST.conf" - BCMDS[systemd-boot]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1; bootctl --path=/boot install" + BCMDS[systemd-boot]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1; systemd-machine-id-setup && bootctl --path=/boot install" } prerun_systemd-boot() { - mkdir -p "$MNT/boot/loader/entries" + mkdir -pv "$MNT/boot/loader/entries" + cat > "$MNT/boot/loader/loader.conf" <<- EOF default $DIST timeout 5 editor no EOF + cat > "$MNT/boot/loader/entries/$DIST.conf" <<- EOF title $DIST Linux linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img") initrd /initramfs-$KERNEL.img options root=$ROOT_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw EOF + cat > "$MNT/boot/loader/entries/$DIST-fallback.conf" <<- EOF title $DIST Linux Fallback linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img") initrd /initramfs-$KERNEL-fallback.img options root=$ROOT_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw EOF - mkdir -p "$MNT/etc/pacman.d/hooks" + + mkdir -pv "$MNT/etc/pacman.d/hooks" + cat > "$MNT/etc/pacman.d/hooks/systemd-boot.hook" <<- EOF [Trigger] Type = Package @@ -1858,7 +1845,6 @@ prerun_systemd-boot() When = PostTransaction Exec = /usr/bin/bootctl update EOF - systemd-machine-id-setup --root="$MNT" return 0 } @@ -2349,6 +2335,7 @@ usage() awesome - A customized Awesome WM session created by @elanapan bspwm - A tiling wm that represents windows as the leaves of a binary tree fluxbox - A lightweight and highly-configurable window manager + jwm - A lightweight window manager for Xorg written in C gnome - A desktop environment that aims to be simple and easy to use cinnamon - A desktop environment combining traditional desktop with modern effects plasma - A kde software project currently comprising a full desktop environment @@ -2416,20 +2403,19 @@ al_repo() { local conf="$1" - if ! grep -q 'archlabs_repo' "$conf"; then - cat >> "$conf" <<- EOF + grep -q 'archlabs_repo' "$conf" && return 0 - [archlabs_unstable] - Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch + cat >> "$conf" <<- EOF - [archlabs_repo] - Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch - Server = https://sourceforge.net/projects/archlabs-repo/files/\$repo/\$arch - Server = https://github.com/ARCHLabs/\$repo/raw/master/\$arch + [archlabs_unstable] + Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch - EOF - fi - return 0 + [archlabs_repo] + Server = https://bitbucket.org/archlabslinux/\$repo/raw/master/\$arch + Server = https://sourceforge.net/projects/archlabs-repo/files/\$repo/\$arch + Server = https://github.com/ARCHLabs/\$repo/raw/master/\$arch + + EOF } termcol() @@ -2521,7 +2507,7 @@ umount_dir() chk_connect() { msg "Network Connect" "\nVerifying network connection\n" 0 - curl -sIN --connect-timeout 5 'https://www.archlinux.org/' | sed '1q' | grep -q '200' + curl -sIN --connect-timeout 15 'https://www.archlinux.org/' | sed '1q' | grep -q '200' } net_connect() @@ -2648,7 +2634,7 @@ system_identify system_devices while :; do - dlg fontsize menu "Font Size" "\nSelect a font size from the list below" \ + dlg fontsize menu "Font Size" "\nSelect a font size from the list below." \ 12 "setfont ter-i12n" 14 "setfont ter-i14n" 16 "setfont ter-i16n" 18 "setfont ter-i18n" \ 20 "setfont ter-i20n" 22 "setfont ter-i22n" 24 "setfont ter-i24n" 28 "setfont ter-i28n" \ 32 "setfont ter-i32n" || break