commit 3583d886ec08f217dc6115d77ccf0fcbcf906006
parent 9ccb48850d6cf46081c12be6d78971d7ef32fe3c
Author: sin <sin@2f30.org>
Date: Wed, 8 Feb 2017 17:51:30 +0000
Add script to turn OpenBSD installation to read-only
Assumes a single root partition, to be run once then reboot.
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/ro-openbsd b/ro-openbsd
@@ -0,0 +1,17 @@
+#!/bin/sh -xe
+pkg_add rsync
+mkdir -p /mfs/{dev,var}
+cp /dev/MAKEDEV /mfs/dev
+cd /mfs/dev
+sh MAKEDEV all
+rsync -vhaz --delete -f "- *.sock" /var/ /mfs/var/
+sed -i 's/ffs rw/ffs ro/' /etc/fstab
+echo "swap /dev mfs rw,-P=/mfs/dev,-s=8m 0 0" >> /etc/fstab
+echo "swap /var mfs rw,-P=/mfs/var,-s=24m 0 0" >> /etc/fstab
+echo "swap /tmp mfs rw,-s=24m 0 0" >> /etc/fstab
+cp /etc/examples/rc.shutdown /etc
+cat << EOF >> /etc/rc.shutdown
+mount -uw /
+/usr/local/bin/rsync -vhaz --delete -f "- *.sock" /var/ /mfs/var/
+mount -ur /
+EOF