refactor(zbm): We're not building in Arch Linux live CD ISO image (#3)

We don't need rsync anymore either since we
won't have to shuffle UEFI images around.
This commit is contained in:
hygienic-books 2023-10-21 05:03:09 +02:00
parent abffd08c1e
commit be63ed90ad

View File

@ -282,55 +282,6 @@ function mount_system () {
mount "${efi_part}" '/mnt/efi'
}
function prepare_zfsbootmenu_efi_bin_pkg () {
#1.8
# 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
# package 'zfsbootmenu-efi-bin' that we're using currently (Friday,
# October 20, 2023) identifies its target EFI system partition (ESP) by
# doing 'lsblk' and checking the partition type name. Since within
# arch-chroot there's no '/run/udev' but only an empty '/run' tmpfs
# 'lsblk' cannot see partition type names and some other pieces of info.
#
# See also
# https://gitlab.archlinux.org/archlinux/arch-install-scripts/-/issues/24
#
# Thus within arch-chroot the installation of 'zfsbootmenu-efi-bin' and
# even 'makepkg -s' fails. We build the package in our Arch Linux live
# CD ISO image and copy the resulting file into our chroot.
#
# We circle back to the package file when we chroot into Arch and
# install_zbm_image().
pacman_cache_dir='/var/cache/pacman/pkg'
chroot_pacman_cache_dir='/mnt'"${pacman_cache_dir}"
git_zbm_efi_bin_dir='/tmp/zfsbootmenu-efi-bin'
sudo -u 'arch' git -C '/tmp' clone 'https://aur.archlinux.org/zfsbootmenu-efi-bin.git'
# We briefly bind-mount our ESP into '/efi' before we build the package.
# Its PKGBUILD will then find the ESP at the correct location and write
# a package file with that internal location ('/efi').
mkdir -p '/efi'
mount --bind '/mnt/efi' '/efi'
pushd "${git_zbm_efi_bin_dir}"
sudo -u 'arch' makepkg -s || {
>&3 printf -- '%s\n' 'Failed building zfsbootmenu-efi-bin package. Exiting ...'
exit 77
}
popd
umount '/efi'
rmdir '/efi'
package_file_abs="$(find "${git_zbm_efi_bin_dir}" -type f -iname '*pkg.tar.zst')"
package_file="$(basename "${package_file_abs}")"
mkdir -p "${chroot_pacman_cache_dir}"
rsync -av "${package_file_abs}" "${chroot_pacman_cache_dir}"'/'"${package_file}" || {
>&3 printf -- '%s\n' 'Failed rsyncing zfsbootmenu-efi-bin package file into chroot. Exiting ...'
exit 77
}
export ZFSBOOTMENU_EFI_BIN_PKG_PATH="${pacman_cache_dir}"'/'"${package_file}"
rm -rf "${git_zbm_efi_bin_dir}"
}
function copy_zpool_cache () {
#1.9
mkdir -p '/mnt/etc/zfs'
@ -623,7 +574,7 @@ function install_os_in_chroot () {
add_motd_getting_started_msg #2.6
get_aur_helper #2.7
paru_install --replace-conflicting 'paru-bin'
paru_install 'zfs-dkms' 'zfs-utils' 'rsync'
paru_install 'zfs-dkms' 'zfs-utils' 'jq'
hwclock --systohc
mkinitcpio -P