aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap22
1 files changed, 17 insertions, 5 deletions
diff --git a/bootstrap b/bootstrap
index 16b42b5..7eae918 100755
--- a/bootstrap
+++ b/bootstrap
@@ -366,6 +366,15 @@ fi
#
if [ "$stage" -le "5" ]; then
+ # Generate buildid and store it in /etc/os-release and in buildos-buildid.
+ # These are used by the monitor to detect when it's time to reboot.
+ #
+ # Note that /etc/os-release is a symlink to /usr/lib/os-release.
+ #
+ buildid="$(uuidgen)"
+
+ sudo tee -a "$root/etc/os-release" >/dev/null <<<"BUILD_ID=\"$buildid\""
+
# Install init and buildos monitor.
#
sudo install -m 755 ./init "$root/"
@@ -379,6 +388,7 @@ if [ "$stage" -le "5" ]; then
cd "$root"
sudo cpio -o -H newc <<EOF | \
gzip -9 > "$owd/buildos-init.cpio.gz"
+usr/lib/os-release
init
usr/sbin/buildos
usr/lib/systemd/system/buildos.service
@@ -391,19 +401,19 @@ EOF
# Copy the kernel image next to the initramfs for convenience.
#
cp "$root/vmlinuz" buildos-image
+ echo "$buildid" >buildos-buildid
subvol_snapshot -r "$root" "$root-5"
fi
# Test.
#
-# To test PXE boot, replace -kernel/-initrd with '-boot n'.
-#
-
if [ ! -e /tmp/buildos-disk ]; then
qemu-img create -f raw /tmp/buildos-disk 100M
fi
+# To test PXE boot, replace -kernel/-initrd/-append with '-boot n'.
+#
sudo kvm \
-m 8G \
-device "e1000,netdev=net0,mac=$macaddr" \
@@ -411,5 +421,7 @@ sudo kvm \
-device "virtio-scsi-pci,id=scsi" \
-device "scsi-hd,drive=disk1" \
-drive "if=none,id=disk1,file=/tmp/buildos-disk,format=raw" \
- -kernel buildos-image -initrd buildos-initrd \
- -append "buildos.smtp_relay=build2.org buildos.admin_email=admin@build2.org"
+ -boot n
+
+# -kernel buildos-image -initrd buildos-initrd \
+# -append "buildos.smtp_relay=build2.org buildos.admin_email=admin@build2.org"