refactor(meta): Renumber functions (#9)

This commit is contained in:
hygienic-books 2023-10-27 04:24:40 +02:00
parent cf50632b6c
commit 5d03799dae

View File

@ -326,6 +326,7 @@ function export_pool () {
}
function load_settings_file () {
#1.8
local working_dir settings_file settings_abs
working_dir="$(pwd)"
settings_file='archzbm_settings.env'
@ -338,7 +339,7 @@ function load_settings_file () {
}
function setup_zpool () {
#1.8
#1.9
local drive_by_id
zpool_drive="$(select_part 'zfs')"
drive_by_id="$(get_drive_id "${zpool_drive}")"
@ -358,7 +359,7 @@ function setup_zpool () {
}
function mount_system () {
#1.9
#1.10
zfs mount "${zpool_name}"'/root/'"${zfs_arch_dataset_name}"
zfs mount -a
@ -381,7 +382,7 @@ function mount_system () {
}
function copy_zpool_cache () {
#1.10
#1.11
mkdir -p '/mnt/etc/zfs'
zpool set 'cachefile=/etc/zfs/'"${zpool_name}"'.cache' "${zpool_name}"
}
@ -401,7 +402,7 @@ function pacman_dont_check_space () {
}
function install_archlinux () {
#1.11
#1.12
pacman_dl_parallel
pacman_dont_check_space
pacstrap /mnt \
@ -428,7 +429,7 @@ function install_archlinux () {
}
function gen_fstab () {
#1.12
#1.13
genfstab -U /mnt | grep -v "${zpool_name}" | tr -s '\n' | sed -r -e 's/\/mnt//' -e '/./,$!d' > '/mnt/etc/fstab'
}
@ -441,7 +442,7 @@ EOF
}
function set_hostname () {
#1.13
#1.14
declare new_hostname
install_pkgs 'pwgen'
new_hostname="$(pwgen --no-numerals --no-capitalize --ambiguous 8)"
@ -450,7 +451,7 @@ function set_hostname () {
}
function set_locale () {
#1.14
#1.15
printf -- '%s\n' \
'KEYMAP=de-latin1' \
'FONT=Lat2-Terminus16' \
@ -461,7 +462,7 @@ function set_locale () {
}
function add_zfs_hook_to_initramfs () {
#1.15
#1.16
# Add zfs hook, remove fsck hook from initramfs.
sed -ri \
-e 's'$'\x1''(HOOKS=)(.*?[\(| ])(filesystems)([\)| ][^\r\n\f]*)'$'\x1''\1\2zfs \3\4'$'\x1''g' \
@ -476,7 +477,7 @@ function add_zfs_hook_to_initramfs () {
}
function set_initramfs_build_list () {
#1.16
#1.17
# No need to build fallback initramfs, our new fallback is ZFS snapshots
sed -ri \
-e '/^#/d' \
@ -490,7 +491,7 @@ function set_initramfs_build_list () {
}
function add_zfs_files_to_new_os () {
#1.17
#1.18
for zfs_file in '/etc/hostid' '/etc/zfs/zpool.cache' $([[ ! "${ARCHZBM_ZFSPROPS_NO_ENCRYPTION}" ]] && printf -- '%s' '/etc/zfs/'"${zpool_name}"'.key'); do
rsync -av --itemize-changes {'','/mnt'}"${zfs_file}"
done
@ -917,17 +918,17 @@ function main () {
install_pkgs 'jq' #1.5
install_zfs #1.6
uefi_or_bios #1.7
load_settings_file
setup_zpool #1.8
mount_system #1.9
copy_zpool_cache #1.10
install_archlinux #1.11
gen_fstab #1.12
set_hostname #1.13
set_locale #1.14
add_zfs_hook_to_initramfs #1.15
set_initramfs_build_list #1.16
add_zfs_files_to_new_os #1.17
load_settings_file #1.8
setup_zpool #1.9
mount_system #1.10
copy_zpool_cache #1.11
install_archlinux #1.12
gen_fstab #1.13
set_hostname #1.14
set_locale #1.15
add_zfs_hook_to_initramfs #1.16
set_initramfs_build_list #1.17
add_zfs_files_to_new_os #1.18
enter_chroot #2.1
# We're done in chroot
finalize_os_setup #3.1