refactor(meta): Update function numbering (#3)

This commit is contained in:
hygienic-books 2023-10-21 05:14:38 +02:00
parent 767e9c3b42
commit d1407f00a9

View File

@ -284,7 +284,7 @@ function mount_system () {
}
function copy_zpool_cache () {
#1.9
#1.8
mkdir -p '/mnt/etc/zfs'
zpool set 'cachefile=/etc/zfs/'"${zpool_name}"'.cache' "${zpool_name}"
}
@ -304,7 +304,7 @@ function pacman_dont_check_space () {
}
function install_archlinux () {
#1.10
#1.9
pacman_dl_parallel
pacman_dont_check_space
pacstrap /mnt \
@ -331,7 +331,7 @@ function install_archlinux () {
}
function gen_fstab () {
#1.11
#1.10
genfstab -U /mnt | grep -v "${zpool_name}" | tr -s '\n' | sed -r -e 's/\/mnt//' -e '/./,$!d' > '/mnt/etc/fstab'
}
@ -344,7 +344,7 @@ EOF
}
function set_hostname () {
#1.12
#1.11
declare new_hostname
install_pkgs 'pwgen'
new_hostname="$(pwgen --no-numerals --no-capitalize --ambiguous 8)"
@ -353,7 +353,7 @@ function set_hostname () {
}
function set_locale () {
#1.13
#1.12
printf -- '%s\n' \
'KEYMAP=de-latin1' \
'FONT=Lat2-Terminus16' \
@ -364,7 +364,7 @@ function set_locale () {
}
function add_zfs_hook_to_initramfs () {
#1.14
#1.13
# 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' \
@ -379,7 +379,7 @@ function add_zfs_hook_to_initramfs () {
}
function set_initramfs_build_list () {
#1.15
#1.14
# No need to build fallback initramfs, our new fallback is ZFS snapshots
sed -ri \
-e '/^#/d' \
@ -393,7 +393,7 @@ function set_initramfs_build_list () {
}
function add_zfs_files_to_new_os () {
#1.16
#1.15
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
@ -546,8 +546,7 @@ function paru_install () {
}
function configure_zfsbootmenu () {
#3.8
#FIXME
#2.9
paru_install 'zfsbootmenu'
mkdir -p '/etc/zfsbootmenu/posthooks.d'
cat > '/etc/zfsbootmenu/config.yaml' <<EOF
@ -608,7 +607,7 @@ function install_os_in_chroot () {
mkinitcpio -P
# Install ZFSBootMenu image
configure_zfsbootmenu #3.8 #FIXME
configure_zfsbootmenu #2.9
generate-zbm
}
@ -665,7 +664,7 @@ function configure_zfs_mount_gen () {
}
function set_new_uefi_boot_entries () {
#3.9
#3.8
declare -a uefi_images
mapfile -t uefi_images < \
<(find '/mnt/efi/EFI/ZBM' -type f -iname '*.efi' -print0 | \
@ -709,6 +708,7 @@ function set_new_uefi_boot_entries () {
}
function insert_zbm_postconf_hook () {
#3.9
declare postconf_target_abs='/mnt/etc/zfsbootmenu/posthooks.d/'"$(basename "${postconf_hook}")"
curl --silent --location "${postconf_hook}" --output "${postconf_target_abs}"
chmod +x "${postconf_target_abs}"
@ -729,9 +729,9 @@ function finalize_os_setup () {
configure_reflector #3.5
configure_zfs #3.6
configure_zfs_mount_gen #3.7
set_new_uefi_boot_entries #3.9
insert_zbm_postconf_hook
umount_all #3.11
set_new_uefi_boot_entries #3.8
insert_zbm_postconf_hook #3.9
umount_all #3.10
}
function main () {
@ -745,15 +745,14 @@ function main () {
install_zfs #1.5
setup_zpool #1.6
mount_system #1.7
prepare_zfsbootmenu_efi_bin_pkg #1.8
copy_zpool_cache #1.9
install_archlinux #1.10
gen_fstab #1.11
set_hostname #1.12
set_locale #1.13
add_zfs_hook_to_initramfs #1.14
set_initramfs_build_list #1.15
add_zfs_files_to_new_os #1.16
copy_zpool_cache #1.8
install_archlinux #1.9
gen_fstab #1.10
set_hostname #1.11
set_locale #1.12
add_zfs_hook_to_initramfs #1.13
set_initramfs_build_list #1.14
add_zfs_files_to_new_os #1.15
enter_chroot #2.1
# We're done in chroot
finalize_os_setup #3.1