summaryrefslogtreecommitdiff
path: root/scripts/boot/0120-read-only
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2012-07-02 17:48:44 +0200
committerDaniel Baumann <daniel@debian.org>2012-07-19 00:04:11 +0200
commit19d21915752731725ec85eab1269e677186d573e (patch)
tree3ca01107d5d6144733e4ac11a1e11b8b17fd8790 /scripts/boot/0120-read-only
parent20830fef5068d1afb31b1d26573eca2e04ded30e (diff)
downloadlive-boot-19d21915752731725ec85eab1269e677186d573e.tar.gz
live-boot-19d21915752731725ec85eab1269e677186d573e.zip
Splitting out already reviewed read-only script.
Diffstat (limited to 'scripts/boot/0120-read-only')
-rwxr-xr-xscripts/boot/0120-read-only33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/boot/0120-read-only b/scripts/boot/0120-read-only
new file mode 100755
index 0000000..588d57b
--- /dev/null
+++ b/scripts/boot/0120-read-only
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+#set -e
+
+Read_only ()
+{
+ # Marking some block devices as read-only to ensure that nothing
+ # gets written as linux still writes to 'only' read-only mounted filesystems.
+ _DEVICES="/dev/sd* /dev/vd*"
+
+ for _DEVICE in ${_DEVICES}
+ do
+ if [ ! -b "${_DEVICE}" ]
+ then
+ continue
+ fi
+
+ echo -n "live-boot: Setting ${_DEVICE} read-only..." > /dev/console
+
+ blockdev --setro ${_DEVICE}
+ _RETURN="${?}"
+
+ case "${_RETURN}" in
+ 0)
+ echo " done, use 'blockdev --setrw ${_DEVICE}' to set read-write." > /dev/console
+ ;;
+
+ *)
+ echo " failed." > /dev/console
+ ;;
+ esac
+ done
+}