5
5
# NOTE: should /host be in fstab
9
# Required-Start: mountdevsubfs
9
# Required-Start: mountdevsubfs
13
# Short-Description: Remount /host folder read write.
13
# Short-Description: Remount /host folder read write.
19
19
. /lib/lsb/init-functions
22
[ "$VERBOSE" = no ] || log_action_begin_msg "Mounting host filesystem read-write"
22
[ "$VERBOSE" = no ] || log_action_begin_msg "Mounting host filesystem read-write"
31
loop_file=$(awk '$2=="/" && $4~"loop" {print $1}' /etc/fstab)
32
host_device=$(awk '"'${loop_file}'"~"^"$2 && $2!="/" {print $1}' /proc/mounts)
30
loopfile_fstab_line=$(sed -n '\:^/[^ ]*[ ]*[ ]/[ ][ ]*[^ ]*[ ].*loop.*[ ]:p' /etc/fstab)
31
host_mountpoint=${loopfile_fstab_line%% *}
32
while [ -z "$host_device" ] && [ -n "$host_mountpoint" ] && [ ! "$host_mountpoint" = "/" ]; do
33
host_mountpoint="${host_mountpoint%/*}"
34
host_device=$(sed -n "\:^/[^ ]*[ ]*[ ]$host_mountpoint :p" /proc/mounts)
35
host_device=${host_device%% *}
33
37
if [ -n "$host_device" ]; then
34
38
if [ "$hostcheck" = yes ]; then
36
! mount -n -o remount,ro $host_device /host \
37
&& ! mount -n -o remount,ro -t dummytype $host_device /host 2>/dev/null \
38
&& ! mount -n -o remount,ro $host_device /host 2>/dev/null
40
! mount -n -o remount,ro "$host_device" /host \
41
&& ! mount -n -o remount,ro -t dummytype "$host_device" /host 2>/dev/null \
42
&& ! mount -n -o remount,ro "$host_device" /host 2>/dev/null
40
44
log_failure_msg "Cannot check host file system because it is not mounted read-only."
43
47
#TBD add fs checking
44
48
#skipping since not supported by ntfs-3g
46
mount -n -o remount,$hostopts,$hostmode $host_device /host
50
mount -n -o remount,$hostopts,$hostmode "$host_device" /host
50
[ "$VERBOSE" = no ] || log_action_end_msg $ES
53
[ "$VERBOSE" = no ] || log_action_end_msg "$ES"
57
60
restart|reload|force-reload)
58
echo "Error: argument '$1' not supported" >&2
61
echo "Error: argument '$1' not supported" >&2
65
echo "Usage: $0 start|stop" >&2
68
echo "Usage: $0 start|stop" >&2