Update filesystem selection to use looping instead of recursion
This commit is contained in:
parent
1e6f7a1438
commit
1e93f2b6c5
@ -139,14 +139,14 @@ _InstSysBody="\nInstall syslinux to the master boot record (MBR) or to root (/)?
|
||||
# File System
|
||||
_FSTitle="Choose Filesystem"
|
||||
_SelRootBody="\nSelect the system root (/) partition.\n\nThis is where $DIST will be installed."
|
||||
_SelBiosBody="\nDo you want to use a separate boot partition? (required for LUKS)\n\nThis partition is where the bootloader will be installed.\n"
|
||||
_SelBiosBody="\nSelect the boot partition, this is only required for LUKS."
|
||||
|
||||
_SelSwpNone="None"
|
||||
_SelSwpFile="Swapfile"
|
||||
_SelSwpSetup="Swap Setup"
|
||||
_SelSwpBody="\nSelect whether to use a swap partition, swapfile, or none."
|
||||
_SelSwpErr="Swap Setup Error: Must be 1(M|G) or greater, and can only contain whole numbers\n\nSize Entered:"
|
||||
_SelSwpSize="\n\n\nEnter the size of the swapfile in megabytes (M) or gigabytes (G).\n\neg. 100M will create a 100 megabyte swapfile, while 10G will create a 10 gigabyte swapfile.\n\nFor ease of use and as an example the size has been filled in to the size of your system memory (RAM).\n\nMust be greater than 1, end in either M or G, and contain only whole numbers."
|
||||
_SelSwpSize="\nEnter the size of the swapfile in megabytes (M) or gigabytes (G).\n\neg. 100M will create a 100 megabyte swapfile, while 10G will create a 10 gigabyte swapfile.\n\nFor ease of use and as an example it is filled in to match the size of your system memory (RAM).\n\nMust be greater than 1, contain only whole numbers, and end with either M or G."
|
||||
|
||||
_SelUefiBody="\nSelect the system EFI boot partition.\n\nThis is a required partition for booting UEFI systems. It's usually the first partition on the drive, less than 512M, and will be formatted as vfat/fat32 if not already."
|
||||
_FormUefiBody="\nIMPORTANT: The EFI partition"
|
||||
@ -181,12 +181,12 @@ _LvmPvSelBody="Select the partition(s) to use for the physical volume (PV)."
|
||||
_LvmPvConfBody1="\nConfirm creation of volume group:"
|
||||
_LvmPvConfBody2="With the following partition(s):"
|
||||
_LvmPvActBody1="\nCreating and activating volume group:"
|
||||
_LvmPvDoneBody1="\nVolume group:"
|
||||
_LvmPvDoneBody1="Volume group:"
|
||||
_LvmPvDoneBody2="has been created"
|
||||
_LvmLvNumBody1="\nUse [Spacebar] to select the number of logical volumes (LVs) to create in:"
|
||||
_LvmLvNumBody2="\nThe last (or only) logical volume will automatically use all remaining space in the volume group."
|
||||
_LvmLvNameBody1="Enter the name of the logical volume (LV) to create.\n\nThis is like setting a name or label for a partition.\n"
|
||||
_LvmLvNameBody2="\nNOTE: This logical volume will use up all remaining space in the volume group"
|
||||
_LvmLvNameBody2="\nNOTE: This LV will use up all remaining space in the volume group"
|
||||
_LvmLvSizeBody1="remaining"
|
||||
_LvmLvSizeBody2="\n\nEnter the size of the logical volume (LV) in megabytes (M) or gigabytes (G). For example, 100M will create a 100 megabyte LV. 10G will create a 10 gigabyte LV.\n"
|
||||
_LvmCompBody="\nDone! all logical volumes have been created for the volume group.\n\nDo you want to view the device tree for the new LVM scheme?\n"
|
||||
|
@ -8,7 +8,7 @@
|
||||
# Some ideas and code reworked from other resources
|
||||
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
||||
|
||||
VER="1.8.42" # version
|
||||
VER="1.8.44" # version
|
||||
DIST="ArchLabs" # distributor
|
||||
MNT="/mnt" # install mountpoint
|
||||
|
||||
@ -20,8 +20,8 @@ ROOT_PART="" # root partition
|
||||
BOOT_PART="" # boot partition
|
||||
BOOT_DEVICE="" # device used for BIOS grub install
|
||||
BOOTLDR="" # bootloader selected
|
||||
EXTRA_MNT="" # holder for additional partitions while mounting
|
||||
EXTRA_MNTS="" # when an extra partition is mounted append it's info
|
||||
EXMNT="" # holder for additional partitions while mounting
|
||||
EXMNTS="" # when an extra partition is mounted append it's info
|
||||
SWAP_PART="" # swap partition or file path
|
||||
SWAP_SIZE="" # when using a swapfile use this size
|
||||
NEWUSER="" # username for the primary user
|
||||
@ -30,7 +30,7 @@ ROOT_PASS="" # root password
|
||||
LOGIN_WM="" # default login session
|
||||
LOGIN_TYPE="" # login manager can be lightdm or xinit
|
||||
INSTALL_WMS="" # space separated list of chosen wm/de
|
||||
KERNEL="linux" # kernel can be linux or linux-lts
|
||||
KERNEL="linux" # can be linux, linux-lts, linux-zen, or linux-hardened
|
||||
MYSHELL="" # login shell for root and the primary user
|
||||
PACKAGES="" # list of all packages to install including WM_PACKAGES
|
||||
USER_PKGS="" # packages selected by the user during install
|
||||
@ -57,7 +57,7 @@ CONFIG_DONE=false # basic configuration is finished
|
||||
BROADCOM_WL=false # fixes for broadcom cards eg. BCM4352
|
||||
CHECKED_NET=false # have we checked the network connection already
|
||||
|
||||
AUTO_ROOT_PART="" # values from auto partition
|
||||
AUTO_ROOT_PART="" # values from auto partition
|
||||
AUTO_BOOT_PART=""
|
||||
|
||||
# sane baseline
|
||||
@ -67,7 +67,7 @@ BASE_PKGS+="playerctl ffmpeg gstreamer libmad libmatroska gst-libav gst-plugins-
|
||||
|
||||
# sane extras for window managers
|
||||
WM_BASE_PKGS="arandr archlabs-networkmanager-dmenu xdg-user-dirs nitrogen polkit-gnome volumeicon xclip exo "
|
||||
WM_BASE_PKGS+="xdotool compton gnome-keyring dunst feh gsimplecal xfce4-power-manager xfce4-settings laptop-detect"
|
||||
WM_BASE_PKGS+="xdotool compton wmctrl gnome-keyring dunst feh gsimplecal xfce4-power-manager xfce4-settings laptop-detect"
|
||||
|
||||
SEL=0 # currently selected menu item
|
||||
ERR="/tmp/errlog" # error log used internally
|
||||
@ -109,7 +109,7 @@ CMAPS="$(find /usr/share/kbd/keymaps -name '*.map.gz' | awk '{
|
||||
# command used to install each bootloader
|
||||
declare -A BCMDS=(
|
||||
[grub]="grub-install --recheck --force"
|
||||
[syslinux]="syslinux-install_update -iam"
|
||||
[syslinux]="syslinux-install_update -i -a -m"
|
||||
[systemd-boot]="bootctl --path=/boot install"
|
||||
)
|
||||
|
||||
@ -273,54 +273,56 @@ show_cfg()
|
||||
|
||||
---------- PARTITION CONFIGURATION ------------
|
||||
|
||||
Root: ${ROOT_PART:-None}
|
||||
Boot: ${BOOT_PART:-${BOOT_DEVICE:-None}}
|
||||
Root: ${ROOT_PART:-none}
|
||||
Boot: ${BOOT_PART:-${BOOT_DEVICE:-none}}
|
||||
|
||||
Swap: ${SWAP_PART:-None}
|
||||
Size: ${SWAP_SIZE:-None}
|
||||
Swap: ${SWAP_PART:-none}
|
||||
Size: ${SWAP_SIZE:-none}
|
||||
|
||||
LVM: ${LVM:-None}
|
||||
LUKS: ${LUKS:-None}
|
||||
LVM: ${LVM:-none}
|
||||
LUKS: ${LUKS:-none}
|
||||
|
||||
Extra Mounts: ${EXTRA_MNTS:-${EXTRA_MNT:-None}}
|
||||
Mkinit Hooks: ${HOOKS:-None}
|
||||
Extra Mounts: ${EXMNTS:-${EXMNT:-none}}
|
||||
Mkinit Hooks: ${HOOKS:-none}
|
||||
|
||||
|
||||
---------- BOOTLOADER CONFIGURATION -----------
|
||||
|
||||
Bootloader: ${BOOTLDR:-None}
|
||||
Mountpoint: ${mnt:-None}
|
||||
Command: ${cmd:-None}
|
||||
Bootloader: ${BOOTLDR:-none}
|
||||
Mountpoint: ${mnt:-none}
|
||||
Command: ${cmd:-none}
|
||||
|
||||
|
||||
------------ SYSTEM CONFIGURATION -------------
|
||||
|
||||
Locale: ${LOCALE:-None}
|
||||
Keymap: ${KEYMAP:-None}
|
||||
Hostname: ${HOSTNAME:-None}
|
||||
Timezone: ${ZONE:-None}/${SUBZONE:-None}
|
||||
Locale: ${LOCALE:-none}
|
||||
Keymap: ${KEYMAP:-none}
|
||||
Hostname: ${HOSTNAME:-none}
|
||||
Timezone: ${ZONE:-none}/${SUBZONE:-none}
|
||||
|
||||
|
||||
------------ USER CONFIGURATION --------------
|
||||
|
||||
User: ${NEWUSER:-None}
|
||||
Shell: ${MYSHELL:-None}
|
||||
Session: ${LOGIN_WM:-None}
|
||||
Autologin: ${AUTOLOGIN:-None}
|
||||
Login Method: ${LOGIN_TYPE:-None}
|
||||
User: ${NEWUSER:-none}
|
||||
Shell: ${MYSHELL:-none}
|
||||
Session: ${LOGIN_WM:-none}
|
||||
Autologin: ${AUTOLOGIN:-none}
|
||||
Login Method: ${LOGIN_TYPE:-none}
|
||||
|
||||
|
||||
------------ PACKAGES AND MIRRORS -------------
|
||||
|
||||
Kernel: ${KERNEL:-None}
|
||||
Sessions: ${INSTALL_WMS:-None}
|
||||
Mirrors: ${MIRROR_CMD:-None}
|
||||
Packages: $(print4 "${pkgs:-None}")
|
||||
Kernel: ${KERNEL:-none}
|
||||
Sessions: ${INSTALL_WMS:-none}
|
||||
Mirrors: ${MIRROR_CMD:-none}
|
||||
Packages: $(print4 "${pkgs:-none}")
|
||||
"
|
||||
}
|
||||
|
||||
cfg_menu()
|
||||
{
|
||||
local err=0
|
||||
|
||||
tput civis
|
||||
if ! MYSHELL="$(menubox "$_ShellTitle" "$_ShellBody" '/usr/bin/zsh' '-' '/bin/bash' '-' '/usr/bin/mksh' '-')"; then
|
||||
return 1
|
||||
@ -335,9 +337,13 @@ cfg_menu()
|
||||
return 1
|
||||
fi
|
||||
select_timezone || return 1
|
||||
if ! KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" 'linux' '-' 'linux-lts' '-')"; then
|
||||
return 1
|
||||
fi
|
||||
KERNEL="$(menubox "$_KernelTitle" "$_KernelBody" \
|
||||
'linux' 'Vanilla Linux kernel and modules, with a few patches applied.' \
|
||||
'linux-lts' 'Long-term support (LTS) Linux kernel and modules.' \
|
||||
'linux-zen' 'A collaborative effort of kernel hackers to provide the best Linux kernel for everyday systems' \
|
||||
'linux-hardened' 'A security-focused Linux kernel with hardening patches to mitigate kernel and userspace exploits')"
|
||||
err=$?
|
||||
(( err == 0 )) || return 1
|
||||
select_mirrorcmd || return 1
|
||||
CONFIG_DONE=true
|
||||
return 0
|
||||
@ -887,9 +893,9 @@ partition_menu()
|
||||
local root_size msg ret table boot_fs
|
||||
root_size=$(lsblk -lno SIZE "$device" | awk 'NR == 1 {
|
||||
if ($1 ~ "G") {
|
||||
sub(/G/, ""); print ($1 * 1000 - 512) / 1000"G"
|
||||
sub(/G/, ""); print ($1 * 1000 - 512) / 1000 "G"
|
||||
} else {
|
||||
sub(/M/, ""); print ($1 - 512)"M"
|
||||
sub(/M/, ""); print ($1 - 512) "M"
|
||||
}
|
||||
}')
|
||||
|
||||
@ -899,7 +905,7 @@ partition_menu()
|
||||
msg="$_PartBody2"; table="gpt"; boot_fs="fat32"
|
||||
fi
|
||||
|
||||
if yesno "$_PrepParts" "$_PartBody1 $device $msg ($size)$_PartBody3"; then
|
||||
if yesno "$_PrepParts" "$_PartBody1 $device $msg ($root_size)$_PartBody3"; then
|
||||
auto_partition "$device" "$table" "$boot_fs" "$root_size" || return 1
|
||||
else
|
||||
partition_menu "$device"
|
||||
@ -916,15 +922,6 @@ format_as()
|
||||
errshow "${FS_CMDS[$2]} $1"
|
||||
}
|
||||
|
||||
decr_count()
|
||||
{
|
||||
# remove a partition from the dialog list and decrement the number partitions left
|
||||
local p="$1"
|
||||
PARTS="$(sed "s~${p} [0-9]*[G-M]~~; s~${p} [0-9]*\.[0-9]*[G-M]~~" <<< "$PARTS")"
|
||||
(( COUNT > 0 )) && (( COUNT-- ))
|
||||
return 0
|
||||
}
|
||||
|
||||
enable_swap()
|
||||
{
|
||||
if [[ $1 == "$MNT/swapfile" && $SWAP_SIZE ]]; then
|
||||
@ -983,12 +980,12 @@ confirm_mount()
|
||||
[[ $mount == "$MNT" ]] && local m="/ (root)" || local m="${mount#$MNT}"
|
||||
if [[ $(mount) == *"$mount"* ]]; then
|
||||
infobox "$_MntTitle" "$_MntSucc\nPartition: $part\nMountpoint: $m\n" 1
|
||||
decr_count "$part"
|
||||
PARTS="$(sed "s~${part} [0-9]*[G-M]~~; s~${part} [0-9]*\.[0-9]*[G-M]~~" <<< "$PARTS")"
|
||||
(( COUNT > 0 )) && (( COUNT-- ))
|
||||
else
|
||||
infobox "$_MntTitle" "$_MntFail\n$msg\n" 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -1203,7 +1200,8 @@ select_swap()
|
||||
SWAP_PART="/swapfile"
|
||||
else
|
||||
enable_swap "$SWAP_PART"
|
||||
decr_count "$SWAP_PART"
|
||||
PARTS="$(sed "s~${SWAP_PART} [0-9]*[G-M]~~; s~${SWAP_PART} [0-9]*\.[0-9]*[G-M]~~" <<< "$PARTS")"
|
||||
(( COUNT > 0 )) && (( COUNT-- ))
|
||||
SWAP_SIZE="$(lsblk -lno SIZE $SWAP_PART)"
|
||||
fi
|
||||
return 0
|
||||
@ -1211,72 +1209,92 @@ select_swap()
|
||||
|
||||
select_mountpoint()
|
||||
{
|
||||
local err=0
|
||||
tput cnorm
|
||||
EXTRA_MNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1" "/" nolimit)" || return 1
|
||||
if [[ ${EXTRA_MNT:0:1} != "/" || ${#EXTRA_MNT} -le 1 || $EXTRA_MNT =~ \ |\' || $EXTRA_MNTS == *"$EXTRA_MNT"* ]]; then
|
||||
msgbox "$_ErrTitle" "$_ExtErrBody"
|
||||
select_mountpoint || return 1
|
||||
fi
|
||||
return 0
|
||||
while true; do
|
||||
EXMNT="$(getinput "$_PrepMount $part" "$_ExtPartBody1" "/" nolimit)"
|
||||
err=$?
|
||||
(( err == 0 )) || break
|
||||
if [[ ${EXMNT:0:1} != "/" || ${#EXMNT} -le 1 || $EXMNT =~ \ |\' || $EXMNTS == *"$EXMNT"* ]]; then
|
||||
msgbox "$_ErrTitle" "$_ExtErrBody"
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
return $err
|
||||
}
|
||||
|
||||
select_mount_opts()
|
||||
{
|
||||
local part="$1"
|
||||
local fs="$2"
|
||||
local part="$1" fs="$2" err=0
|
||||
local title="${fs^} Mount Options"
|
||||
local opts="${FS_OPTS[$fs]}"
|
||||
|
||||
tput civis
|
||||
is_ssd "$part" >/dev/null 2>&1 && opts=$(sed 's/discard - off/discard - on/' <<< "$opts")
|
||||
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" --title " $title " --checklist "$_MntBody" 0 0 0 $opts)"
|
||||
[[ $MNT_OPTS ]] && MNT_OPTS="$(sed 's/ /,/g; $s/,$//' <<< "$MNT_OPTS" )" || return 1
|
||||
yesno "$title" "$_MntConfBody $MNT_OPTS\n" || { select_mount_opts "$part" "$fs" || return 1; }
|
||||
if is_ssd "$part" >/dev/null 2>&1; then
|
||||
opts=$(sed 's/discard - off/discard - on/' <<< "$opts")
|
||||
fi
|
||||
|
||||
return 0
|
||||
tput civis
|
||||
while true; do
|
||||
MNT_OPTS="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $title " --checklist "$_MntBody" 0 0 0 $opts)"
|
||||
if [[ $MNT_OPTS ]]; then
|
||||
MNT_OPTS="$(sed 's/ /,/g; $s/,$//' <<< "$MNT_OPTS" )"
|
||||
yesno "$title" "$_MntConfBody $MNT_OPTS\n" && break
|
||||
else
|
||||
err=1; break
|
||||
fi
|
||||
done
|
||||
|
||||
return $err
|
||||
}
|
||||
|
||||
select_filesystem()
|
||||
{
|
||||
local part="$1"
|
||||
local fs cur_fs
|
||||
local part="$1" fs="" cur_fs="" err=0
|
||||
cur_fs="$(lsblk -lno FSTYPE "$part" 2>/dev/null)"
|
||||
local msg="\nSelect which filesystem to use for: $part\n\nCurrent: ${cur_fs:-None}\nDefault: ext4"
|
||||
local msg="\nSelect which filesystem to use for: $part\n\nCurrent: ${cur_fs:-none}\nDefault: ext4"
|
||||
|
||||
[[ $part == $ROOT_PART && $ROOT_PART == $AUTO_ROOT_PART && $LUKS == "" && $LVM == "" ]] && return 0
|
||||
tput civis
|
||||
if [[ $cur_fs && $part != "$ROOT_PART" ]]; then
|
||||
fs="$(menubox "$_FSTitle: $part" "$msg" \
|
||||
"$_Skip" "-" \
|
||||
"ext4" "${FS_CMDS[ext4]}" \
|
||||
"ext3" "${FS_CMDS[ext3]}" \
|
||||
"ext2" "${FS_CMDS[ext2]}" \
|
||||
"vfat" "${FS_CMDS[vfat]}" \
|
||||
"ntfs" "${FS_CMDS[ntfs]}" \
|
||||
"f2fs" "${FS_CMDS[f2fs]}" \
|
||||
"jfs" "${FS_CMDS[jfs]}" \
|
||||
"xfs" "${FS_CMDS[xfs]}"\
|
||||
"nilfs2" "${FS_CMDS[nilfs2]}" \
|
||||
"reiserfs" "${FS_CMDS[reiserfs]}")"
|
||||
[[ $fs == "$_Skip" ]] && return 0
|
||||
else
|
||||
fs="$(menubox "$_FSTitle: $part" "$msg" \
|
||||
"ext4" "${FS_CMDS[ext4]}" \
|
||||
"ext3" "${FS_CMDS[ext3]}" \
|
||||
"ext2" "${FS_CMDS[ext2]}" \
|
||||
"ntfs" "${FS_CMDS[ntfs]}" \
|
||||
"f2fs" "${FS_CMDS[f2fs]}" \
|
||||
"jfs" "${FS_CMDS[jfs]}" \
|
||||
"xfs" "${FS_CMDS[xfs]}" \
|
||||
"nilfs2" "${FS_CMDS[nilfs2]}" \
|
||||
"reiserfs" "${FS_CMDS[reiserfs]}")"
|
||||
fi
|
||||
[[ $fs ]] || return 1
|
||||
if yesno "$_FSTitle" "\nFormat $part as $fs?\n"; then
|
||||
format_as "$part" "$fs" || return 1
|
||||
else
|
||||
select_filesystem "$part" || return 1
|
||||
fi
|
||||
return 0
|
||||
|
||||
while true; do
|
||||
tput civis
|
||||
if [[ $cur_fs && $part != "$ROOT_PART" ]]; then
|
||||
fs="$(menubox "$_FSTitle: $part" "$msg" \
|
||||
"$_Skip" "-" \
|
||||
"ext4" "${FS_CMDS[ext4]}" \
|
||||
"ext3" "${FS_CMDS[ext3]}" \
|
||||
"ext2" "${FS_CMDS[ext2]}" \
|
||||
"vfat" "${FS_CMDS[vfat]}" \
|
||||
"ntfs" "${FS_CMDS[ntfs]}" \
|
||||
"f2fs" "${FS_CMDS[f2fs]}" \
|
||||
"jfs" "${FS_CMDS[jfs]}" \
|
||||
"xfs" "${FS_CMDS[xfs]}"\
|
||||
"nilfs2" "${FS_CMDS[nilfs2]}" \
|
||||
"reiserfs" "${FS_CMDS[reiserfs]}")"
|
||||
|
||||
[[ $fs == "$_Skip" ]] && break
|
||||
else
|
||||
fs="$(menubox "$_FSTitle: $part" "$msg" \
|
||||
"ext4" "${FS_CMDS[ext4]}" \
|
||||
"ext3" "${FS_CMDS[ext3]}" \
|
||||
"ext2" "${FS_CMDS[ext2]}" \
|
||||
"ntfs" "${FS_CMDS[ntfs]}" \
|
||||
"f2fs" "${FS_CMDS[f2fs]}" \
|
||||
"jfs" "${FS_CMDS[jfs]}" \
|
||||
"xfs" "${FS_CMDS[xfs]}" \
|
||||
"nilfs2" "${FS_CMDS[nilfs2]}" \
|
||||
"reiserfs" "${FS_CMDS[reiserfs]}")"
|
||||
|
||||
fi
|
||||
|
||||
[[ $fs ]] || { err=1; break; }
|
||||
|
||||
yesno "$_FSTitle" "\nFormat $part as $fs?\n" && break
|
||||
done
|
||||
|
||||
(( err == 0 )) || return $err
|
||||
[[ $fs == "$_Skip" ]] || format_as "$part" "$fs"
|
||||
}
|
||||
|
||||
select_efi_partition()
|
||||
@ -1311,7 +1329,7 @@ select_efi_partition()
|
||||
select_boot_partition()
|
||||
{
|
||||
tput civis
|
||||
if [[ $AUTO_BOOT_PART == "$BOOT_PART" ]]; then
|
||||
if [[ $AUTO_BOOT_PART && $AUTO_BOOT_PART == "$BOOT_PART" ]]; then
|
||||
BOOT_PART="$AUTO_BOOT_PART"
|
||||
return 0 # were done here
|
||||
else
|
||||
@ -1353,13 +1371,13 @@ select_extra_partitions()
|
||||
|
||||
while (( COUNT > 0 )); do
|
||||
tput civis
|
||||
part="$(menubox "$_PrepMount " "$_ExtPartBody" "$_Done" "Return to the last menu" $PARTS)"
|
||||
part="$(menubox "$_PrepMount " "$_ExtPartBody" "$_Done" "Return to the main menu" $PARTS)"
|
||||
|
||||
if [[ $part == "$_Done" || $part == "" ]]; then
|
||||
break
|
||||
elif select_filesystem "$part" && select_mountpoint && mount_partition "$part" "$EXTRA_MNT"; then
|
||||
EXTRA_MNTS="$EXTRA_MNTS $part: $EXTRA_MNT"
|
||||
[[ $EXTRA_MNT == '/usr' && $HOOKS != *usr* ]] && HOOKS="usr $HOOKS"
|
||||
elif select_filesystem "$part" && select_mountpoint && mount_partition "$part" "$EXMNT"; then
|
||||
EXMNTS="$EXMNTS $part: $EXMNT"
|
||||
[[ $EXMNT == '/usr' && $HOOKS != *usr* ]] && HOOKS="usr $HOOKS"
|
||||
else
|
||||
break; return 1
|
||||
fi
|
||||
@ -1427,7 +1445,7 @@ EOF
|
||||
|
||||
if [[ -e /run/archiso/sfs/airootfs ]]; then
|
||||
printf "Copying vmlinuz and ucode to /boot\n"
|
||||
[[ $KERNEL != 'linux-lts' ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
|
||||
[[ $KERNEL == 'linux' ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
|
||||
[[ $UCODE && ! $VM ]] && cp -vf $RUN/${UCODE/-/_}.img $MNT/boot/${UCODE}.img
|
||||
fi
|
||||
|
||||
@ -1530,7 +1548,7 @@ setup_xinit()
|
||||
if [[ -e $MNT/home/$NEWUSER/.xinitrc ]] && grep -q 'exec' $MNT/home/$NEWUSER/.xinitrc; then
|
||||
sed -i "/exec/ c exec ${LOGIN_WM}" $MNT/home/$NEWUSER/.xinitrc
|
||||
else
|
||||
printf "exec %s\n" "$LOGIN_WM" > $MNT/home/$NEWUSER/.xinitrc
|
||||
printf "exec %s\n" "$LOGIN_WM" >> $MNT/home/$NEWUSER/.xinitrc
|
||||
fi
|
||||
|
||||
# automatic startx for login shells
|
||||
@ -1567,10 +1585,7 @@ EOF
|
||||
loginrc=".zprofile"
|
||||
esac
|
||||
|
||||
if ! [[ ${EDIT_FILES[login]} =~ $loginrc ]]; then
|
||||
# add the shell login file to the edit list after install
|
||||
EDIT_FILES[login]+=" /home/$NEWUSER/$loginrc"
|
||||
fi
|
||||
[[ ${EDIT_FILES[login]} == *"$loginrc"* ]] || EDIT_FILES[login]+=" /home/$NEWUSER/$loginrc"
|
||||
|
||||
if [[ $AUTOLOGIN == true ]]; then
|
||||
sed -i "s/root/${NEWUSER}/g" $SERVICE/autologin.conf
|
||||
@ -1666,7 +1681,19 @@ package_operations()
|
||||
|
||||
[[ $MYSHELL == *mksh* ]] && inpkg+=" mksh"
|
||||
[[ $BOOTLDR == 'grub' ]] && inpkg+=" grub"
|
||||
[[ $KERNEL == 'linux-lts' ]] && { inpkg+=" linux-lts"; rmpkg+=" linux"; }
|
||||
|
||||
if [[ $KERNEL == 'linux-lts' ]]; then
|
||||
inpkg+=" linux-lts"; rmpkg+=" linux"
|
||||
elif [[ $KERNEL == 'linux-zen' ]]; then
|
||||
inpkg+=" linux-zen"; rmpkg+=" linux"
|
||||
elif [[ $KERNEL == 'linux-hardened' ]]; then
|
||||
inpkg+=" linux-hardened"; rmpkg+=" linux"
|
||||
fi
|
||||
|
||||
if [[ $MYSHELL == '/usr/bin/zsh' ]]; then
|
||||
inpkg+=" zsh-completions zsh-history-substring-search"
|
||||
fi
|
||||
|
||||
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|dwm) ]] && inpkg+=" $WM_BASE_PKGS"
|
||||
[[ $INSTALL_WMS =~ ^(plasma|gnome|cinnamon)$ ]] || inpkg+=" archlabs-ksuperkey"
|
||||
|
||||
@ -1726,13 +1753,13 @@ setup_grub()
|
||||
EDIT_FILES[bootloader]="/etc/default/grub"
|
||||
if [[ $SYS == 'BIOS' ]]; then
|
||||
[[ $BOOT_DEVICE ]] || { select_device 'boot' || return 1; }
|
||||
BCMDS[grub]="${BCMDS[grub]} --target=i386-pc $BOOT_DEVICE"
|
||||
BCMDS[grub]="grub-install --recheck --force --target=i386-pc $BOOT_DEVICE"
|
||||
else
|
||||
if [[ $ROOT_PART == */dev/mapper/* && ! $LVM && ! $LUKS_PASS ]]; then
|
||||
luks_pass "$_LuksOpen" 1 || return 1
|
||||
fi
|
||||
BCMDS[grub]="mount -t efivarfs efivarfs $efidir/efivars || true &&
|
||||
${BCMDS[grub]} --bootloader-id=$DIST"
|
||||
grub-install --recheck --force --bootloader-id=$DIST"
|
||||
|
||||
grep -q $efidir/efivars <<< "$(mount)" || mount -t efivarfs efivarfs $efidir/efivars
|
||||
fi
|
||||
@ -1787,7 +1814,7 @@ prerun_grub()
|
||||
prerun_systemd-boot()
|
||||
{
|
||||
# no LVM then systemd-boot uses PARTUUID
|
||||
[[ $ROOT_PART =~ /dev/mapper ]] || ROOT_PART_ID="PART$ROOT_PART_ID"
|
||||
[[ $ROOT_PART == */dev/mapper* ]] || ROOT_PART_ID="PART$ROOT_PART_ID"
|
||||
|
||||
# create the boot entry configs
|
||||
mkdir -p ${MNT}${BMNTS[$SYS-systemd-boot]}/loader/entries
|
||||
@ -1830,8 +1857,7 @@ prerun_syslinux()
|
||||
{
|
||||
mkdir -pv $MNT${BMNTS[$SYS-syslinux]}/syslinux
|
||||
cp -rfv /usr/lib/syslinux/bios/* $MNT${BMNTS[$SYS-syslinux]}/syslinux/
|
||||
|
||||
cat > $cfgdir/syslinux.cfg << EOF
|
||||
cat > $MNT${BMNTS[$SYS-syslinux]}/syslinux/syslinux.cfg << EOF
|
||||
UI menu.c32
|
||||
PROMPT 0
|
||||
|
||||
@ -1850,16 +1876,27 @@ MENU LABEL $DIST Linux Fallback
|
||||
LINUX ../vmlinuz-$KERNEL
|
||||
APPEND root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
||||
INITRD ../initramfs-$KERNEL-fallback.img$([[ $UCODE ]] && printf "\nINITRD %s" "../${UCODE}.img")
|
||||
|
||||
#LABEL grub2
|
||||
#MENU LABEL Grub2
|
||||
#COM32 chain.c32
|
||||
#APPEND file=../grub/boot.img
|
||||
|
||||
#LABEL windows
|
||||
#MENU LABEL Windows
|
||||
#COM32 chain.c32
|
||||
#APPEND hd0 3
|
||||
|
||||
EOF
|
||||
return 0
|
||||
}
|
||||
|
||||
install_bootloader()
|
||||
{
|
||||
if ! [[ $ROOT_PART =~ /dev/mapper ]]; then
|
||||
ROOT_PART_ID="UUID=$(blkid -s PARTUUID -o value $ROOT_PART)"
|
||||
else
|
||||
if [[ $ROOT_PART == */dev/mapper* ]]; then
|
||||
ROOT_PART_ID="$ROOT_PART"
|
||||
else
|
||||
ROOT_PART_ID="UUID=$(blkid -s UUID -o value $ROOT_PART)"
|
||||
fi
|
||||
|
||||
if [[ $SYS == 'UEFI' ]]; then
|
||||
@ -1909,20 +1946,19 @@ lvm_menu()
|
||||
|
||||
local choice
|
||||
choice="$(dialog --cr-wrap --stdout --backtitle "$BT" \
|
||||
--title " $_PrepLVM " --menu "$_LvmMenu" 0 0 6 \
|
||||
--title " $_PrepLVM " --menu "$_LvmMenu" 0 0 0 \
|
||||
"$_LvmCreateVG" "vgcreate -f, lvcreate -L -n" \
|
||||
"$_LvmDelVG" "vgremove -f" \
|
||||
"$_LvMDelAll" "lvrmeove, vgremove, pvremove -f" \
|
||||
"$_Back" "Return to the main menu")"
|
||||
|
||||
case $choice in
|
||||
"$_LvmCreateVG") lvm_create && return 0 ;;
|
||||
"$_LvmCreateVG") lvm_create || return 1 ;;
|
||||
"$_LvmDelVG") lvm_del_vg ;;
|
||||
"$_LvMDelAll") lvm_del_all ;;
|
||||
*) return 0
|
||||
esac
|
||||
|
||||
lvm_menu
|
||||
return 0
|
||||
}
|
||||
|
||||
lvm_detect()
|
||||
@ -2002,7 +2038,7 @@ lvm_volume_name()
|
||||
|
||||
tput cnorm
|
||||
local name
|
||||
if ! name="$(getinput "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg" "$default" nolimit)"; then
|
||||
if ! name="$(getinput "$_LvmCreateVG (LV:$VOL_COUNT)" "\n$msg" "$default" nolimit)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -2039,7 +2075,7 @@ lvm_extra_lvs()
|
||||
get_lv_size || { break; return 1; }
|
||||
lvcreate -L "$VOLUME_SIZE" "$VOLUME_GROUP" -n "$VOLUME_NAME" >/dev/null 2>$ERR
|
||||
errshow "lvcreate -L $VOLUME_SIZE $VOLUME_GROUP -n $VOLUME_NAME"
|
||||
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$_Done LV $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2."
|
||||
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "\n$_Done Logical Volume (LV) $VOLUME_NAME ($VOLUME_SIZE) $_LvmPvDoneBody2.\n"
|
||||
(( VOL_COUNT-- ))
|
||||
done
|
||||
|
||||
@ -2103,9 +2139,7 @@ lvm_mkgroup()
|
||||
|
||||
lvm_create()
|
||||
{
|
||||
VOLUME_GROUP=""
|
||||
LVM_PARTS=()
|
||||
VGROUP_MB=0
|
||||
VOLUME_GROUP=""; LVM_PARTS=(); VGROUP_MB=0
|
||||
umount_dir $MNT
|
||||
lvm_partitions || return 1
|
||||
lvm_mkgroup || return 1
|
||||
@ -2114,10 +2148,8 @@ lvm_create()
|
||||
lvm_volume_name "$_LvmLvNameBody1 $_LvmLvNameBody2 (${VGROUP_MB}MB)" || return 1
|
||||
lvcreate -l +100%FREE "$VOLUME_GROUP" -n "$VOLUME_NAME" >/dev/null 2>$ERR
|
||||
errshow "lvcreate -l +100%FREE $VOLUME_GROUP -n $VOLUME_NAME"
|
||||
LVM='logical volume'
|
||||
tput civis
|
||||
sleep 0.5
|
||||
local msg="${_Done}$_LvmPvDoneBody1 $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VGROUP_MB}MB}) $_LvmPvDoneBody2."
|
||||
LVM='logical volume'; tput civis; sleep 0.5
|
||||
local msg="\n$_Done $_LvmPvDoneBody1 $VOLUME_GROUP-$VOLUME_NAME (${VOLUME_SIZE:-${VGROUP_MB}MB}) $_LvmPvDoneBody2.\n"
|
||||
msgbox "$_LvmCreateVG (LV:$VOL_COUNT)" "$msg\n$(lsblk -o NAME,MODEL,TYPE,FSTYPE,SIZE "${LVM_PARTS[@]}")\n"
|
||||
}
|
||||
|
||||
@ -2165,13 +2197,12 @@ luks_menu()
|
||||
"$_Back" "Return to the main menu")"
|
||||
|
||||
case $choice in
|
||||
"$_LuksEncrypt") luks_default && return 0 ;;
|
||||
"$_LuksOpen") luks_open && return 0 ;;
|
||||
"$_LuksEncryptAdv") luks_keycmd && return 0 ;;
|
||||
*) return 0
|
||||
"$_LuksEncrypt") luks_default || return 1 ;;
|
||||
"$_LuksOpen") luks_open || return 1 ;;
|
||||
"$_LuksEncryptAdv") luks_keycmd || return 1 ;;
|
||||
esac
|
||||
|
||||
luks_menu
|
||||
return 0
|
||||
}
|
||||
|
||||
luks_open()
|
||||
|
Reference in New Issue
Block a user