diff options
| author | Daniel Baumann <daniel@debian.org> | 2012-07-02 17:48:44 +0200 |
|---|---|---|
| committer | Daniel Baumann <daniel@debian.org> | 2012-07-19 00:04:11 +0200 |
| commit | 19d21915752731725ec85eab1269e677186d573e (patch) | |
| tree | 3ca01107d5d6144733e4ac11a1e11b8b17fd8790 /scripts/boot/0120-read-only | |
| parent | 20830fef5068d1afb31b1d26573eca2e04ded30e (diff) | |
| download | live-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-x | scripts/boot/0120-read-only | 33 |
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 +} |
