summaryrefslogtreecommitdiff
path: root/scripts/boot/read-only.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2012-06-05 18:16:05 +0200
committerDaniel Baumann <daniel@debian.org>2012-06-05 19:35:56 +0200
commitbc9ae2d777db55ecb3697185da60ece205b1b90b (patch)
treea59a83745fcf5f839cae54922754cea06198ca01 /scripts/boot/read-only.sh
parentbe6b2f51059e0604bd3728e6cd603972df8cf619 (diff)
downloadlive-boot-bc9ae2d777db55ecb3697185da60ece205b1b90b.tar.gz
live-boot-bc9ae2d777db55ecb3697185da60ece205b1b90b.zip
Updating read-only handling to new parameter handling.
Diffstat (limited to 'scripts/boot/read-only.sh')
-rwxr-xr-xscripts/boot/read-only.sh28
1 files changed, 22 insertions, 6 deletions
diff --git a/scripts/boot/read-only.sh b/scripts/boot/read-only.sh
index c8990df..48aa06c 100755
--- a/scripts/boot/read-only.sh
+++ b/scripts/boot/read-only.sh
@@ -4,14 +4,30 @@
Read_only ()
{
- # Marking the usual block devices for harddisks read-only
- for _DEVICE in /dev/sd* /dev/vd*
+ # 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}" ]
+ if [ ! -b "${_DEVICE}" ]
then
- printf "Setting device %-9s to read-only mode:" ${_DEVICE} > /dev/console
-
- blockdev --setro ${_DEVICE} && printf " done [ execute \"blockdev --setrw %-9s\" to unlock]\n" ${_DEVICE} > /dev/console || printf "failed\n" > /dev/console
+ 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
}