Various changes and tweaks
- merge select_efi_part and select_boot_part - quote paths that might be changed or contain a space - only use AUTO_BOOT_PART when not using lvm or luks - strip small/large partitions from the list for swap selection - more info during install as to what is being done - add more error checking to various places - revert the syslinux fancy menu removal - add xterm to BASE_PACKAGES, to be installed regardless - simplify the script in various places
This commit is contained in:
parent
faf132abb0
commit
536ee44062
@ -5,7 +5,7 @@
|
||||
# Some ideas and code reworked from other resources
|
||||
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
||||
|
||||
VER=2.0.82
|
||||
VER=2.0.83
|
||||
|
||||
# bulk default values {
|
||||
|
||||
@ -25,7 +25,7 @@ export DIALOGOPTS="--cr-wrap" # see `man dialog`
|
||||
|
||||
BASE_PKGS="base base-devel xorg xorg-drivers sudo git gvfs gtk3 libmad libmatroska tumbler "
|
||||
BASE_PKGS+="playerctl pulseaudio pulseaudio-alsa pavucontrol pamixer scrot xdg-user-dirs "
|
||||
BASE_PKGS+="ffmpeg gstreamer gst-libav gst-plugins-base gst-plugins-good bash-completion "
|
||||
BASE_PKGS+="ffmpeg gstreamer gst-libav gst-plugins-base gst-plugins-good bash-completion xterm"
|
||||
|
||||
AL_BASE_PKGS="archlabs-keyring archlabs-icons archlabs-fonts archlabs-themes "
|
||||
AL_BASE_PKGS+="archlabs-baph archlabs-wallpapers archlabs-scripts archlabs-skel-base"
|
||||
@ -230,10 +230,11 @@ select_show()
|
||||
---------- PARTITION CONFIGURATION ------------
|
||||
|
||||
Root Part: $ROOT_PART
|
||||
Boot Part: ${BOOT_PART:-${BOOT_DEV:-none}}
|
||||
Boot Part: ${BOOT_PART:-none}
|
||||
Boot Device: ${BOOT_DEV:-none}
|
||||
Swap Part/File: ${SWAP_PART:-none}
|
||||
Swap Size: ${SWAP_SIZE:-none}
|
||||
Extra Mounts: ${EXMNTS:-${EXMNT:-none}}
|
||||
Extra Mounts: ${EXMNTS:-none}
|
||||
Mkinit Hooks: ${HOOKS:-none}
|
||||
|
||||
LVM used: ${LVM:-none}
|
||||
@ -531,7 +532,6 @@ select_packages()
|
||||
xed "A small and lightweight text editor. X-Apps Project." "$(ofn xed "${USER_PKGS[*]}")" \
|
||||
xfce4-terminal "A terminal emulator based in the Xfce Desktop Environment" "$(ofn xfce4-terminal "${USER_PKGS[*]}")" \
|
||||
xreader "Document viewer for files like PDF and Postscript. X-Apps Project." "$(ofn xed "${USER_PKGS[*]}")" \
|
||||
xterm "The standard terminal emulator for the X window system" "$(ofn xterm "${USER_PKGS[*]}")" \
|
||||
zathura "Minimalistic document viewer" "$(ofn zathura "${USER_PKGS[*]}")"
|
||||
|
||||
if [[ $USER_PKGS ]]; then # add any needed PKG_EXT to the list
|
||||
@ -553,7 +553,7 @@ part_menu()
|
||||
no_bg_install || return 0
|
||||
local device choice devhash
|
||||
devhash="$(lsblk -f | base64)"
|
||||
umount_dir $MNT
|
||||
umount_dir "$MNT"
|
||||
part_device || return 1
|
||||
device="$DEVICE"
|
||||
|
||||
@ -674,10 +674,10 @@ part_shrink()
|
||||
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
|
||||
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
|
||||
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")
|
||||
@ -729,38 +729,25 @@ part_find()
|
||||
{
|
||||
local regexp="$1" err=''
|
||||
|
||||
# string of partitions as /TYPE/PART SIZE
|
||||
# string of partitions as /TYPE/PART SIZE.. eg. /dev/sda1 256G
|
||||
if [[ $IGNORE_DEV ]]; then
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$regexp/"' && !'"/$IGNORE_DEV/"' {
|
||||
sub(/^part/, "/dev/")
|
||||
sub(/^lvm|^crypt/, "/dev/mapper/")
|
||||
print $1$2, $3
|
||||
}')"
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$regexp/"' && !'"/$IGNORE_DEV/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2, $3}')"
|
||||
else
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
||||
awk "/$regexp/"' {
|
||||
sub(/^part/, "/dev/")
|
||||
sub(/^lvm|^crypt/, "/dev/mapper/")
|
||||
print $1$2 " " $3
|
||||
}')"
|
||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$regexp/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||
fi
|
||||
|
||||
# number of partitions total
|
||||
COUNT=0
|
||||
while read -r line; do
|
||||
(( COUNT++ ))
|
||||
done <<< "$PARTS"
|
||||
|
||||
# ensure we have enough partitions for the system and action type
|
||||
case "$str" in
|
||||
# ensure we have enough partitions for the system and action were trying to do
|
||||
COUNT=$(wc -l <<< "$PARTS")
|
||||
case "$regexp" in
|
||||
'part|lvm|crypt') [[ $COUNT -lt 1 || ($SYS == 'UEFI' && $COUNT -lt 2) ]] && err="$_errpart" ;;
|
||||
'part|crypt') (( COUNT < 1 )) && err="$_lvmerr" ;;
|
||||
'part|lvm') (( COUNT < 2 )) && err="$_lukserr" ;;
|
||||
esac
|
||||
|
||||
# if there aren't enough partitions show the relevant error message
|
||||
[[ $err ]] && { msg "Not Enough Partitions" "$err" 2; return 1; }
|
||||
if [[ $err ]]; then
|
||||
msg "Not Enough Partitions" "$err" 2
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -917,38 +904,37 @@ mount_menu()
|
||||
{
|
||||
no_bg_install || return 0
|
||||
lvm_detect
|
||||
umount_dir $MNT
|
||||
umount_dir "$MNT"
|
||||
part_find 'part|lvm|crypt' || { SEL=2; return 1; }
|
||||
|
||||
[[ $LUKS && $LUKS_PART ]] && part_countdec $LUKS_PART
|
||||
[[ $LVM && $LVM_PARTS ]] && part_countdec $LVM_PARTS
|
||||
|
||||
select_root_partition || return 1
|
||||
|
||||
if [[ $SYS == 'UEFI' ]]; then
|
||||
select_efi_partition || { BOOT_PART=''; return 1; }
|
||||
elif (( COUNT > 0 )); then
|
||||
select_root_partition || { ROOT_PART=''; return 1; }
|
||||
select_boot_partition || { BOOT_PART=''; return 1; }
|
||||
fi
|
||||
|
||||
if [[ $BOOT_PART ]]; then
|
||||
part_mount "$BOOT_PART" "/$BOOTDIR" && SEP_BOOT=true || return 1
|
||||
part_bootdev
|
||||
fi
|
||||
|
||||
select_swap || return 1
|
||||
select_extra_partitions || return 1
|
||||
install_background
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
select_swap()
|
||||
{
|
||||
local pts dev size isize
|
||||
|
||||
while read -r dev size; do # walk partition list and skip ones that are too small/big for swap
|
||||
size_t="${size: -1:1}"
|
||||
isize=${size:0:-1}
|
||||
isize=${isize%.*}
|
||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 16) || ($size_t == 'M' && $isize -lt 100) ]] || pts+="$dev $size "
|
||||
done <<< "$PARTS"
|
||||
|
||||
dlg SWAP_PART menu "Swap Setup" "\nSelect whether to use a swapfile, swap partition, or none." \
|
||||
"none" "Don't allocate any swap space" \
|
||||
"swapfile" "Allocate $SYS_MEM at /swapfile" \
|
||||
$PARTS
|
||||
$pts
|
||||
|
||||
if [[ -z $SWAP_PART || $SWAP_PART == "none" ]]; then
|
||||
SWAP_PART=''
|
||||
@ -1027,81 +1013,53 @@ select_filesystem()
|
||||
part_format "$part" "$fs" 0
|
||||
}
|
||||
|
||||
select_efi_partition()
|
||||
{
|
||||
if [[ -z $BOOT_PART ]]; then
|
||||
if [[ $AUTO_BOOT_PART ]]; then
|
||||
BOOT_PART="$AUTO_BOOT_PART"
|
||||
return 0 # were done here
|
||||
else
|
||||
local pts size dev isize bsize ptcount=0
|
||||
|
||||
# walk partition list and skip ones that are too small/big for boot
|
||||
while read -r dev size; do
|
||||
size_t="${size: -1:1}" # size type eg. K, M, G, T
|
||||
isize=${size:0:-1} # remove trailing size type character
|
||||
isize=${isize%.*} # remove any decimal (round down)
|
||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||
done <<< "$PARTS"
|
||||
|
||||
if (( ptcount == 1 )); then
|
||||
msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1
|
||||
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
|
||||
else
|
||||
dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
else
|
||||
part_format "$BOOT_PART" "vfat" 2
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
select_boot_partition()
|
||||
{
|
||||
if [[ -z $BOOT_PART ]]; then
|
||||
if [[ $AUTO_BOOT_PART && ! $LVM ]]; then
|
||||
BOOT_PART="$AUTO_BOOT_PART"
|
||||
return 0 # were done here
|
||||
else
|
||||
local pts size dev isize bsize ptcount=0
|
||||
local pts dev size isize ptcount=0
|
||||
|
||||
# walk partition list and skip ones that are too small/big for boot
|
||||
while read -r dev size; do
|
||||
size_t="${size: -1:1}" # size type eg. K, M, G, T
|
||||
isize=${size:0:-1} # remove trailing size type character
|
||||
isize=${isize%.*} # remove any decimal (round down)
|
||||
if [[ -z $BOOT_PART ]]; then
|
||||
if [[ $AUTO_BOOT_PART && -z $LVM && -z $LUKS ]]; then
|
||||
BOOT_PART="$AUTO_BOOT_PART"
|
||||
return 0
|
||||
else
|
||||
while read -r dev size; do # walk partition list and skip ones that are too small/big for boot
|
||||
size_t="${size: -1:1}"
|
||||
isize=${size:0:-1}
|
||||
isize=${isize%.*}
|
||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||
done <<< "$PARTS"
|
||||
|
||||
case "$SYS" in
|
||||
UEFI)
|
||||
case "$ptcount" in
|
||||
0) msg "EFI Boot Partition" "\nNo partitions available that meet size requirements!!\n\nReturning to the main menu.\n" 2; return 1 ;;
|
||||
1) msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1; BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")" ;;
|
||||
*) dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts ;;
|
||||
esac
|
||||
[[ $BOOT_PART ]] || return 1
|
||||
;;
|
||||
BIOS)
|
||||
(( ptcount == 0 )) && return 0
|
||||
if [[ $LUKS && ! $LVM ]]; then
|
||||
dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
|
||||
[[ $BOOT_PART ]] || return 1
|
||||
else
|
||||
dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "don't use a separate boot" $pts
|
||||
dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "no separate boot" $pts
|
||||
[[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
||||
local txt="\nIMPORTANT:\n\nThe boot partition $BOOT_PART $_format"
|
||||
if yesno "Format Boot Partition" "$txt" "Format $BOOT_PART" "Skip Formatting" 1; then
|
||||
part_format "$BOOT_PART" "ext4" 2
|
||||
fi
|
||||
else
|
||||
part_format "$BOOT_PART" "ext4" 2
|
||||
if ([[ $SYS == 'BIOS' ]] && grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")") || ([[ $SYS == 'UEFI' ]] && grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"); then
|
||||
yesno "Format Boot Partition" "\nIMPORTANT:\n\nThe boot partition $BOOT_PART $_format" "Format $BOOT_PART" "Skip Formatting" 1 || return 0
|
||||
fi
|
||||
|
||||
case "$SYS" in
|
||||
UEFI) part_format "$BOOT_PART" "vfat" 2 || return 1 ;;
|
||||
BIOS) part_format "$BOOT_PART" "ext4" 2 || return 1 ;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -1114,7 +1072,7 @@ select_root_partition()
|
||||
part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
|
||||
return 0 # we're done here
|
||||
else
|
||||
local pts size dev isize bsize ptcount=0
|
||||
local pts dev size isize ptcount=0
|
||||
|
||||
# walk partition list and skip ones that are too small for / (root)
|
||||
while read -r dev size; do
|
||||
@ -1142,7 +1100,7 @@ select_root_partition()
|
||||
|
||||
select_extra_partitions()
|
||||
{
|
||||
local part size dev
|
||||
local part dev size
|
||||
|
||||
# walk partition list and skip ones that are too small to be usable
|
||||
while read -r dev size; do
|
||||
@ -1156,7 +1114,7 @@ select_extra_partitions()
|
||||
break
|
||||
elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then
|
||||
EXMNTS+="$part: $EXMNT "
|
||||
[[ $EXMNT == '/usr' && $HOOKS != *usr* ]] && HOOKS="usr $HOOKS"
|
||||
[[ $EXMNT == '/usr' && $HOOKS != *usr* ]] && HOOKS+=" usr"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
@ -1172,9 +1130,9 @@ select_extra_partitions()
|
||||
install_main()
|
||||
{
|
||||
install_base
|
||||
genfstab -U $MNT >$MNT/etc/fstab 2>$ERR 2>&1
|
||||
genfstab -U "$MNT" >"$MNT/etc/fstab" 2>$ERR 2>&1
|
||||
errshow 1 "genfstab -U $MNT >$MNT/etc/fstab"
|
||||
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" $MNT/etc/fstab
|
||||
[[ -f $MNT/swapfile ]] && sed -i "s~${MNT}~~" "$MNT/etc/fstab"
|
||||
install_packages
|
||||
install_mkinitcpio
|
||||
install_boot
|
||||
@ -1225,18 +1183,19 @@ install_base()
|
||||
trap - EXIT
|
||||
unset BG_PID
|
||||
|
||||
rm -rf $MNT/etc/mkinitcpio-archiso.conf
|
||||
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -delete
|
||||
sed -i 's/#\(Storage=\)volatile/\1auto/' $MNT/etc/systemd/journald.conf
|
||||
find $MNT/boot -name '*-ucode.img' -delete
|
||||
rm -rf "$MNT/etc/mkinitcpio-archiso.conf"
|
||||
find "$MNT/usr/lib/initcpio" -name 'archiso*' -type f -delete
|
||||
sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf"
|
||||
find "$MNT/boot" -name '*-ucode.img' -delete
|
||||
|
||||
[[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" $MNT/etc/{lsb-release,os-release}
|
||||
[[ $DIST != "ArchLabs" ]] || sed -i "s/ArchLabs/$DIST/g" "$MNT/etc/"{lsb-release,os-release}
|
||||
|
||||
if [[ $VM ]]; then
|
||||
find $MNT/etc/X11/xorg.conf.d/ -name '*.conf' -delete
|
||||
echo "Virtual machine detected, removing xorg configs"
|
||||
find "$MNT/etc/X11/xorg.conf.d/" -name '*.conf' -delete -printf "remove %p\n"
|
||||
elif lspci | grep ' VGA ' | grep -q 'Intel'; then
|
||||
echo "Creating Intel Tear Free config /etc/X11/xorg.conf.d/20-intel.conf"
|
||||
cat > $MNT/etc/X11/xorg.conf.d/20-intel.conf <<- EOF
|
||||
cat > "$MNT/etc/X11/xorg.conf.d/20-intel.conf" <<- EOF
|
||||
Section "Device"
|
||||
Identifier "Intel Graphics"
|
||||
Driver "intel"
|
||||
@ -1245,7 +1204,7 @@ install_base()
|
||||
EOF
|
||||
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX'; then # newer RX cards can use the amdgpu driver
|
||||
echo "Creating AMD Tear Free config /etc/X11/xorg.conf.d/20-amdgpu.conf"
|
||||
cat > $MNT/etc/X11/xorg.conf.d/20-amdgpu.conf <<- EOF
|
||||
cat > "$MNT/etc/X11/xorg.conf.d/20-amdgpu.conf" <<- EOF
|
||||
Section "Device"
|
||||
Identifier "AMD Graphics"
|
||||
Driver "amdgpu"
|
||||
@ -1254,7 +1213,7 @@ install_base()
|
||||
EOF
|
||||
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*HD [2-6][0-9]*'; then # older HD 2xxx-6xxx cards must use the radeon driver
|
||||
echo "Creating Radeon Tear Free config /etc/X11/xorg.conf.d/20-radeon.conf"
|
||||
cat > $MNT/etc/X11/xorg.conf.d/20-radeon.conf <<- EOF
|
||||
cat > "$MNT/etc/X11/xorg.conf.d/20-radeon.conf" <<- EOF
|
||||
Section "Device"
|
||||
Identifier "AMD Graphics"
|
||||
Driver "radeon"
|
||||
@ -1263,18 +1222,21 @@ install_base()
|
||||
EOF
|
||||
fi
|
||||
|
||||
[[ -e /run/archiso/sfs/airootfs ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
|
||||
[[ -d /etc/netctl ]] && cp -rfv /etc/netctl $MNT/etc/
|
||||
[[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf $MNT/etc/
|
||||
[[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
|
||||
if [[ -e /run/archiso/sfs/airootfs ]]; then
|
||||
cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2>$ERR 2>&1
|
||||
errshow 1 "cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux"
|
||||
fi
|
||||
[[ -d /etc/netctl ]] && cp -rfv /etc/netctl "$MNT/etc/"
|
||||
[[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf "$MNT/etc/"
|
||||
[[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections "$MNT/etc/NetworkManager/"
|
||||
|
||||
echo "LANG=$MYLOCALE" > $MNT/etc/locale.conf
|
||||
cp -fv $MNT/etc/locale.conf $MNT/etc/default/locale
|
||||
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${MYLOCALE}/${MYLOCALE}/g" $MNT/etc/locale.gen
|
||||
echo "LANG=$MYLOCALE" > "$MNT/etc/locale.conf"
|
||||
cp -fv "$MNT/etc/locale.conf" "$MNT/etc/default/locale"
|
||||
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${MYLOCALE}/${MYLOCALE}/g" "$MNT/etc/locale.gen"
|
||||
chrun "locale-gen"
|
||||
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime"
|
||||
|
||||
cat > $MNT/etc/X11/xorg.conf.d/00-keyboard.conf <<- EOF
|
||||
cat > "$MNT/etc/X11/xorg.conf.d/00-keyboard.conf" <<- EOF
|
||||
# Use localectl(1) to instruct systemd-localed to update it.
|
||||
Section "InputClass"
|
||||
Identifier "system-keyboard"
|
||||
@ -1283,7 +1245,7 @@ install_base()
|
||||
EndSection
|
||||
EOF
|
||||
|
||||
cat > $MNT/etc/default/keyboard <<- EOF
|
||||
cat > "$MNT/etc/default/keyboard" <<- EOF
|
||||
# KEYBOARD CONFIGURATION FILE
|
||||
# Consult the keyboard(5) manual page.
|
||||
XKBMODEL=""
|
||||
@ -1292,9 +1254,9 @@ install_base()
|
||||
XKBOPTIONS=""
|
||||
BACKSPACE="guess"
|
||||
EOF
|
||||
printf "KEYMAP=%s\nFONT=%s\n" "$CMAP" "$FONT" > $MNT/etc/vconsole.conf
|
||||
echo "$MYHOST" > $MNT/etc/hostname
|
||||
cat > $MNT/etc/hosts <<- EOF
|
||||
printf "KEYMAP=%s\nFONT=%s\n" "$CMAP" "$FONT" > "$MNT/etc/vconsole.conf"
|
||||
echo "$MYHOST" > "$MNT/etc/hostname"
|
||||
cat > "$MNT/etc/hosts" <<- EOF
|
||||
127.0.0.1 localhost
|
||||
127.0.1.1 $MYHOST
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
@ -1317,8 +1279,9 @@ install_boot()
|
||||
|
||||
if [[ $SYS == 'UEFI' ]]; then
|
||||
# remove our old install and generic BOOT/ dir
|
||||
find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname "$DIST" -type d -delete
|
||||
find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname 'BOOT' -type d -delete
|
||||
echo "Removing conflicting boot directories"
|
||||
find "$MNT/$BOOTDIR/EFI/" -maxdepth 1 -mindepth 1 -iname "$DIST" -type d -delete -printf "remove %p\n"
|
||||
find "$MNT/$BOOTDIR/EFI/" -maxdepth 1 -mindepth 1 -iname 'BOOT' -type d -delete -printf "remove %p\n"
|
||||
fi
|
||||
|
||||
prerun_$BOOTLDR
|
||||
@ -1328,18 +1291,18 @@ install_boot()
|
||||
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
|
||||
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/$BOOTDIR/EFI/BOOT
|
||||
mkdir -pv "$MNT/$BOOTDIR/EFI/BOOT"
|
||||
case "$BOOTLDR" in
|
||||
grub) cp -fv $MNT/$BOOTDIR/EFI/$DIST/grubx64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI ;;
|
||||
syslinux) cp -rf "$MNT/$BOOTDIR/EFI/syslinux/"* $MNT/$BOOTDIR/EFI/BOOT/ && cp -f $MNT/$BOOTDIR/EFI/syslinux/syslinux.efi $MNT/$BOOTDIR/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/$BOOTDIR/EFI/refind/refind.conf
|
||||
cp -fv $MNT/$BOOTDIR/EFI/refind/refind_x64.efi $MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI ;;
|
||||
grub) cp -fv "$MNT/$BOOTDIR/EFI/$DIST/grubx64.efi" "$MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI" ;;
|
||||
syslinux) cp -rf "$MNT/$BOOTDIR/EFI/syslinux/"* "$MNT/$BOOTDIR/EFI/BOOT/" && cp -f "$MNT/$BOOTDIR/EFI/syslinux/syslinux.efi" "$MNT/$BOOTDIR/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/$BOOTDIR/EFI/refind/refind.conf"
|
||||
cp -fv "$MNT/$BOOTDIR/EFI/refind/refind_x64.efi" "$MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@ -1350,7 +1313,7 @@ install_user()
|
||||
{
|
||||
local groups='audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel'
|
||||
|
||||
rm -f $MNT/root/.zshrc # remove welcome message from root zshrc
|
||||
rm -f "$MNT/root/.zshrc" # remove welcome message from root zshrc
|
||||
|
||||
chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR 2>&1
|
||||
errshow 1 "set root password"
|
||||
@ -1397,8 +1360,8 @@ install_login()
|
||||
case $LOGIN_TYPE in
|
||||
ly|sddm|gdm|lightdm)
|
||||
if [[ $LOGIN_WM == *dwm* ]]; then # dwm doesn't include an xsession file for display managers
|
||||
mkdir -p $MNT/usr/share/xsessions
|
||||
cat >$MNT/usr/share/xsessions/dwm.desktop <<- EOF
|
||||
mkdir -p "$MNT/usr/share/xsessions"
|
||||
cat >"$MNT/usr/share/xsessions/dwm.desktop" <<- EOF
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Dwm
|
||||
@ -1434,9 +1397,13 @@ install_login()
|
||||
|
||||
install_packages()
|
||||
{
|
||||
local rmpkg="archlabs-installer "
|
||||
local rmpkg=""
|
||||
local inpkg="$PACKAGES $USER_PKGS $AL_BASE_PKGS "
|
||||
|
||||
if pacman -Qq archlabs-installer >/dev/null 2>&1; then
|
||||
rmpkg+="archlabs-installer "
|
||||
fi
|
||||
|
||||
if [[ $MYSHELL == 'zsh' ]]; then
|
||||
inpkg+="zsh-completions "
|
||||
else
|
||||
@ -1448,7 +1415,6 @@ install_packages()
|
||||
else
|
||||
[[ $INSTALL_WMS =~ (plasma|gnome|cinnamon) ]] || inpkg+="archlabs-ksuperkey "
|
||||
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox) ]] && inpkg+="$WM_BASE_PKGS "
|
||||
[[ $inpkg =~ (term|plasma|rxvt|tilda|tilix|sakura) || $INSTALL_WMS =~ (gnome|plasma|xfce4) ]] || inpkg+="xterm "
|
||||
fi
|
||||
|
||||
# update and install crucial packages first to avoid issues
|
||||
@ -1456,7 +1422,7 @@ install_packages()
|
||||
errshow 1 "pacman -Syyu $KERNEL $BASE_PKGS ${LOGIN_PKGS[$LOGIN_TYPE]} $MYSHELL --noconfirm --needed"
|
||||
|
||||
# remove the packages we don't want on the installed system
|
||||
chrun "pacman -Rnsc $rmpkg --noconfirm"
|
||||
[[ $rmpkg ]] && chrun "pacman -Rnsc $rmpkg --noconfirm"
|
||||
|
||||
# reinstalling iputils fixes the network issue for non-root users
|
||||
chrun "pacman -S iputils $UCODE --noconfirm"
|
||||
@ -1479,7 +1445,7 @@ install_packages()
|
||||
fi
|
||||
|
||||
# allow members of the wheel group to run commands as root
|
||||
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" $MNT/etc/sudoers
|
||||
sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" "$MNT/etc/sudoers"
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -1489,7 +1455,7 @@ install_mkinitcpio()
|
||||
local add=''
|
||||
[[ $LUKS ]] && add="encrypt"
|
||||
[[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; }
|
||||
sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" $MNT/etc/mkinitcpio.conf
|
||||
sed -i "s/block filesystems/block ${add} filesystems ${HOOKS}/g" "$MNT/etc/mkinitcpio.conf"
|
||||
chrun "mkinitcpio -p $KERNEL" 2>$ERR 2>&1
|
||||
errshow 1 "mkinitcpio -p $KERNEL"
|
||||
}
|
||||
@ -1524,7 +1490,7 @@ install_mirrorlist()
|
||||
|
||||
install_background()
|
||||
{
|
||||
( rsync -a /run/archiso/sfs/airootfs/ $MNT/ && install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" >/dev/null 2>&1 ) &
|
||||
( rsync -a /run/archiso/sfs/airootfs/ "$MNT/" && install_mirrorlist "$MNT/etc/pacman.d/mirrorlist" >/dev/null 2>&1 ) &
|
||||
BG_PID=$!
|
||||
trap "kill $BG_PID 2>/dev/null" EXIT
|
||||
}
|
||||
@ -1562,7 +1528,7 @@ install_suckless()
|
||||
|
||||
lightdm_config()
|
||||
{
|
||||
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf <<- EOF
|
||||
cat > "$MNT/etc/lightdm/lightdm-gtk-greeter.conf" <<- EOF
|
||||
[greeter]
|
||||
default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
|
||||
background=/usr/share/backgrounds/archlabs/archlabs.jpg
|
||||
@ -1619,22 +1585,22 @@ 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
|
||||
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
|
||||
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"
|
||||
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
|
||||
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"
|
||||
fi
|
||||
|
||||
# setup for os-prober module
|
||||
mkdir -p /run/{lvm,udev} $MNT/hostrun/{lvm,udev}
|
||||
mount --bind /run/lvm $MNT/hostrun/lvm
|
||||
mount --bind /run/udev $MNT/hostrun/udev
|
||||
mkdir -p /run/{lvm,udev} "$MNT/hostrun/"{lvm,udev}
|
||||
mount --bind /run/lvm "$MNT/hostrun/lvm"
|
||||
mount --bind /run/udev "$MNT/hostrun/udev"
|
||||
|
||||
return 0
|
||||
}
|
||||
@ -1664,18 +1630,47 @@ setup_syslinux()
|
||||
|
||||
prerun_syslinux()
|
||||
{
|
||||
local c="$MNT/boot/syslinux" s="/usr/lib/syslinux/bios" d=".."
|
||||
[[ $SYS == 'UEFI' ]] && { c="$MNT/boot/EFI/syslinux"; s="/usr/lib/syslinux/efi64"; d=''; }
|
||||
|
||||
mkdir -pv "$c"
|
||||
cp -rfv "$s/"* "$c/"
|
||||
local c="$MNT/boot/syslinux"
|
||||
local s="/usr/lib/syslinux/bios"
|
||||
local d=".."
|
||||
if [[ $SYS == 'UEFI' ]]; then
|
||||
c="$MNT/boot/EFI/syslinux"
|
||||
s="/usr/lib/syslinux/efi64"
|
||||
d='';
|
||||
fi
|
||||
mkdir -pv "$c" 2>$ERR 2>&1
|
||||
errshow 1 "mkdir -pv $c"
|
||||
cp -rfv "$s/"* "$c/" 2>$ERR 2>&1
|
||||
errshow 1 "cp -rfv $s/* $c/"
|
||||
cp -fv "$RUN/syslinux/splash.png" "$c/" 2>$ERR 2>&1
|
||||
errshow 0 "cp -fv $RUN/syslinux/splash.png $c/"
|
||||
cat > "$c/syslinux.cfg" <<- EOF
|
||||
UI menu.c32
|
||||
PROMPT 0
|
||||
UI vesamenu.c32
|
||||
MENU TITLE $DIST Boot Menu
|
||||
MENU BACKGROUND splash.png
|
||||
TIMEOUT 50
|
||||
DEFAULT $DIST
|
||||
|
||||
# see: https://www.syslinux.org/wiki/index.php/Comboot/menu.c32
|
||||
MENU WIDTH 78
|
||||
MENU MARGIN 4
|
||||
MENU ROWS 4
|
||||
MENU VSHIFT 10
|
||||
MENU TIMEOUTROW 13
|
||||
MENU TABMSGROW 14
|
||||
MENU CMDLINEROW 14
|
||||
MENU HELPMSGROW 16
|
||||
MENU HELPMSGENDROW 29
|
||||
MENU COLOR border 30;44 #40ffffff #a0000000 std
|
||||
MENU COLOR title 1;36;44 #9033ccff #a0000000 std
|
||||
MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
|
||||
MENU COLOR unsel 37;44 #50ffffff #a0000000 std
|
||||
MENU COLOR help 37;40 #c0ffffff #a0000000 std
|
||||
MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
|
||||
MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
|
||||
MENU COLOR msg07 37;40 #90ffffff #a0000000 std
|
||||
MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
|
||||
|
||||
LABEL $DIST
|
||||
MENU LABEL $DIST Linux
|
||||
LINUX $d/vmlinuz-$KERNEL
|
||||
@ -1699,7 +1694,7 @@ setup_refind-efi()
|
||||
|
||||
prerun_refind-efi()
|
||||
{
|
||||
cat > $MNT/boot/refind_linux.conf <<- EOF
|
||||
cat > "$MNT/boot/refind_linux.conf" <<- EOF
|
||||
"$DIST Linux" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
|
||||
printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
|
||||
printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL.img"
|
||||
@ -1707,8 +1702,8 @@ 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
|
||||
mkdir -p "$MNT/etc/pacman.d/hooks"
|
||||
cat > "$MNT/etc/pacman.d/hooks/refind.hook" <<- EOF
|
||||
[Trigger]
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
@ -1729,26 +1724,26 @@ setup_systemd-boot()
|
||||
|
||||
prerun_systemd-boot()
|
||||
{
|
||||
mkdir -p $MNT/boot/loader/entries
|
||||
cat > $MNT/boot/loader/loader.conf <<- EOF
|
||||
mkdir -p "$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
|
||||
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_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
||||
EOF
|
||||
cat > $MNT/boot/loader/entries/$DIST-fallback.conf <<- 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_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
||||
EOF
|
||||
mkdir -p $MNT/etc/pacman.d/hooks
|
||||
cat > $MNT/etc/pacman.d/hooks/systemd-boot.hook <<- EOF
|
||||
mkdir -p "$MNT/etc/pacman.d/hooks"
|
||||
cat > "$MNT/etc/pacman.d/hooks/systemd-boot.hook" <<- EOF
|
||||
[Trigger]
|
||||
Type = Package
|
||||
Operation = Upgrade
|
||||
@ -1807,7 +1802,7 @@ lvm_detect()
|
||||
lvm_create()
|
||||
{
|
||||
VGROUP='' LVM_PARTS='' VGROUP_MB=0
|
||||
umount_dir $MNT
|
||||
umount_dir "$MNT"
|
||||
lvm_mkgroup || return 1
|
||||
local txt="\nThe last (or only) logical volume will automatically use all remaining space in the volume group."
|
||||
dlg VOL_COUNT menu "$_lvmnew" "\nSelect the number of logical volumes (LVs) to create in: $VGROUP\n$txt" 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -
|
||||
@ -2002,7 +1997,7 @@ luks_menu()
|
||||
luks_open()
|
||||
{
|
||||
modprobe -a dm-mod dm_crypt >/dev/null 2>&1
|
||||
umount_dir $MNT
|
||||
umount_dir "$MNT"
|
||||
part_find 'part|crypt|lvm' || return 1
|
||||
|
||||
if (( COUNT == 1 )); then
|
||||
@ -2059,7 +2054,7 @@ luks_show()
|
||||
luks_setup()
|
||||
{
|
||||
modprobe -a dm-mod dm_crypt >/dev/null 2>&1
|
||||
umount_dir $MNT
|
||||
umount_dir "$MNT"
|
||||
part_find 'part|lvm' || return 1
|
||||
|
||||
if [[ $AUTO_ROOT_PART ]]; then
|
||||
@ -2121,7 +2116,7 @@ die()
|
||||
trap - INT
|
||||
tput cnorm
|
||||
if [[ -d $MNT ]]; then
|
||||
umount_dir $MNT
|
||||
umount_dir "$MNT"
|
||||
if (( e == 127 )); then
|
||||
umount_dir /run/archiso/bootmnt && sleep 0.5 && reboot -f
|
||||
fi
|
||||
@ -2479,6 +2474,7 @@ elif ! net_connect; then
|
||||
msg "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n" 2
|
||||
die 1
|
||||
fi
|
||||
EXMNTS=""
|
||||
FORMATTED=""
|
||||
|
||||
while :; do
|
||||
|
Reference in New Issue
Block a user