From 34105077c777b0d2c5c69f39921f376b84ce1443 Mon Sep 17 00:00:00 2001 From: Philip J Freeman Date: Sat, 31 May 2025 12:34:14 -0700 Subject: Deploying a demo amd64 debian-based OS via ostree This is a prototype outline for building and deploying a debian based OS with ostree. For purposes of demonstration, the OS runs from a bootable USB device on a UEFI capable amd64 machine. Once a USB device is created and booted, the OS can be updated using a simple shell script. --- hooks/build-os-post/40-ostree-demo-scripts | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 hooks/build-os-post/40-ostree-demo-scripts (limited to 'hooks/build-os-post/40-ostree-demo-scripts') diff --git a/hooks/build-os-post/40-ostree-demo-scripts b/hooks/build-os-post/40-ostree-demo-scripts new file mode 100755 index 0000000..6ea5627 --- /dev/null +++ b/hooks/build-os-post/40-ostree-demo-scripts @@ -0,0 +1,36 @@ +#!/bin/bash -xe + +set -o pipefail + +cat > "${root:?}"/usr/sbin/halo-upgrade << EOF +#!/bin/bash -e + +set -o pipefail + +remote="${remote:?}" +branch="${branch:?}" + +remote_ref=\$(ostree remote refs -r "\$remote" | egrep ^"\$remote":"\$branch"'\\s' | awk '{print \$2}') +local_ref=\$(ostree refs -r | egrep ^"\$remote":"\$branch"'\\s' | awk '{print \$2}') + +if [ "\$local_ref" != "\$remote_ref" -a -n "\$remote_ref" ]; then + echo "OS Update available. Installing..." + + set -x + + ostree admin upgrade + + grub-mkconfig -o /boot/grub/grub.cfg + + set +x + + echo "OS Update Installed. Press Enter to Reboot..." + + read + + reboot +else + echo "No OS Update found." +fi +EOF +chmod 755 "${root:?}"/usr/sbin/halo-upgrade -- cgit v1.2.3