3-xen-orchestra-install #4
108
setup.sh
108
setup.sh
@ -53,55 +53,6 @@ function install_zfs () {
|
|||||||
printf -- "${reset_colors}"
|
printf -- "${reset_colors}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare_zfsbootmenu_efi_bin_pkg () {
|
|
||||||
#1.6
|
|
||||||
# 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 || {
|
|
||||||
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}" || {
|
|
||||||
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 get_partitions () {
|
function get_partitions () {
|
||||||
declare partitions_json
|
declare partitions_json
|
||||||
partitions_json="$(lsblk --output PATH,PARTTYPE --json --tree)" || return 1
|
partitions_json="$(lsblk --output PATH,PARTTYPE --json --tree)" || return 1
|
||||||
@ -267,7 +218,7 @@ function export_pool () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setup_zpool () {
|
function setup_zpool () {
|
||||||
#1.7
|
#1.6
|
||||||
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}")"
|
||||||
@ -287,7 +238,7 @@ function setup_zpool () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mount_system () {
|
function mount_system () {
|
||||||
#1.8
|
#1.7
|
||||||
zfs mount "${zpool_name}"'/root/'"${zfs_arch_dataset_name}"
|
zfs mount "${zpool_name}"'/root/'"${zfs_arch_dataset_name}"
|
||||||
zfs mount -a
|
zfs mount -a
|
||||||
|
|
||||||
@ -299,6 +250,55 @@ function mount_system () {
|
|||||||
mount "${efi_part}" '/mnt/efi'
|
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 || {
|
||||||
|
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}" || {
|
||||||
|
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 () {
|
function copy_zpool_cache () {
|
||||||
#1.9
|
#1.9
|
||||||
mkdir -p '/mnt/etc/zfs'
|
mkdir -p '/mnt/etc/zfs'
|
||||||
@ -759,9 +759,9 @@ function main () {
|
|||||||
update_pacman_db #1.3
|
update_pacman_db #1.3
|
||||||
install_pkgs 'base-devel' 'git' 'jq' #1.4
|
install_pkgs 'base-devel' 'git' 'jq' #1.4
|
||||||
install_zfs #1.5
|
install_zfs #1.5
|
||||||
prepare_zfsbootmenu_efi_bin_pkg #1.6
|
setup_zpool #1.6
|
||||||
setup_zpool #1.7
|
mount_system #1.7
|
||||||
mount_system #1.8
|
prepare_zfsbootmenu_efi_bin_pkg #1.8
|
||||||
copy_zpool_cache #1.9
|
copy_zpool_cache #1.9
|
||||||
install_archlinux #1.10
|
install_archlinux #1.10
|
||||||
gen_fstab #1.11
|
gen_fstab #1.11
|
||||||
|
Loading…
x
Reference in New Issue
Block a user