3-xen-orchestra-install #4

Merged
hygienic-books merged 84 commits from 3-xen-orchestra-install into main 2023-10-22 14:23:54 +00:00
Showing only changes of commit c5e0216041 - Show all commits

View File

@ -26,8 +26,13 @@ function set_ntp () {
timedatectl set-ntp true timedatectl set-ntp true
} }
function update_pacman_db () { function resize_cow_space () {
#1.2 #1.2
mount -o remount,size='50%' /run/archiso/cowspace
}
function update_pacman_db () {
#1.3
printf -- '%s\n' 'Refreshing mirror list ...' printf -- '%s\n' 'Refreshing mirror list ...'
systemctl start reflector systemctl start reflector
# In an ISO and for the minimal number of packages we need we do not # In an ISO and for the minimal number of packages we need we do not
@ -36,13 +41,13 @@ function update_pacman_db () {
} }
function install_pkgs () { function install_pkgs () {
#1.3 #1.4
printf -- '%s\n' 'Installing packages ...' printf -- '%s\n' 'Installing packages ...'
pacman -S --needed --noconfirm "${@}" pacman -S --needed --noconfirm "${@}"
} }
function prepare_zfsbootmenu_efi_bin_pkg () { function prepare_zfsbootmenu_efi_bin_pkg () {
#1.4 #1.5
# Our Arch Linux will use prebuilt ZFSBootMenu UEFI image files for ease # Our Arch Linux will use prebuilt ZFSBootMenu UEFI image files for ease
# of use. We'd like to install them from within our chroot but the AUR # of use. We'd like to install them from within our chroot but the AUR
# package 'zfsbootmenu-efi-bin' that we're using currently (Friday, # package 'zfsbootmenu-efi-bin' that we're using currently (Friday,
@ -91,7 +96,7 @@ function prepare_zfsbootmenu_efi_bin_pkg () {
} }
function install_zfs () { function install_zfs () {
#1.5 #1.6
declare reset_colors='\033[0m' declare reset_colors='\033[0m'
curl -s 'https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init' | bash curl -s 'https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init' | bash
printf -- "${reset_colors}" printf -- "${reset_colors}"
@ -262,7 +267,7 @@ function export_pool () {
} }
function setup_zpool () { function setup_zpool () {
#1.6 #1.7
local drive_by_id local drive_by_id
zpool_drive="$(select_part 'zfs')" zpool_drive="$(select_part 'zfs')"
drive_by_id="$(get_drive_id "${zpool_drive}")" drive_by_id="$(get_drive_id "${zpool_drive}")"
@ -282,7 +287,7 @@ function setup_zpool () {
} }
function mount_system () { function mount_system () {
#1.7 #1.8
zfs mount "${zpool_name}"'/root/'"${zfs_arch_dataset_name}" zfs mount "${zpool_name}"'/root/'"${zfs_arch_dataset_name}"
zfs mount -a zfs mount -a
@ -295,7 +300,7 @@ function mount_system () {
} }
function copy_zpool_cache () { function copy_zpool_cache () {
#1.8 #1.9
mkdir -p '/mnt/etc/zfs' mkdir -p '/mnt/etc/zfs'
zpool set 'cachefile=/etc/zfs/'"${zpool_name}"'.cache' "${zpool_name}" zpool set 'cachefile=/etc/zfs/'"${zpool_name}"'.cache' "${zpool_name}"
} }
@ -322,7 +327,7 @@ function pacman_dont_check_space () {
} }
function install_archlinux () { function install_archlinux () {
#1.9 #1.10
pacman_dl_parallel pacman_dl_parallel
pacman_dont_check_space pacman_dont_check_space
pacstrap /mnt \ pacstrap /mnt \
@ -349,7 +354,7 @@ function install_archlinux () {
} }
function gen_fstab () { function gen_fstab () {
#1.10 #1.11
genfstab -U /mnt | grep -v "${zpool_name}" | tr -s '\n' | sed -r -e 's/\/mnt//' -e '/./,$!d' > '/mnt/etc/fstab' genfstab -U /mnt | grep -v "${zpool_name}" | tr -s '\n' | sed -r -e 's/\/mnt//' -e '/./,$!d' > '/mnt/etc/fstab'
} }
@ -362,7 +367,7 @@ EOF
} }
function set_hostname () { function set_hostname () {
#1.11 #1.12
declare new_hostname declare new_hostname
install_pkgs 'pwgen' install_pkgs 'pwgen'
new_hostname="$(pwgen --no-numerals --no-capitalize --ambiguous 8)" new_hostname="$(pwgen --no-numerals --no-capitalize --ambiguous 8)"
@ -371,7 +376,7 @@ function set_hostname () {
} }
function set_locale () { function set_locale () {
#1.12 #1.13
printf -- '%s\n' \ printf -- '%s\n' \
'KEYMAP=de-latin1' \ 'KEYMAP=de-latin1' \
'FONT=Lat2-Terminus16' \ 'FONT=Lat2-Terminus16' \
@ -382,7 +387,7 @@ function set_locale () {
} }
function add_zfs_hook_to_initramfs () { function add_zfs_hook_to_initramfs () {
#1.13 #1.14
# Add zfs hook, remove fsck hook from initramfs. # Add zfs hook, remove fsck hook from initramfs.
sed -ri \ sed -ri \
-e 's'$'\x1''(HOOKS=)(.*?[\(| ])(filesystems)([\)| ][^\r\n\f]*)'$'\x1''\1\2zfs \3\4'$'\x1''g' \ -e 's'$'\x1''(HOOKS=)(.*?[\(| ])(filesystems)([\)| ][^\r\n\f]*)'$'\x1''\1\2zfs \3\4'$'\x1''g' \
@ -397,7 +402,7 @@ function add_zfs_hook_to_initramfs () {
} }
function set_initramfs_build_list () { function set_initramfs_build_list () {
#1.14 #1.15
# No need to build fallback initramfs, our new fallback is ZFS snapshots # No need to build fallback initramfs, our new fallback is ZFS snapshots
sed -ri \ sed -ri \
-e '/^#/d' \ -e '/^#/d' \
@ -411,7 +416,7 @@ function set_initramfs_build_list () {
} }
function add_zfs_files_to_new_os () { function add_zfs_files_to_new_os () {
#1.15 #1.16
for zfs_file in '/etc/hostid' '/etc/zfs/zpool.cache' $([[ ! "${ARCHZBM_ZFSPROPS_NO_ENCRYPTION}" ]] && printf -- '%s' '/etc/zfs/'"${zpool_name}"'.key'); do 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}" rsync -av --itemize-changes {'','/mnt'}"${zfs_file}"
done done
@ -750,20 +755,21 @@ function main () {
install_os_in_chroot #2.2 install_os_in_chroot #2.2
else else
set_ntp #1.1 set_ntp #1.1
update_pacman_db #1.2 resize_cow_space #1.2
install_pkgs 'base-devel' 'git' 'jq' #1.3 update_pacman_db #1.3
prepare_zfsbootmenu_efi_bin_pkg #1.4 install_pkgs 'base-devel' 'git' 'jq' #1.4
install_zfs #1.5 prepare_zfsbootmenu_efi_bin_pkg #1.5
setup_zpool #1.6 install_zfs #1.6
mount_system #1.7 setup_zpool #1.7
copy_zpool_cache #1.8 mount_system #1.8
install_archlinux #1.9 copy_zpool_cache #1.9
gen_fstab #1.10 install_archlinux #1.10
set_hostname #1.11 gen_fstab #1.11
set_locale #1.12 set_hostname #1.12
add_zfs_hook_to_initramfs #1.13 set_locale #1.13
set_initramfs_build_list #1.14 add_zfs_hook_to_initramfs #1.14
add_zfs_files_to_new_os #1.15 set_initramfs_build_list #1.15
add_zfs_files_to_new_os #1.16
enter_chroot #2.1 enter_chroot #2.1
# We're done in chroot # We're done in chroot
finalize_os_setup #3.1 finalize_os_setup #3.1