Skip to content

Commit

Permalink
create_disk: Set repository options early
Browse files Browse the repository at this point in the history
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
ostreedev/ostree#2705
  • Loading branch information
cgwalters committed Aug 31, 2022
1 parent 3991e6f commit 821cc61
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/create_disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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=""'
Expand Down

0 comments on commit 821cc61

Please sign in to comment.