This commit is contained in:
Daniel Langbein 2021-06-18 22:03:14 +02:00
parent af35daca89
commit 2d11ac5640
2 changed files with 62 additions and 63 deletions

View File

@ -2,7 +2,7 @@
_pkgname=installer
_reponame=arch
pkgname="de-p1st-$_pkgname"
pkgver=0.1.13
pkgver=0.1.14
pkgrel=1
pkgdesc="Bash script to install Arch Linux"
arch=('any')

View File

@ -8,6 +8,67 @@ source /usr/lib/de-p1st-installer/util.sh || { exit 1; }
source /usr/lib/de-p1st-installer/user-input.sh || { exit 1; }
source /usr/lib/de-p1st-installer/block-device.sh || { exit 1; }
function main() {
# @pre
# bash libraries imported
# @post
# installation finished
check_network || return $?
# out: BIOS_TYPE, FS, HOSTNAME, USERNAME, USER_PWD, LUKS_PWD
get_user_input || return $?
# in: CPU_VENDOR (optional)
# out: CPU_VENDOR
get_cpu_vendor || return $?
# in: FS
# out: FS_DEFAULT_MOUNT_OPTIONS
get_default_mount_options || return $?
# in: FS
# out: FS_CHOSEN_MOUNT_OPTIONS
choose_mount_options || return $?
# in: TARGET_BLOCK_DEVICE, BIOS_TYPE
# out: BOOT_PART, LUKS_PART
partition || return $?
# in: BIOS_TYPE, BOOT_PART, LUKS_PART, LUKS_PWD, FS
# out: LUKS_PART_UUID, DATA_PART
format || return $?
# Combine default and chosen mount options
TMP1=("${FS_DEFAULT_MOUNT_OPTIONS[@]}" "${FS_CHOSEN_MOUNT_OPTIONS[@]}") || return $?
# Join array elements by ","
join_by "," TMP1 FS_MOUNT_OPTIONS || return $?
echo "Mounting data partition with options: ${FS_MOUNT_OPTIONS}"
sudo mount -o "${FS_MOUNT_OPTIONS}" "$DATA_PART" /mnt || return $?
echo "Mounting boot partition ..."
mkdir /mnt/boot || return $?
sudo mount "$BOOT_PART" /mnt/boot || return $?
# in: BIOS_TYPE
run_pacstrap || return $?
# in: FS
run_genfstab || return $?
# in: HOSTNAME, FQDN (optional), STATIC_IP (optional), IPV6_CAPABLE (optional)
config_hostname_and_hosts || return $?
# in: USERNAME, USER_PWD, ROOT_PWD (optional)
user_and_pwd || return $?
sudo arch-chroot /mnt mkinitcpio -P || return $?
# in: TARGET_BLOCK_DEVICE, LUKS_PART_UUID
bootloader || return $?
if [ "${LEAVE_MOUNTED}" -eq "1" ]; then
echo "Leaving partitions below /mnt mounted and ${DATA_PART} opened."
else
sudo umount -R /mnt || return $?
sudo cryptsetup luksClose "$(basename "${DATA_PART}")" || return $?
fi
echo "Finished installation without errors!"
}
function check_network() {
echo "Sending ping to wikipedia.de ..."
@ -332,66 +393,4 @@ sed "s|^GRUB_CMDLINE_LINUX=.*\$|GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uu
}
}
function main() {
# @pre
# bash libraries imported
# @post
# installation finished
check_network || return $?
# out: BIOS_TYPE, FS, HOSTNAME, USERNAME, USER_PWD, LUKS_PWD
get_user_input || return $?
# in: CPU_VENDOR (optional)
# out: CPU_VENDOR
get_cpu_vendor || return $?
# in: FS
# out: FS_DEFAULT_MOUNT_OPTIONS
get_default_mount_options || return $?
# in: FS
# out: FS_CHOSEN_MOUNT_OPTIONS
choose_mount_options || return $?
# in: TARGET_BLOCK_DEVICE, BIOS_TYPE
# out: BOOT_PART, LUKS_PART
partition || return $?
# in: BIOS_TYPE, BOOT_PART, LUKS_PART, LUKS_PWD, FS
# out: LUKS_PART_UUID, DATA_PART
format || return $?
# Combine default and chosen mount options
TMP1=("${FS_DEFAULT_MOUNT_OPTIONS[@]}" "${FS_CHOSEN_MOUNT_OPTIONS[@]}") || return $?
# Join array elements by ","
join_by "," TMP1 FS_MOUNT_OPTIONS || return $?
echo "Mounting data partition with options: ${FS_MOUNT_OPTIONS}"
sudo mount -o "${FS_MOUNT_OPTIONS}" "$DATA_PART" /mnt || return $?
echo "Mounting boot partition ..."
mkdir /mnt/boot || return $?
sudo mount "$BOOT_PART" /mnt/boot || return $?
# in: BIOS_TYPE
run_pacstrap || return $?
# in: FS
run_genfstab || return $?
# in: HOSTNAME, FQDN (optional), STATIC_IP (optional), IPV6_CAPABLE (optional)
config_hostname_and_hosts || return $?
# in: USERNAME, USER_PWD, ROOT_PWD (optional)
user_and_pwd || return $?
sudo arch-chroot /mnt mkinitcpio -P || return $?
# in: TARGET_BLOCK_DEVICE, LUKS_PART_UUID
bootloader || return $?
if [ "${LEAVE_MOUNTED}" -eq "1" ]; then
echo "Leaving partitions below /mnt mounted and ${DATA_PART} opened."
else
sudo umount -R /mnt || return $?
sudo cryptsetup luksClose "$(basename "${DATA_PART}")" || return $?
fi
echo "Finished installation without errors!"
}
main "$@"