projects
/
live-boot-grml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Release new version 1:20210208+grml.5
[live-boot-grml.git]
/
components
/
0020-read-only
diff --git
a/components/0020-read-only
b/components/0020-read-only
index
a2c86ef
..
84d73ef
100755
(executable)
--- a/
components/0020-read-only
+++ b/
components/0020-read-only
@@
-29,32
+29,45
@@
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.
# Marking some block devices as read-only to ensure that nothing
# gets written as linux still writes to 'only' read-only mounted filesystems.
- LIVE_READ_ONLY_DEVICES="${LIVE_READ_ONLY_DEVICES:-/dev/
sd* /dev/vd
*}"
+ LIVE_READ_ONLY_DEVICES="${LIVE_READ_ONLY_DEVICES:-/dev/
* /dev/*/
*}"
for _DEVICE in $(echo ${LIVE_READ_ONLY_DEVICES} | sed -e 's|,| |g')
do
for _DEVICE in $(echo ${LIVE_READ_ONLY_DEVICES} | sed -e 's|,| |g')
do
+ # ignore symlinks like /dev/cdrom, /dev/block/* which point to actual devices
+ if [ -L "${_DEVICE}" ]
+ then
+ continue
+ fi
+
+ # only consider actual block devices
if [ ! -b "${_DEVICE}" ]
then
continue
fi
if [ ! -b "${_DEVICE}" ]
then
continue
fi
- echo -n "live-boot: Setting ${_DEVICE} read-only..." > /dev/console
+ if ! blockdev --getsz "${_DEVICE}" >/dev/null 2>&1
+ then
+ printf " * live-boot: Ignoring '%-10s' (not present?)\n" "${_DEVICE}" > /dev/console
+ continue
+ fi
+
+ printf " * live-boot: Setting %-10s read-only..." "${_DEVICE}" > /dev/console
- blockdev --setro
${_DEVICE}
+ blockdev --setro
"${_DEVICE}"
_RETURN="${?}"
case "${_RETURN}" in
0)
_RETURN="${?}"
case "${_RETURN}" in
0)
-
echo " done, use 'blockdev --setrw ${_DEVICE}' to set read-write.
" > /dev/console
+
printf " done, use 'blockdev --setrw %-10s' to set read-write.\n" "${_DEVICE}
" > /dev/console
;;
*)
;;
*)
-
echo " failed.
" > /dev/console
+
printf " failed.\n
" > /dev/console
;;
esac
done
;;
esac
done
- if grep -q
e
persistence /proc/cmdline
+ if grep -q
w
persistence /proc/cmdline
then
printf " * Persistence mode enabled, searching for persistency related devices to unlock\n" >/dev/console
then
printf " * Persistence mode enabled, searching for persistency related devices to unlock\n" >/dev/console