diff --git a/archlabs-installer b/archlabs-installer index 1f78e76..550be13 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -126,7 +126,7 @@ _sessions="\nUse [Space] to toggle available sessions, use [Enter] to accept the _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." -_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] or Ctrl-z again to resume the installer, if you want to avoid the automatic reboot using Ctrl-c will cleanly exit." +_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." # LUKS _luksnew="Basic LUKS Encryption" @@ -594,8 +594,7 @@ part_menu() txt+="A $boot_fs efi boot partition (512M)\n- " fi txt+="An ext4 partition using all remaining space ($root_size)\n\nDo you want to continue?\n" - yesno "Auto Partition" "$txt" && msg "Info" "\nGathering device info.\n" 1 && part_auto "$device" "$table" "$boot_fs" "$root_size" - + yesno "Auto Partition" "$txt" && part_auto "$device" "$table" "$boot_fs" "$root_size" else clear tput cnorm @@ -657,7 +656,6 @@ part_auto() AUTO_ROOT_PART="$(lsblk -lno NAME,TYPE "$device" | awk 'NR==3 {print "/dev/" $1}')" mkfs.ext4 -q "$AUTO_ROOT_PART" >/dev/null 2>&1 sleep 0.5 - FORMATTED+="$AUTO_BOOT_PART $AUTO_ROOT_PART " msg "Auto Partition" "\nProcess complete.\n\n$(lsblk -o NAME,MODEL,SIZE,TYPE,FSTYPE "$device")\n" } @@ -790,7 +788,7 @@ part_mount() fs="$(lsblk -lno FSTYPE "$part")" mkdir -p "$mountp" - if [[ $fs && ${FS_OPTS[$fs]} && $part != "$BOOT_PART" ]] && select_mntopts "$fs"; then + if [[ $fs && ${FS_OPTS[$fs]} && $part != "$BOOT_PART" && $part != "$AUTO_ROOT_PART" ]] && select_mntopts "$fs"; then mount -o "$MNT_OPTS" "$part" "$mountp" >/dev/null 2>&1 else mount "$part" "$mountp" >/dev/null 2>&1 @@ -1016,8 +1014,11 @@ select_filesystem() local txt="\nSelect which filesystem to use for: $part\n\nDefault: ext4" cur="$(lsblk -lno FSTYPE "$part" 2>/dev/null)" + # bail early if the partition was created in part_auto() + [[ $cur && $part == "$AUTO_ROOT_PART" ]] && return 0 + until [[ $fs ]]; do - if [[ $cur && ($part != "$ROOT_PART" || $FORMATTED == *"$part"*) ]]; then + if [[ $cur && $FORMATTED == *"$part"* ]]; then dlg fs menu "Filesystem" "$txt\nCurrent: $cur" skip - ext4 - ext3 - ext2 - vfat - ntfs - f2fs - jfs - xfs - nilfs2 - reiserfs - || return 1 else dlg fs menu "Filesystem" "$txt" ext4 - ext3 - ext2 - vfat - ntfs - f2fs - jfs - xfs - nilfs2 - reiserfs - || return 1 @@ -1032,7 +1033,8 @@ select_efi_partition() { if [[ $AUTO_BOOT_PART ]]; then msg "EFI Boot Partition" "\nUsing partition created during automatic format.\n" 2 - BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here + BOOT_PART="$AUTO_BOOT_PART" + return 0 # were done here else local pts size dev isize bsize ptcount=0 @@ -1052,9 +1054,9 @@ select_efi_partition() fi fi - [[ $BOOT_PART ]] || return 1 - - if grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then + if [[ -z $BOOT_PART ]]; then + return 1 + elif grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"; then local txt="\nIMPORTANT:\n\nThe EFI partition $BOOT_PART $_format" if yesno "Format EFI Partition" "$txt" "Format $BOOT_PART" "Skip Formatting" 1; then part_format "$BOOT_PART" "vfat" 2 @@ -1069,8 +1071,9 @@ select_efi_partition() select_boot_partition() { if [[ $AUTO_BOOT_PART && ! $LVM ]]; then - msg "BIOS Boot Partition" "\nUsing partition created during automatic format.\n" 2 - BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here + msg "Boot Partition" "\nUsing partition created during automatic format.\n" 2 + BOOT_PART="$AUTO_BOOT_PART" + return 0 # were done here else local pts size dev isize bsize ptcount=0 @@ -1106,7 +1109,7 @@ select_root_partition() { if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then ROOT_PART="$AUTO_ROOT_PART" - msg "Select Root Partition (/)" "\nUsing partition created during automatic format.\n" 2 + msg "Root Partition (/)" "\nUsing partition created during automatic format.\n" 2 part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; } return 0 # we're done here else @@ -1121,16 +1124,17 @@ select_root_partition() done <<< "$PARTS" if (( ptcount == 1 )); then # only one available device - msg "Select Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 2 + msg "Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 2 ROOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")" 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 fi fi - [[ $ROOT_PART ]] || return 1 - select_filesystem "$ROOT_PART" || { ROOT_PART=''; return 1; } - part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; } + if [[ -z $ROOT_PART ]] || ! select_filesystem "$ROOT_PART" || ! part_mount "$ROOT_PART"; then + ROOT_PART='' + return 1 + fi return 0 } @@ -1344,10 +1348,10 @@ install_user() errshow 1 "set $NEWUSER password" if [[ $INSTALL_WMS == *dwm* ]];then - mkdir -pv "$mnt/home/$newuser/suckless" + mkdir -pv "$MNT/home/$NEWUSER/suckless" for i in dwm dmenu st; do - if chrun "git clone https://git.suckless.org/$i /home/$newuser/suckless/$i"; then - chrun "cd /home/$newuser/suckless/$i; make prefix=/usr install; make clean; rm config.h" + if chrun "git clone https://git.suckless.org/$i /home/$NEWUSER/suckless/$i"; then + chrun "cd /home/$NEWUSER/suckless/$i; make prefix=/usr install; make clean" else printf "failed to clone %s repo\n" "$i" fi @@ -2389,6 +2393,8 @@ elif ! net_connect; then die 1 fi +FORMATTED="" + while :; do main done