2008-11-03 21:01:01 +05:30
|
|
|
#!@PREFIX@/sbin/runscript
|
2009-05-01 19:41:40 +05:30
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2011-06-30 05:16:31 +05:30
|
|
|
# Released under the 2-clause BSD license.
|
2008-11-03 21:01:01 +05:30
|
|
|
|
2008-11-03 21:46:12 +05:30
|
|
|
description="Re-mount filesytems read-only for a clean reboot."
|
|
|
|
|
2008-11-03 21:01:01 +05:30
|
|
|
depend()
|
|
|
|
{
|
|
|
|
need killprocs savecache
|
2009-11-05 00:51:24 +05:30
|
|
|
keyword -prefix -openvz -vserver -lxc
|
2008-11-03 21:01:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
|
|
|
# Flush all pending disk writes now
|
|
|
|
sync; sync
|
|
|
|
|
|
|
|
ebegin "Remounting remaining filesystems read-only"
|
|
|
|
# We need the do_unmount function
|
2009-05-24 01:08:12 +05:30
|
|
|
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
2008-11-03 21:01:01 +05:30
|
|
|
eindent
|
|
|
|
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
|
2009-04-27 13:21:18 +05:30
|
|
|
m="$m|/bin|/sbin|/lib|/libexec"
|
2008-11-03 21:01:01 +05:30
|
|
|
# RC_NO_UMOUNTS is an env var that can be set by plugins
|
2011-07-07 22:21:39 +05:30
|
|
|
local IFS="$IFS:"
|
2009-04-27 13:21:18 +05:30
|
|
|
for x in $no_umounts $RC_NO_UMOUNTS; do
|
|
|
|
m="$m|$x"
|
2008-11-03 21:01:01 +05:30
|
|
|
done
|
2009-04-27 13:21:18 +05:30
|
|
|
m="^($m)$"
|
2008-11-03 21:01:01 +05:30
|
|
|
fs=
|
2011-07-06 01:03:21 +05:30
|
|
|
for x in $net_fs_list $extra_net_fs_list; do
|
2009-04-27 13:21:18 +05:30
|
|
|
fs="$fs${fs:+|}$x"
|
2008-11-03 21:01:01 +05:30
|
|
|
done
|
2009-04-27 13:21:18 +05:30
|
|
|
[ -n "$fs" ] && fs="^($fs)$"
|
2008-11-04 17:00:15 +05:30
|
|
|
do_unmount "umount -r" \
|
2009-04-27 13:21:18 +05:30
|
|
|
--skip-point-regex "$m" \
|
|
|
|
${fs:+--skip-fstype-regex} $fs --nonetdev
|
2008-11-03 21:01:01 +05:30
|
|
|
eoutdent
|
|
|
|
eend $?
|
|
|
|
}
|