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
|
# Some ideas and code reworked from other resources
|
||||||
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
||||||
|
|
||||||
VER=2.0.82
|
VER=2.0.83
|
||||||
|
|
||||||
# bulk default values {
|
# 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="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+="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-keyring archlabs-icons archlabs-fonts archlabs-themes "
|
||||||
AL_BASE_PKGS+="archlabs-baph archlabs-wallpapers archlabs-scripts archlabs-skel-base"
|
AL_BASE_PKGS+="archlabs-baph archlabs-wallpapers archlabs-scripts archlabs-skel-base"
|
||||||
@ -230,10 +230,11 @@ select_show()
|
|||||||
---------- PARTITION CONFIGURATION ------------
|
---------- PARTITION CONFIGURATION ------------
|
||||||
|
|
||||||
Root Part: $ROOT_PART
|
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 Part/File: ${SWAP_PART:-none}
|
||||||
Swap Size: ${SWAP_SIZE:-none}
|
Swap Size: ${SWAP_SIZE:-none}
|
||||||
Extra Mounts: ${EXMNTS:-${EXMNT:-none}}
|
Extra Mounts: ${EXMNTS:-none}
|
||||||
Mkinit Hooks: ${HOOKS:-none}
|
Mkinit Hooks: ${HOOKS:-none}
|
||||||
|
|
||||||
LVM used: ${LVM:-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[*]}")" \
|
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[*]}")" \
|
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[*]}")" \
|
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[*]}")"
|
zathura "Minimalistic document viewer" "$(ofn zathura "${USER_PKGS[*]}")"
|
||||||
|
|
||||||
if [[ $USER_PKGS ]]; then # add any needed PKG_EXT to the list
|
if [[ $USER_PKGS ]]; then # add any needed PKG_EXT to the list
|
||||||
@ -553,7 +553,7 @@ part_menu()
|
|||||||
no_bg_install || return 0
|
no_bg_install || return 0
|
||||||
local device choice devhash
|
local device choice devhash
|
||||||
devhash="$(lsblk -f | base64)"
|
devhash="$(lsblk -f | base64)"
|
||||||
umount_dir $MNT
|
umount_dir "$MNT"
|
||||||
part_device || return 1
|
part_device || return 1
|
||||||
device="$DEVICE"
|
device="$DEVICE"
|
||||||
|
|
||||||
@ -674,10 +674,10 @@ part_shrink()
|
|||||||
num="${part: -1}"
|
num="${part: -1}"
|
||||||
end=$(parted -s "$device" unit KiB print | awk '/^\s*'"$num"'/ {print $3}') # part size in KiB
|
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
|
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}')
|
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)}')
|
max=$(df --output=avail --block-size=MiB "$part" | awk 'NR == 2 {print int($1)}')
|
||||||
umount_dir $MNT
|
umount_dir "$MNT"
|
||||||
tput cnorm
|
tput cnorm
|
||||||
if dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Resize: $part " --rangebox "$_resize" 17 "$COLUMNS" "$min" "$max" $((max / 2)) 2>$ANS; then
|
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=$(< "$ANS")
|
||||||
@ -729,38 +729,25 @@ part_find()
|
|||||||
{
|
{
|
||||||
local regexp="$1" err=''
|
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
|
if [[ $IGNORE_DEV ]]; then
|
||||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$regexp/"' && !'"/$IGNORE_DEV/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2, $3}')"
|
||||||
awk "/$regexp/"' && !'"/$IGNORE_DEV/"' {
|
|
||||||
sub(/^part/, "/dev/")
|
|
||||||
sub(/^lvm|^crypt/, "/dev/mapper/")
|
|
||||||
print $1$2, $3
|
|
||||||
}')"
|
|
||||||
else
|
else
|
||||||
PARTS="$(lsblk -lno TYPE,NAME,SIZE |
|
PARTS="$(lsblk -lno TYPE,NAME,SIZE | awk "/$regexp/"' {sub(/^part/, "/dev/"); sub(/^lvm|^crypt/, "/dev/mapper/"); print $1$2 " " $3}')"
|
||||||
awk "/$regexp/"' {
|
|
||||||
sub(/^part/, "/dev/")
|
|
||||||
sub(/^lvm|^crypt/, "/dev/mapper/")
|
|
||||||
print $1$2 " " $3
|
|
||||||
}')"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# number of partitions total
|
# ensure we have enough partitions for the system and action were trying to do
|
||||||
COUNT=0
|
COUNT=$(wc -l <<< "$PARTS")
|
||||||
while read -r line; do
|
case "$regexp" in
|
||||||
(( COUNT++ ))
|
|
||||||
done <<< "$PARTS"
|
|
||||||
|
|
||||||
# ensure we have enough partitions for the system and action type
|
|
||||||
case "$str" in
|
|
||||||
'part|lvm|crypt') [[ $COUNT -lt 1 || ($SYS == 'UEFI' && $COUNT -lt 2) ]] && err="$_errpart" ;;
|
'part|lvm|crypt') [[ $COUNT -lt 1 || ($SYS == 'UEFI' && $COUNT -lt 2) ]] && err="$_errpart" ;;
|
||||||
'part|crypt') (( COUNT < 1 )) && err="$_lvmerr" ;;
|
'part|crypt') (( COUNT < 1 )) && err="$_lvmerr" ;;
|
||||||
'part|lvm') (( COUNT < 2 )) && err="$_lukserr" ;;
|
'part|lvm') (( COUNT < 2 )) && err="$_lukserr" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# if there aren't enough partitions show the relevant error message
|
if [[ $err ]]; then
|
||||||
[[ $err ]] && { msg "Not Enough Partitions" "$err" 2; return 1; }
|
msg "Not Enough Partitions" "$err" 2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -917,38 +904,37 @@ mount_menu()
|
|||||||
{
|
{
|
||||||
no_bg_install || return 0
|
no_bg_install || return 0
|
||||||
lvm_detect
|
lvm_detect
|
||||||
umount_dir $MNT
|
umount_dir "$MNT"
|
||||||
part_find 'part|lvm|crypt' || { SEL=2; return 1; }
|
part_find 'part|lvm|crypt' || { SEL=2; return 1; }
|
||||||
|
|
||||||
[[ $LUKS && $LUKS_PART ]] && part_countdec $LUKS_PART
|
[[ $LUKS && $LUKS_PART ]] && part_countdec $LUKS_PART
|
||||||
[[ $LVM && $LVM_PARTS ]] && part_countdec $LVM_PARTS
|
[[ $LVM && $LVM_PARTS ]] && part_countdec $LVM_PARTS
|
||||||
|
select_root_partition || { ROOT_PART=''; return 1; }
|
||||||
select_root_partition || return 1
|
|
||||||
|
|
||||||
if [[ $SYS == 'UEFI' ]]; then
|
|
||||||
select_efi_partition || { BOOT_PART=''; return 1; }
|
|
||||||
elif (( COUNT > 0 )); then
|
|
||||||
select_boot_partition || { BOOT_PART=''; return 1; }
|
select_boot_partition || { BOOT_PART=''; return 1; }
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $BOOT_PART ]]; then
|
if [[ $BOOT_PART ]]; then
|
||||||
part_mount "$BOOT_PART" "/$BOOTDIR" && SEP_BOOT=true || return 1
|
part_mount "$BOOT_PART" "/$BOOTDIR" && SEP_BOOT=true || return 1
|
||||||
part_bootdev
|
part_bootdev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
select_swap || return 1
|
select_swap || return 1
|
||||||
select_extra_partitions || return 1
|
select_extra_partitions || return 1
|
||||||
install_background
|
install_background
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
select_swap()
|
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." \
|
dlg SWAP_PART menu "Swap Setup" "\nSelect whether to use a swapfile, swap partition, or none." \
|
||||||
"none" "Don't allocate any swap space" \
|
"none" "Don't allocate any swap space" \
|
||||||
"swapfile" "Allocate $SYS_MEM at /swapfile" \
|
"swapfile" "Allocate $SYS_MEM at /swapfile" \
|
||||||
$PARTS
|
$pts
|
||||||
|
|
||||||
if [[ -z $SWAP_PART || $SWAP_PART == "none" ]]; then
|
if [[ -z $SWAP_PART || $SWAP_PART == "none" ]]; then
|
||||||
SWAP_PART=''
|
SWAP_PART=''
|
||||||
@ -1027,81 +1013,53 @@ select_filesystem()
|
|||||||
part_format "$part" "$fs" 0
|
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()
|
select_boot_partition()
|
||||||
{
|
{
|
||||||
if [[ -z $BOOT_PART ]]; then
|
local pts dev size isize ptcount=0
|
||||||
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
|
|
||||||
|
|
||||||
# walk partition list and skip ones that are too small/big for boot
|
if [[ -z $BOOT_PART ]]; then
|
||||||
while read -r dev size; do
|
if [[ $AUTO_BOOT_PART && -z $LVM && -z $LUKS ]]; then
|
||||||
size_t="${size: -1:1}" # size type eg. K, M, G, T
|
BOOT_PART="$AUTO_BOOT_PART"
|
||||||
isize=${size:0:-1} # remove trailing size type character
|
return 0
|
||||||
isize=${isize%.*} # remove any decimal (round down)
|
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++ )); }
|
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||||
done <<< "$PARTS"
|
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
|
if [[ $LUKS && ! $LVM ]]; then
|
||||||
dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
|
dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
|
||||||
[[ $BOOT_PART ]] || return 1
|
[[ $BOOT_PART ]] || return 1
|
||||||
else
|
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; }
|
[[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
if ([[ $SYS == 'BIOS' ]] && grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")") || ([[ $SYS == 'UEFI' ]] && grep -q 'fat' <<< "$(fsck -N "$BOOT_PART")"); then
|
||||||
local txt="\nIMPORTANT:\n\nThe boot partition $BOOT_PART $_format"
|
yesno "Format Boot Partition" "\nIMPORTANT:\n\nThe boot partition $BOOT_PART $_format" "Format $BOOT_PART" "Skip Formatting" 1 || return 0
|
||||||
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
|
|
||||||
fi
|
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
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1114,7 +1072,7 @@ select_root_partition()
|
|||||||
part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
|
part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
|
||||||
return 0 # we're done here
|
return 0 # we're done here
|
||||||
else
|
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)
|
# walk partition list and skip ones that are too small for / (root)
|
||||||
while read -r dev size; do
|
while read -r dev size; do
|
||||||
@ -1142,7 +1100,7 @@ select_root_partition()
|
|||||||
|
|
||||||
select_extra_partitions()
|
select_extra_partitions()
|
||||||
{
|
{
|
||||||
local part size dev
|
local part dev size
|
||||||
|
|
||||||
# walk partition list and skip ones that are too small to be usable
|
# walk partition list and skip ones that are too small to be usable
|
||||||
while read -r dev size; do
|
while read -r dev size; do
|
||||||
@ -1156,7 +1114,7 @@ select_extra_partitions()
|
|||||||
break
|
break
|
||||||
elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then
|
elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then
|
||||||
EXMNTS+="$part: $EXMNT "
|
EXMNTS+="$part: $EXMNT "
|
||||||
[[ $EXMNT == '/usr' && $HOOKS != *usr* ]] && HOOKS="usr $HOOKS"
|
[[ $EXMNT == '/usr' && $HOOKS != *usr* ]] && HOOKS+=" usr"
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -1172,9 +1130,9 @@ select_extra_partitions()
|
|||||||
install_main()
|
install_main()
|
||||||
{
|
{
|
||||||
install_base
|
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"
|
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_packages
|
||||||
install_mkinitcpio
|
install_mkinitcpio
|
||||||
install_boot
|
install_boot
|
||||||
@ -1225,18 +1183,19 @@ install_base()
|
|||||||
trap - EXIT
|
trap - EXIT
|
||||||
unset BG_PID
|
unset BG_PID
|
||||||
|
|
||||||
rm -rf $MNT/etc/mkinitcpio-archiso.conf
|
rm -rf "$MNT/etc/mkinitcpio-archiso.conf"
|
||||||
find $MNT/usr/lib/initcpio -name 'archiso*' -type f -delete
|
find "$MNT/usr/lib/initcpio" -name 'archiso*' -type f -delete
|
||||||
sed -i 's/#\(Storage=\)volatile/\1auto/' $MNT/etc/systemd/journald.conf
|
sed -i 's/#\(Storage=\)volatile/\1auto/' "$MNT/etc/systemd/journald.conf"
|
||||||
find $MNT/boot -name '*-ucode.img' -delete
|
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
|
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
|
elif lspci | grep ' VGA ' | grep -q 'Intel'; then
|
||||||
echo "Creating Intel Tear Free config /etc/X11/xorg.conf.d/20-intel.conf"
|
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"
|
Section "Device"
|
||||||
Identifier "Intel Graphics"
|
Identifier "Intel Graphics"
|
||||||
Driver "intel"
|
Driver "intel"
|
||||||
@ -1245,7 +1204,7 @@ install_base()
|
|||||||
EOF
|
EOF
|
||||||
elif lspci | grep ' VGA ' | grep -q 'AMD/ATI.*RX'; then # newer RX cards can use the amdgpu driver
|
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"
|
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"
|
Section "Device"
|
||||||
Identifier "AMD Graphics"
|
Identifier "AMD Graphics"
|
||||||
Driver "amdgpu"
|
Driver "amdgpu"
|
||||||
@ -1254,7 +1213,7 @@ install_base()
|
|||||||
EOF
|
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
|
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"
|
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"
|
Section "Device"
|
||||||
Identifier "AMD Graphics"
|
Identifier "AMD Graphics"
|
||||||
Driver "radeon"
|
Driver "radeon"
|
||||||
@ -1263,18 +1222,21 @@ install_base()
|
|||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -e /run/archiso/sfs/airootfs ]] && cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux
|
if [[ -e /run/archiso/sfs/airootfs ]]; then
|
||||||
[[ -d /etc/netctl ]] && cp -rfv /etc/netctl $MNT/etc/
|
cp -vf "$RUN/x86_64/vmlinuz" "$MNT/boot/vmlinuz-linux" 2>$ERR 2>&1
|
||||||
[[ -f /etc/resolv.conf ]] && cp -fv /etc/resolv.conf $MNT/etc/
|
errshow 1 "cp -vf $RUN/x86_64/vmlinuz $MNT/boot/vmlinuz-linux"
|
||||||
[[ -e /etc/NetworkManager/system-connections ]] && cp -rvf /etc/NetworkManager/system-connections $MNT/etc/NetworkManager/
|
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
|
echo "LANG=$MYLOCALE" > "$MNT/etc/locale.conf"
|
||||||
cp -fv $MNT/etc/locale.conf $MNT/etc/default/locale
|
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
|
sed -i "s/#en_US.UTF-8/en_US.UTF-8/g; s/#${MYLOCALE}/${MYLOCALE}/g" "$MNT/etc/locale.gen"
|
||||||
chrun "locale-gen"
|
chrun "locale-gen"
|
||||||
chrun "ln -svf /usr/share/zoneinfo/$ZONE/$SUBZ /etc/localtime"
|
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.
|
# Use localectl(1) to instruct systemd-localed to update it.
|
||||||
Section "InputClass"
|
Section "InputClass"
|
||||||
Identifier "system-keyboard"
|
Identifier "system-keyboard"
|
||||||
@ -1283,7 +1245,7 @@ install_base()
|
|||||||
EndSection
|
EndSection
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat > $MNT/etc/default/keyboard <<- EOF
|
cat > "$MNT/etc/default/keyboard" <<- EOF
|
||||||
# KEYBOARD CONFIGURATION FILE
|
# KEYBOARD CONFIGURATION FILE
|
||||||
# Consult the keyboard(5) manual page.
|
# Consult the keyboard(5) manual page.
|
||||||
XKBMODEL=""
|
XKBMODEL=""
|
||||||
@ -1292,9 +1254,9 @@ install_base()
|
|||||||
XKBOPTIONS=""
|
XKBOPTIONS=""
|
||||||
BACKSPACE="guess"
|
BACKSPACE="guess"
|
||||||
EOF
|
EOF
|
||||||
printf "KEYMAP=%s\nFONT=%s\n" "$CMAP" "$FONT" > $MNT/etc/vconsole.conf
|
printf "KEYMAP=%s\nFONT=%s\n" "$CMAP" "$FONT" > "$MNT/etc/vconsole.conf"
|
||||||
echo "$MYHOST" > $MNT/etc/hostname
|
echo "$MYHOST" > "$MNT/etc/hostname"
|
||||||
cat > $MNT/etc/hosts <<- EOF
|
cat > "$MNT/etc/hosts" <<- EOF
|
||||||
127.0.0.1 localhost
|
127.0.0.1 localhost
|
||||||
127.0.1.1 $MYHOST
|
127.0.1.1 $MYHOST
|
||||||
::1 localhost ip6-localhost ip6-loopback
|
::1 localhost ip6-localhost ip6-loopback
|
||||||
@ -1317,8 +1279,9 @@ install_boot()
|
|||||||
|
|
||||||
if [[ $SYS == 'UEFI' ]]; then
|
if [[ $SYS == 'UEFI' ]]; then
|
||||||
# remove our old install and generic BOOT/ dir
|
# remove our old install and generic BOOT/ dir
|
||||||
find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname "$DIST" -type d -delete
|
echo "Removing conflicting boot directories"
|
||||||
find $MNT/$BOOTDIR/EFI/ -maxdepth 1 -mindepth 1 -iname 'BOOT' -type d -delete
|
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
|
fi
|
||||||
|
|
||||||
prerun_$BOOTLDR
|
prerun_$BOOTLDR
|
||||||
@ -1328,18 +1291,18 @@ install_boot()
|
|||||||
if [[ -d $MNT/hostrun ]]; then
|
if [[ -d $MNT/hostrun ]]; then
|
||||||
echo "Unmounting chroot directories"
|
echo "Unmounting chroot directories"
|
||||||
# cleanup the bind mounts we made earlier for the grub-probe module
|
# cleanup the bind mounts we made earlier for the grub-probe module
|
||||||
umount_dir $MNT/hostrun/{udev,lvm}
|
umount_dir "$MNT/hostrun/"{udev,lvm}
|
||||||
rm -rf $MNT/hostrun >/dev/null 2>&1
|
rm -rf "$MNT/hostrun" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SYS == 'UEFI' ]]; then
|
if [[ $SYS == 'UEFI' ]]; then
|
||||||
# some UEFI firmware requires a generic esp/BOOT/BOOTX64.EFI
|
# 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
|
case "$BOOTLDR" in
|
||||||
grub) cp -fv $MNT/$BOOTDIR/EFI/$DIST/grubx64.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 ;;
|
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
|
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 ;;
|
cp -fv "$MNT/$BOOTDIR/EFI/refind/refind_x64.efi" "$MNT/$BOOTDIR/EFI/BOOT/BOOTX64.EFI" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1350,7 +1313,7 @@ install_user()
|
|||||||
{
|
{
|
||||||
local groups='audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel'
|
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
|
chrun "chpasswd <<< 'root:$ROOT_PASS'" 2>$ERR 2>&1
|
||||||
errshow 1 "set root password"
|
errshow 1 "set root password"
|
||||||
@ -1397,8 +1360,8 @@ install_login()
|
|||||||
case $LOGIN_TYPE in
|
case $LOGIN_TYPE in
|
||||||
ly|sddm|gdm|lightdm)
|
ly|sddm|gdm|lightdm)
|
||||||
if [[ $LOGIN_WM == *dwm* ]]; then # dwm doesn't include an xsession file for display managers
|
if [[ $LOGIN_WM == *dwm* ]]; then # dwm doesn't include an xsession file for display managers
|
||||||
mkdir -p $MNT/usr/share/xsessions
|
mkdir -p "$MNT/usr/share/xsessions"
|
||||||
cat >$MNT/usr/share/xsessions/dwm.desktop <<- EOF
|
cat >"$MNT/usr/share/xsessions/dwm.desktop" <<- EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Encoding=UTF-8
|
Encoding=UTF-8
|
||||||
Name=Dwm
|
Name=Dwm
|
||||||
@ -1434,9 +1397,13 @@ install_login()
|
|||||||
|
|
||||||
install_packages()
|
install_packages()
|
||||||
{
|
{
|
||||||
local rmpkg="archlabs-installer "
|
local rmpkg=""
|
||||||
local inpkg="$PACKAGES $USER_PKGS $AL_BASE_PKGS "
|
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
|
if [[ $MYSHELL == 'zsh' ]]; then
|
||||||
inpkg+="zsh-completions "
|
inpkg+="zsh-completions "
|
||||||
else
|
else
|
||||||
@ -1448,7 +1415,6 @@ install_packages()
|
|||||||
else
|
else
|
||||||
[[ $INSTALL_WMS =~ (plasma|gnome|cinnamon) ]] || inpkg+="archlabs-ksuperkey "
|
[[ $INSTALL_WMS =~ (plasma|gnome|cinnamon) ]] || inpkg+="archlabs-ksuperkey "
|
||||||
[[ $INSTALL_WMS =~ (openbox|bspwm|i3-gaps|fluxbox) ]] && inpkg+="$WM_BASE_PKGS "
|
[[ $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
|
fi
|
||||||
|
|
||||||
# update and install crucial packages first to avoid issues
|
# 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"
|
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
|
# 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
|
# reinstalling iputils fixes the network issue for non-root users
|
||||||
chrun "pacman -S iputils $UCODE --noconfirm"
|
chrun "pacman -S iputils $UCODE --noconfirm"
|
||||||
@ -1479,7 +1445,7 @@ install_packages()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# allow members of the wheel group to run commands as root
|
# 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
|
return 0
|
||||||
}
|
}
|
||||||
@ -1489,7 +1455,7 @@ install_mkinitcpio()
|
|||||||
local add=''
|
local add=''
|
||||||
[[ $LUKS ]] && add="encrypt"
|
[[ $LUKS ]] && add="encrypt"
|
||||||
[[ $LVM ]] && { [[ $add ]] && add+=" lvm2" || add+="lvm2"; }
|
[[ $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
|
chrun "mkinitcpio -p $KERNEL" 2>$ERR 2>&1
|
||||||
errshow 1 "mkinitcpio -p $KERNEL"
|
errshow 1 "mkinitcpio -p $KERNEL"
|
||||||
}
|
}
|
||||||
@ -1524,7 +1490,7 @@ install_mirrorlist()
|
|||||||
|
|
||||||
install_background()
|
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=$!
|
BG_PID=$!
|
||||||
trap "kill $BG_PID 2>/dev/null" EXIT
|
trap "kill $BG_PID 2>/dev/null" EXIT
|
||||||
}
|
}
|
||||||
@ -1562,7 +1528,7 @@ install_suckless()
|
|||||||
|
|
||||||
lightdm_config()
|
lightdm_config()
|
||||||
{
|
{
|
||||||
cat > $MNT/etc/lightdm/lightdm-gtk-greeter.conf <<- EOF
|
cat > "$MNT/etc/lightdm/lightdm-gtk-greeter.conf" <<- EOF
|
||||||
[greeter]
|
[greeter]
|
||||||
default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
|
default-user-image=/usr/share/icons/ArchLabs-Dark/64x64/places/distributor-logo-archlabs.png
|
||||||
background=/usr/share/backgrounds/archlabs/archlabs.jpg
|
background=/usr/share/backgrounds/archlabs/archlabs.jpg
|
||||||
@ -1619,22 +1585,22 @@ setup_grub()
|
|||||||
|
|
||||||
prerun_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
|
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"
|
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
|
fi
|
||||||
|
|
||||||
if [[ $SYS == 'BIOS' && $LVM && -z $SEP_BOOT ]]; then
|
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"
|
errshow 1 "sed -i 's/GRUB_PRELOAD_MODULES=.*/GRUB_PRELOAD_MODULES=\"lvm\"/g' $MNT/etc/default/grub"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# setup for os-prober module
|
# setup for os-prober module
|
||||||
mkdir -p /run/{lvm,udev} $MNT/hostrun/{lvm,udev}
|
mkdir -p /run/{lvm,udev} "$MNT/hostrun/"{lvm,udev}
|
||||||
mount --bind /run/lvm $MNT/hostrun/lvm
|
mount --bind /run/lvm "$MNT/hostrun/lvm"
|
||||||
mount --bind /run/udev $MNT/hostrun/udev
|
mount --bind /run/udev "$MNT/hostrun/udev"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -1664,18 +1630,47 @@ setup_syslinux()
|
|||||||
|
|
||||||
prerun_syslinux()
|
prerun_syslinux()
|
||||||
{
|
{
|
||||||
local c="$MNT/boot/syslinux" s="/usr/lib/syslinux/bios" d=".."
|
local c="$MNT/boot/syslinux"
|
||||||
[[ $SYS == 'UEFI' ]] && { c="$MNT/boot/EFI/syslinux"; s="/usr/lib/syslinux/efi64"; d=''; }
|
local s="/usr/lib/syslinux/bios"
|
||||||
|
local d=".."
|
||||||
mkdir -pv "$c"
|
if [[ $SYS == 'UEFI' ]]; then
|
||||||
cp -rfv "$s/"* "$c/"
|
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
|
cat > "$c/syslinux.cfg" <<- EOF
|
||||||
UI menu.c32
|
UI vesamenu.c32
|
||||||
PROMPT 0
|
|
||||||
MENU TITLE $DIST Boot Menu
|
MENU TITLE $DIST Boot Menu
|
||||||
|
MENU BACKGROUND splash.png
|
||||||
TIMEOUT 50
|
TIMEOUT 50
|
||||||
DEFAULT $DIST
|
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
|
LABEL $DIST
|
||||||
MENU LABEL $DIST Linux
|
MENU LABEL $DIST Linux
|
||||||
LINUX $d/vmlinuz-$KERNEL
|
LINUX $d/vmlinuz-$KERNEL
|
||||||
@ -1699,7 +1694,7 @@ setup_refind-efi()
|
|||||||
|
|
||||||
prerun_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 ]] &&
|
"$DIST Linux" "root=$ROOT_PART_ID $([[ $LUKS_DEV ]] &&
|
||||||
printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
|
printf "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
|
||||||
printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL.img"
|
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 "%s " "$LUKS_DEV")rw add_efi_memmap $([[ $UCODE ]] &&
|
||||||
printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL-fallback.img"
|
printf "initrd=%s " "/$UCODE.img")initrd=/initramfs-$KERNEL-fallback.img"
|
||||||
EOF
|
EOF
|
||||||
mkdir -p $MNT/etc/pacman.d/hooks
|
mkdir -p "$MNT/etc/pacman.d/hooks"
|
||||||
cat > $MNT/etc/pacman.d/hooks/refind.hook <<- EOF
|
cat > "$MNT/etc/pacman.d/hooks/refind.hook" <<- EOF
|
||||||
[Trigger]
|
[Trigger]
|
||||||
Operation = Upgrade
|
Operation = Upgrade
|
||||||
Type = Package
|
Type = Package
|
||||||
@ -1729,26 +1724,26 @@ setup_systemd-boot()
|
|||||||
|
|
||||||
prerun_systemd-boot()
|
prerun_systemd-boot()
|
||||||
{
|
{
|
||||||
mkdir -p $MNT/boot/loader/entries
|
mkdir -p "$MNT/boot/loader/entries"
|
||||||
cat > $MNT/boot/loader/loader.conf <<- EOF
|
cat > "$MNT/boot/loader/loader.conf" <<- EOF
|
||||||
default $DIST
|
default $DIST
|
||||||
timeout 5
|
timeout 5
|
||||||
editor no
|
editor no
|
||||||
EOF
|
EOF
|
||||||
cat > $MNT/boot/loader/entries/$DIST.conf <<- EOF
|
cat > "$MNT/boot/loader/entries/$DIST.conf" <<- EOF
|
||||||
title $DIST Linux
|
title $DIST Linux
|
||||||
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
|
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
|
||||||
initrd /initramfs-$KERNEL.img
|
initrd /initramfs-$KERNEL.img
|
||||||
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
||||||
EOF
|
EOF
|
||||||
cat > $MNT/boot/loader/entries/$DIST-fallback.conf <<- EOF
|
cat > "$MNT/boot/loader/entries/$DIST-fallback.conf" <<- EOF
|
||||||
title $DIST Linux Fallback
|
title $DIST Linux Fallback
|
||||||
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
|
linux /vmlinuz-${KERNEL}$([[ $UCODE ]] && printf "\ninitrd %s" "/$UCODE.img")
|
||||||
initrd /initramfs-$KERNEL-fallback.img
|
initrd /initramfs-$KERNEL-fallback.img
|
||||||
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
options root=$ROOT_PART_ID $([[ $LUKS_DEV ]] && printf "%s " "$LUKS_DEV")rw
|
||||||
EOF
|
EOF
|
||||||
mkdir -p $MNT/etc/pacman.d/hooks
|
mkdir -p "$MNT/etc/pacman.d/hooks"
|
||||||
cat > $MNT/etc/pacman.d/hooks/systemd-boot.hook <<- EOF
|
cat > "$MNT/etc/pacman.d/hooks/systemd-boot.hook" <<- EOF
|
||||||
[Trigger]
|
[Trigger]
|
||||||
Type = Package
|
Type = Package
|
||||||
Operation = Upgrade
|
Operation = Upgrade
|
||||||
@ -1807,7 +1802,7 @@ lvm_detect()
|
|||||||
lvm_create()
|
lvm_create()
|
||||||
{
|
{
|
||||||
VGROUP='' LVM_PARTS='' VGROUP_MB=0
|
VGROUP='' LVM_PARTS='' VGROUP_MB=0
|
||||||
umount_dir $MNT
|
umount_dir "$MNT"
|
||||||
lvm_mkgroup || return 1
|
lvm_mkgroup || return 1
|
||||||
local txt="\nThe last (or only) logical volume will automatically use all remaining space in the volume group."
|
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 -
|
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()
|
luks_open()
|
||||||
{
|
{
|
||||||
modprobe -a dm-mod dm_crypt >/dev/null 2>&1
|
modprobe -a dm-mod dm_crypt >/dev/null 2>&1
|
||||||
umount_dir $MNT
|
umount_dir "$MNT"
|
||||||
part_find 'part|crypt|lvm' || return 1
|
part_find 'part|crypt|lvm' || return 1
|
||||||
|
|
||||||
if (( COUNT == 1 )); then
|
if (( COUNT == 1 )); then
|
||||||
@ -2059,7 +2054,7 @@ luks_show()
|
|||||||
luks_setup()
|
luks_setup()
|
||||||
{
|
{
|
||||||
modprobe -a dm-mod dm_crypt >/dev/null 2>&1
|
modprobe -a dm-mod dm_crypt >/dev/null 2>&1
|
||||||
umount_dir $MNT
|
umount_dir "$MNT"
|
||||||
part_find 'part|lvm' || return 1
|
part_find 'part|lvm' || return 1
|
||||||
|
|
||||||
if [[ $AUTO_ROOT_PART ]]; then
|
if [[ $AUTO_ROOT_PART ]]; then
|
||||||
@ -2121,7 +2116,7 @@ die()
|
|||||||
trap - INT
|
trap - INT
|
||||||
tput cnorm
|
tput cnorm
|
||||||
if [[ -d $MNT ]]; then
|
if [[ -d $MNT ]]; then
|
||||||
umount_dir $MNT
|
umount_dir "$MNT"
|
||||||
if (( e == 127 )); then
|
if (( e == 127 )); then
|
||||||
umount_dir /run/archiso/bootmnt && sleep 0.5 && reboot -f
|
umount_dir /run/archiso/bootmnt && sleep 0.5 && reboot -f
|
||||||
fi
|
fi
|
||||||
@ -2479,6 +2474,7 @@ elif ! net_connect; then
|
|||||||
msg "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n" 2
|
msg "Not Connected" "\nThis installer requires an active internet connection.\n\nExiting..\n" 2
|
||||||
die 1
|
die 1
|
||||||
fi
|
fi
|
||||||
|
EXMNTS=""
|
||||||
FORMATTED=""
|
FORMATTED=""
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
|
Reference in New Issue
Block a user