installer script: work in progress (9)

This commit is contained in:
Daniel Langbein 2021-05-01 18:25:17 +02:00
parent 0cd2fa661e
commit 267e5019b0
2 changed files with 53 additions and 15 deletions

View File

@ -152,6 +152,51 @@ function choose_mount_options() {
get_multi_choice FS_CHOSEN_MOUNT_OPTIONS "Select mount options" TMP1 || return $? get_multi_choice FS_CHOSEN_MOUNT_OPTIONS "Select mount options" TMP1 || return $?
} }
function run_pacstrap() {
case "${BIOS_TYPE}" in
uefi)
pacstrap /mnt "${KERNEL}" "${KERNEL}-headers" de-p1st-base-efi || return $?
;;
bios)
echo "Not yet implemented"
return 1
;;
*)
echo "Not yet implemented!"
return 1
;;
esac
}
function run_genfstab() {
local fstab
fstab="$(genfstab -U /mnt)"
case "${FS}" in
BTRFS)
# Remove "subvolid=..." mount option but leave "subvol=..." mount option
fstab=$(printf "%s" "${fstab}" | sed 's/,subvolid=[^,\s]\+//') || return $?
# Check if fstab does still contain subvolid mount option
if printf "%s" "${fstab}" | grep -q 'subvolid='; then
echo "This should not happen!"
return 1
fi
;;
EXT4)
true
;;
F2FS)
true
;;
*)
echo "Filesystem $FS not yet supported!"
return 1
;;
esac
printf "%s" "${fstab}" > /mnt/etc/fstab || return $?
}
function main() { function main() {
check_network || return $? check_network || return $?
get_user_input || return $? get_user_input || return $?
@ -167,26 +212,17 @@ function main() {
TMP1=("${FS_DEFAULT_MOUNT_OPTIONS[@]}" "${FS_CHOSEN_MOUNT_OPTIONS[@]}") || return $? TMP1=("${FS_DEFAULT_MOUNT_OPTIONS[@]}" "${FS_CHOSEN_MOUNT_OPTIONS[@]}") || return $?
# Join array elements by "," # Join array elements by ","
join_by "," TMP1 FS_MOUNT_OPTIONS || return $? join_by "," TMP1 FS_MOUNT_OPTIONS || return $?
echo "Mounting data partition with options: ${FS_MOUNT_OPTIONS}" echo "Mounting data partition with options: ${FS_MOUNT_OPTIONS}"
mount -o "${FS_MOUNT_OPTIONS}" "$DATA_PART" /mnt || return $? mount -o "${FS_MOUNT_OPTIONS}" "$DATA_PART" /mnt || return $?
# mount boot partition
echo "Mounting boot partition ..."
mkdir /mnt/boot || return $? mkdir /mnt/boot || return $?
mount "$BOOT_PART" /mnt/boot || return $? mount "$BOOT_PART" /mnt/boot || return $?
case "${BIOS_TYPE}" in run_pacstrap || return $?
uefi) run_genfstab || return $?
pacstrap /mnt "${KERNEL}" "${KERNEL}-headers" de-p1st-base-efi || return $? echo "${HOSTNAME}" >/mnt/etc/hostname || return $?
;;
bios)
echo "Not yet implemented"
return 1
;;
*)
echo "Not yet implemented!"
return 1
;;
esac
} }
main "$@" main "$@"

View File

@ -15,3 +15,5 @@ FS_CHOSEN_MOUNT_OPTIONS=('noatime')
CPU_VENDOR=none CPU_VENDOR=none
BIOS_TYPE=uefi BIOS_TYPE=uefi
FOO="xsubvolid=bar"