installer script: work in progress (8)

This commit is contained in:
Daniel Langbein 2021-05-01 17:04:27 +02:00
parent b13bd32922
commit 0cd2fa661e
5 changed files with 39 additions and 12 deletions

View File

@ -55,7 +55,7 @@ Files from `/etc/skel` are copied to `/home/$USER` when new users are created.
Example: [pkg/de-p1st-gnupg/PKGBUILD](pkg/de-p1st-gnupg/PKGBUILD)
### enabling services
### Enabling services
* systemd.preset - Service enablement presets
* [man 5 systemd.preset](https://www.systutorials.com/docs/linux/man/5-systemd.preset/)

View File

@ -12,7 +12,7 @@
# -> git
#
BUILD_DIR=./archlive
PKGS=('git' 'de-p1st-keyboard' 'de-p1st-nano' 'de-p1st-pacman' 'de-p1st-pacman-mirrorlist' 'de-p1st-systemd')
PKGS=('git' 'de-p1st-keyboard' 'de-p1st-nano' 'de-p1st-pacman' 'de-p1st-systemd')
PACMAN_CFG_ADDITION='pkg/de-p1st-pacman/pacman.d/de-p1st' # will be used to extend the builder's pacman.conf

View File

@ -125,7 +125,7 @@ function get_default_mount_options() {
function choose_mount_options() {
# return: the following variables:
# FS_MOUNT_OPTIONS (array)
# FS_CHOSEN_MOUNT_OPTIONS (array)
case "${FS}" in
BTRFS)
@ -149,7 +149,7 @@ function choose_mount_options() {
;;
esac
get_multi_choice FS_MOUNT_OPTIONS "Select mount options" TMP1 || return $?
get_multi_choice FS_CHOSEN_MOUNT_OPTIONS "Select mount options" TMP1 || return $?
}
function main() {
@ -163,15 +163,30 @@ function main() {
partition "${TARGET_BLOCK_DEVICE}" "$BIOS_TYPE" || return $?
format "$BIOS_TYPE" "${BOOT_PART}" "${LUKS_PART}" "${LUKS_PWD}" "${FS}" DATA_PART || return $?
# TODO: use FS_DEFAULT_MOUNT_OPTIONS and FS_MOUNT_OPTIONS in combination
mount "$DATA_PART" /mnt || return $?
mkdir /mnt/boot && mount "$BOOT_PART" /mnt/boot || 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}"
mount -o "${FS_MOUNT_OPTIONS}" "$DATA_PART" /mnt || return $?
# mount boot partition
mkdir /mnt/boot || return $?
mount "$BOOT_PART" /mnt/boot || return $?
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
# TODO: testing
# if bios type is bios then ... :/
# amd/intel-ucode
pacstrap /mnt "${KERNEL}" "${KERNEL}-headers" de-p1st-base-efi
}
main "$@"

View File

@ -11,7 +11,7 @@ KERNEL=linux
TARGET_BLOCK_DEVICE=/dev/sda
BOOT_PART_SIZE=500 # MiB
FS=BTRFS
FS_MOUNT_OPTIONS=('noatime')
FS_CHOSEN_MOUNT_OPTIONS=('noatime')
CPU_VENDOR=none
BIOS_TYPE=uefi

View File

@ -1,3 +1,15 @@
function join_by() {
# Join array elements with character $1
# $1: delimiter
# $2: name of source array
# $3: variable name to store result
local -n ptr=$2 || return $?
local -n ptr2=$3 || return $?
ptr2=$(printf ",%s" "${ptr[@]}")
ptr2=${ptr2:1}
}
function newline_to_space() {
# Replaces all newlines with spaces
# $1: name of variable