Splitting out already reviewed cmdline parsing script.
[debian-live-boot.git] / scripts / boot / 9990-read-only.sh
blob48aa06c3960450d8aaae654de75c4c2569502982
1 #!/bin/sh
3 #set -e
5 Read_only ()
7 # Marking some block devices as read-only to ensure that nothing
8 # gets written as linux still writes to 'only' read-only mounted filesystems.
9 _DEVICES="/dev/sd* /dev/vd*"
11 for _DEVICE in ${_DEVICES}
13 if [ ! -b "${_DEVICE}" ]
14 then
15 continue
18 echo -n "Setting ${_DEVICE} read-only..." > /dev/console
20 blockdev --setro ${_DEVICE}
21 _RETURN="${?}"
23 case "${_RETURN}" in
25 echo " done, use 'blockdev --setrw ${_DEVICE}' to set read-write." > /dev/console
29 echo " failed." > /dev/console
31 esac
32 done