From c3ee1e555f808cb15056a9e3d678ccbdb108fc0c Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 31 Aug 2022 15:02:34 -0400 Subject: [PATCH] create_disk: Set repository options early These repository options should be set from the start to ensure they're honored for the initial deployment too. Prep for using `sysroot.bootprefix = true` from https://github.com/ostreedev/ostree/pull/2705 --- src/create_disk.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/create_disk.sh b/src/create_disk.sh index ffe1b227ac..cdb69b1875 100755 --- a/src/create_disk.sh +++ b/src/create_disk.sh @@ -161,6 +161,11 @@ fi if [ "${rootfs_size}" != "0" ]; then rootfs_size="+${rootfs_size}" fi + +# we use pure BLS on most architectures; this may +# be overridden below +bootloader_backend=none + # shellcheck disable=SC2031 case "$arch" in x86_64) @@ -183,6 +188,7 @@ case "$arch" in -n ${ROOTPN}:0:"${rootfs_size}" -c ${ROOTPN}:root -t ${ROOTPN}:0FC63DAF-8483-4772-8E79-3D69D8477DE4 ;; s390x) + bootloader_backend=zipl sgdisk_args=() if [[ ${secure_execution} -eq 1 ]]; then # shellcheck disable=SC2206 @@ -311,6 +317,10 @@ fi # Now that we have the basic disk layout, initialize the basic # OSTree layout, load in the ostree commit and deploy it. ostree admin init-fs --modern $rootfs +ostree config --repo $rootfs/ostree/repo set sysroot.bootloader "${bootloader_backend}" +# Opt-in to https://github.com/ostreedev/ostree/pull/1767 AKA +# https://github.com/ostreedev/ostree/issues/1265 +ostree config --repo $rootfs/ostree/repo set sysroot.readonly true # Initialize the "stateroot" ostree admin os-init "$os_name" --sysroot $rootfs @@ -388,10 +398,6 @@ cat > $rootfs/.coreos-aleph-version.json << EOF } EOF -# we use pure BLS on most architectures; this may -# be overridden below -bootloader_backend=none - install_uefi() { # https://github.com/coreos/fedora-coreos-tracker/issues/510 # See also https://github.com/ostreedev/ostree/pull/1873#issuecomment-524439883 @@ -485,7 +491,6 @@ ppc64le) install_grub_cfg ;; s390x) - bootloader_backend=zipl # XXX: switch to using --append-karg once we have new enough rdcore # https://github.com/coreos/coreos-installer/pull/950 rdcore_zipl_args=("--boot-mount=$rootfs/boot" "--kargs=ignition.firstboot") @@ -499,10 +504,6 @@ s390x) ;; esac -ostree config --repo $rootfs/ostree/repo set sysroot.bootloader "${bootloader_backend}" -# Opt-in to https://github.com/ostreedev/ostree/pull/1767 AKA -# https://github.com/ostreedev/ostree/issues/1265 -ostree config --repo $rootfs/ostree/repo set sysroot.readonly true # enable support for GRUB password if [ "${bootloader_backend}" = "none" ]; then ostree config --repo $rootfs/ostree/repo set sysroot.bls-append-except-default 'grub_users=""'