Skip to content

Commit

Permalink
Converting read-only initramfs-tools pre-mount script into regular li…
Browse files Browse the repository at this point in the history
…ve-boot script.
  • Loading branch information
daniel-baumann committed Jun 5, 2012
1 parent 4af5ca4 commit 5d6acf5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 35 deletions.
35 changes: 0 additions & 35 deletions initramfs-tools/scripts/live-premount/readonly

This file was deleted.

8 changes: 8 additions & 0 deletions scripts/boot.sh
Expand Up @@ -472,6 +472,14 @@ mountroot ()

Arguments

# make sure all harddisk devices are read-only
# this is important for forensic investigations
case "${READ_ONLY}" in
true)
Read_only
;;
esac

maybe_break live-premount
log_begin_msg "Running /scripts/live-premount"
run_scripts /scripts/live-premount
Expand Down
4 changes: 4 additions & 0 deletions scripts/boot/arguments.sh
Expand Up @@ -10,6 +10,10 @@ Arguments ()
for ARGUMENT in $(cat /proc/cmdline)
do
case "${ARGUMENT}" in
read-only)
READ_ONLY="true"
;;

skipconfig)
NOACCESSIBILITY="Yes"
NOFASTBOOT="Yes"
Expand Down
17 changes: 17 additions & 0 deletions scripts/boot/read-only.sh
@@ -0,0 +1,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
}

0 comments on commit 5d6acf5

Please sign in to comment.