diff --git a/installer b/installer index 24fae4e..3a84e86 100755 --- a/installer +++ b/installer @@ -183,7 +183,7 @@ declare -A WM_EXT=( [lxqt]='breeze breeze-icons picom libpulse network-manager-applet' [openbox]='archlabs-skel-openbox archlabs-obkey archlabs-kickshaw archlabs-paranoid archlabs-skel-xfce4 archlabs-i3lock-color archlabs-i3lock-fancy archlabs-pipemenus archlabs-ksuperkey obconf jgmenu tint2 conky rofi lxmenu-data' [plasma]='kde-applications-meta powerdevil' -[sway]='archlabs-skel-sway grim slurp swayidle swaylock swappy jq lxappearance archlabs-swaync archlabs-foot archlabs-sway-save-outputs archlabs-wlsunset archlabs-wdisplays archlabs-azote archlabs-autotiling archlabs-nwg-bar archlabs-nwg-dock archlabs-nwg-shell-config archlabs-nwg-drawer archlabs-nwg-menu archlabs-nwg-panel archlabs-nwg-wrapper archlabs-gopsuinfo wl-clipboard' +[sway]='archlabs-skel-sway foot grim slurp swayidle swaylock swappy jq lxappearance archlabs-swaync archlabs-sway-save-outputs archlabs-wlsunset archlabs-wdisplays archlabs-azote archlabs-autotiling archlabs-nwg-bar archlabs-nwg-dock archlabs-nwg-shell-config archlabs-nwg-drawer archlabs-nwg-menu archlabs-nwg-panel archlabs-nwg-wrapper archlabs-gopsuinfo wl-clipboard' [xfce4]='archlabs-skel-xfce4 xfce4-goodies xfce4-pulseaudio-plugin network-manager-applet volumeicon rofi archlabs-ksuperkey' ) # } @@ -469,7 +469,7 @@ main() fi case $SEL in 1) dev_menu || (( SEL-- )) ;; - 2) mount_menu || (( SEL-- )) ;; + 2) mount_menu || SEL=0 ;; 3) prechecks 0 && { select_bootldr || (( SEL-- )); } ;; 4) prechecks 1 && { select_mkuser || (( SEL-- )); } ;; 5) prechecks 2 && { select_config || (( SEL-- )); } ;; @@ -1007,7 +1007,7 @@ dev_menu() 'part' 'Modify the partition layout of a device' \ 'luks' 'Setup LUKS encryption on a partition or LVM' \ 'lvm' 'Setup logical volume management on partition(s)' \ - 'back' "$back" + 'back' "$back" || return 0 if [[ -z $WARN && $choice != 'view' ]]; then msg "Data Warning" "$_warn" @@ -1018,7 +1018,7 @@ dev_menu() 'part') part_menu && [[ "$AUTO_ROOT" ]] && return 0 ;; 'luks') luks_menu || return 1 ;; 'lvm') lvm_menu || return 1 ;; - *) break; + *) return 0; esac done return 0 @@ -1106,35 +1106,45 @@ part_auto() while read -r PART; do [[ $PART ]] || continue parted -s "$device" rm "$PART" > /dev/null 2> "$ERR" - errshow 0 "parted -s '$device' rm '$PART' > /dev/null" || return 1 + errshow 0 "parted -s '$device' rm '$PART'" || return 1 done <<< "$(awk '/^ [1-9][0-9]?/ {print $1}' <<< "$dev_info" | sort -r)" - [[ $(awk '/Table:/ {print $3}' <<< "$dev_info") != "$label" ]] && parted -s "$device" mklabel "$label" > /dev/null 2> "$ERR" + if [[ $(awk '/Table:/ {print $3}' <<< "$dev_info") != "$label" ]]; then + parted -s "$device" mklabel "$label" > /dev/null 2> "$ERR" + errshow 0 "parted -s '$device' mklabel '$label'" || return 1 + fi msg "Auto Partition" "\nCreating a 512M $boot_fs boot partition.\n" 1 parted -s "$device" mkpart "$boot_type" "$boot_fs" 1MiB 513MiB > /dev/null 2> "$ERR" - errshow 0 "parted -s '$device' mkpart '$boot_type' '$boot_fs' 1MiB 513MiB > /dev/null" || return 1 + errshow 0 "parted -s '$device' mkpart '$boot_type' '$boot_fs' 1MiB 513MiB" || return 1 sleep 0.5 BOOT_D="$device" - AUTO_BOOT=$(lsblk -lno NAME,TYPE "$device" | awk 'NR==2 {print "/dev/" $1}') + AUTO_BOOT=$(lsblk -lno NAME,TYPE "$device" | grep 'part' | sort | awk '{print "/dev/" $1}') if [[ $SYS == "BIOS" ]]; then mkfs.ext4 -q "$AUTO_BOOT" > /dev/null 2> "$ERR" - errshow 0 "mkfs.ext4 -q '$AUTO_BOOT' > /dev/null" || return 1 + errshow 0 "mkfs.ext4 -q '$AUTO_BOOT'" || return 1 else mkfs.vfat -F32 "$AUTO_BOOT" > /dev/null 2> "$ERR" - errshow 0 "mkfs.vfat -F32 '$AUTO_BOOT' > /dev/null" || return 1 + errshow 0 "mkfs.vfat -F32 '$AUTO_BOOT'" || return 1 fi - msg "Auto Partition" "\nCreating a $size ext4 root partition.\n" 0 - parted -s "$device" mkpart primary ext4 513MiB 100% > /dev/null 2> "$ERR" - errshow 0 "parted -s '$device' mkpart primary ext4 513MiB 100% > /dev/null" || return 1 sleep 0.5 - AUTO_ROOT="$(lsblk -lno NAME,TYPE "$device" | awk 'NR==3 {print "/dev/" $1}')" + msg "Auto Partition" "\nCreating a $size ext4 root partition.\n" 0 + if [[ $SYS == "BIOS" ]]; then + parted -s "$device" mkpart primary ext4 513MiB 100% > /dev/null 2> "$ERR" + errshow 0 "parted -s '$device' mkpart primary ext4 513MiB 100%" || return 1 + else + parted -s "$device" mkpart "$DIST" ext4 513MiB 100% > /dev/null 2> "$ERR" + errshow 0 "parted -s '$device' mkpart '$DIST' ext4 513MiB 100%" || return 1 + fi + + sleep 0.5 + AUTO_ROOT="$(lsblk -lno NAME,TYPE "$device" | grep 'part' | sort | awk 'NR==2 {print "/dev/" $1}')" mkfs.ext4 -q "$AUTO_ROOT" > /dev/null 2> "$ERR" - errshow 0 "mkfs.ext4 -q '$AUTO_ROOT' > /dev/null" || return 1 + errshow 0 "mkfs.ext4 -q '$AUTO_ROOT'" || return 1 sleep 0.5 msg "Auto Partition" "\nProcess complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE "$device")\n" } @@ -2509,10 +2519,6 @@ prerun_grub() sed -i "s/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g" "$MNT/etc/default/grub" fi - # fix network interface names changing after reboot - # https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ - sed -i 's/\(GRUB_CMDLINE_LINUX=".*\)"/\1 net.ifnames=0"/g' "$MNT/etc/default/grub" - # setup for os-prober module mkdir -p /run/{lvm,udev} "$MNT/hostrun/"{lvm,udev} mount --bind /run/lvm "$MNT/hostrun/lvm" @@ -2535,7 +2541,7 @@ prerun_efistub() { BCMDS[efistub]="mount -t efivarfs efivarfs /sys/firmware/efi/efivars > /dev/null 2>&1 efibootmgr -v -d $BOOT_D -p $BOOT_NUM -c -L '${DIST} Linux' -l /vmlinuz-${KERNEL} \ - -u 'root=$ROOT_ID rw net.ifnames=0 $( + -u 'root=$ROOT_ID rw $( [[ $BTRFS_MNT ]] && printf '%s ' "$BTRFS_MNT" [[ $UCODE ]] && printf 'initrd=\%s.img ' "$UCODE" )initrd=\initramfs-${KERNEL}.img'" @@ -2595,13 +2601,13 @@ prerun_syslinux() LABEL $DIST MENU LABEL $DIST Linux LINUX $d/vmlinuz-$KERNEL - APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL.img LABEL ${DIST}fallback MENU LABEL $DIST Linux Fallback LINUX $d/vmlinuz-$KERNEL - APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + APPEND root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") INITRD $([[ $UCODE ]] && printf "%s" "$d/$UCODE.img,")$d/initramfs-$KERNEL-fallback.img EOF return 0 @@ -2616,9 +2622,9 @@ setup_refind() prerun_refind() { cat > "$MNT/boot/refind_linux.conf" <<- EOF - "$DIST Linux" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") add_efi_memmap $([[ $UCODE ]] && + "$DIST Linux" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw ([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") add_efi_memmap $([[ $UCODE ]] && printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-%v.img" - "$DIST Linux Fallback" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") add_efi_memmap $([[ $UCODE ]] && + "$DIST Linux Fallback" "root=$ROOT_ID ${LUKS_DEV}${RESUME}rw ([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") add_efi_memmap $([[ $UCODE ]] && printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-%v-fallback.img" EOF @@ -2657,14 +2663,14 @@ prerun_systemd-boot() title $DIST Linux linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img") initrd /initramfs-$KERNEL.img - options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") 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}${RESUME}rw net.ifnames=0$([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") + options root=$ROOT_ID ${LUKS_DEV}${RESUME}rw $([[ $BTRFS_MNT ]] && printf ' %s' "$BTRFS_MNT") EOF mkdir -pv "$MNT/etc/pacman.d/hooks" @@ -3455,7 +3461,7 @@ zshrc() debug() { - export PS4='| ${BASH_SOURCE} LINE:${LINENO} FUNC:${FUNCNAME[0]:+ ${FUNCNAME[0]}()} |> ' + export PS4='| installer: LN:${LINENO} FN:${FUNCNAME[0]:+ ${FUNCNAME[0]}()} -> ' set -x exec 3>| $DBG BASH_XTRACEFD=3 @@ -3820,7 +3826,7 @@ fi trap 'printf "\n^C\n" && die 1' INT -while getopts ":htcnrfD:b:m:d:" OPT; do +while getopts ":htcnrfDb:m:d:" OPT; do case "$OPT" in D) debug ;; h) usage "${0##*/}" ;; @@ -3920,9 +3926,9 @@ if [[ ! -f /tmp/new ]]; then fi if curl -fsSL 'https://bitbucket.org/archlabslinux/installer/raw/master/installer' -o /tmp/new; then if (( $(vercmp "$(awk -F= '/^VER=/ {print $2}' /tmp/new)" "$VER") > 0 )); then - cp /tmp/new /usr/bin/installer - chmod +x /usr/bin/installer - exec /usr/bin/installer "$@" + cp /tmp/new /usr/local/bin/installer + chmod +x /usr/local/bin/installer + exec /usr/local/bin/installer "$@" fi fi fi