From 19d21915752731725ec85eab1269e677186d573e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 2 Jul 2012 17:48:44 +0200 Subject: Splitting out already reviewed read-only script. --- scripts/boot/0120-read-only | 33 +++++++++++++++++++++++++++++++++ scripts/boot/9990-read-only.sh | 33 --------------------------------- 2 files changed, 33 insertions(+), 33 deletions(-) create mode 100755 scripts/boot/0120-read-only delete mode 100755 scripts/boot/9990-read-only.sh (limited to 'scripts') 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 +} diff --git a/scripts/boot/9990-read-only.sh b/scripts/boot/9990-read-only.sh deleted file mode 100755 index 48aa06c..0000000 --- a/scripts/boot/9990-read-only.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/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 "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 -} -- cgit v1.2.3