Skip to content

Commit

Permalink
more tries...
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrero committed Jul 28, 2023
1 parent 23bbd2a commit 2290d44
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -euo pipefail
set -xeuo pipefail

boot_sector_size=440
esp_typeguid=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Expand All @@ -11,6 +11,7 @@ prep_typeguid=9e1a2d38-c612-4316-aa26-8b49521e5a8b
# "root" being set up.
ignition_cfg=/run/ignition.json
root_part=/dev/disk/by-label/root
root_label=root
boot_part=/dev/disk/by-label/boot
esp_part=/dev/disk/by-label/EFI-SYSTEM
bios_part=/dev/disk/by-partlabel/BIOS-BOOT
Expand Down Expand Up @@ -145,7 +146,7 @@ should_autosave_rootfs() {
# ag sizing at build time) which seems like a good rootfs size at which to
# discriminate between "throwaway/short-lived systems" and "long-running
# workload systems". It's not like XFS performance is way worse at 128.
echo "Filesystem agcount is $agcount"
echo "Filesystem agcount is $agcount" >&2
if [ "$agcount" -lt 128 ]; then
echo "Filesystem agcount < 128; skipping" >&2
echo 0
Expand Down Expand Up @@ -213,9 +214,12 @@ check_and_set_secex_config
root_karg=$(karg root)
if test -n "${root_karg}"; then
root_part=$root_karg
root_label=$(echo "$root_karg" | cut -d"/" -f5)
saved_root=${saved_data}/${root_label}
fi
echo "root_part is: ${root_part}"

echo "root_part is: ${root_part}" >&2
echo "root_label is: ${root_label}" >&2
echo "saved_root is: ${saved_root}" >&2

case "${1:-}" in
detect)
Expand Down Expand Up @@ -265,10 +269,10 @@ case "${1:-}" in
if [ ! -d "${saved_root}" ]; then
mkdir "${saved_root}"
echo "Moving rootfs to RAM..."
mount_and_save_filesystem_by_label root "${saved_root}"
mount_and_save_filesystem_by_label "${root_label}" "${saved_root}"
print_zram_mm_stat
fi
mkfs.xfs "${root_part}" -L root -f
mkfs.xfs "${root_part}" -L "${root_label}" -f
# for tests
touch /run/ignition-ostree-autosaved-xfs.stamp
fi
Expand All @@ -277,7 +281,7 @@ case "${1:-}" in
# Mounts happen in a private mount namespace since we're not "offically" mounting
if [ -d "${saved_root}" ]; then
echo "Moving rootfs to RAM..."
mount_and_save_filesystem_by_label root "${saved_root}"
mount_and_save_filesystem_by_label "${root_label}" "${saved_root}"
# also store the state of the partition
lsblk "${root_part}" --nodeps --pairs -b --paths -o NAME,TYPE,SIZE > "${partstate_root}"
fi
Expand Down Expand Up @@ -310,7 +314,7 @@ case "${1:-}" in
# Mounts happen in a private mount namespace since we're not "offically" mounting
if [ -d "${saved_root}" ]; then
echo "Restoring rootfs from RAM..."
mount_and_restore_filesystem_by_label root /sysroot "${saved_root}"
mount_and_restore_filesystem_by_label "${root_label}" /sysroot "${saved_root}"
chcon -v --reference "${saved_root}" /sysroot # the root of the fs itself
chattr +i $(ls -d /sysroot/ostree/deploy/*/deploy/*/)
fi
Expand Down

0 comments on commit 2290d44

Please sign in to comment.