summaryrefslogtreecommitdiff
path: root/scripts/boot/read-only.sh
blob: c8990dfcf0dbeb6fea44fab532cbd56bf814f287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

#set -e

Read_only ()
{
	# Marking the usual block devices for harddisks read-only
	for _DEVICE in /dev/sd* /dev/vd*
	do
		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
		fi
	done
}