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>
|
2008-11-03 21:01:01 +05:30
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
|
|
|
|
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-07-01 04:37:32 +05:30
|
|
|
keyword -prefix -openvz -vserver
|
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
|
|
|
|
local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS
|
|
|
|
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
|
|
|
if [ "$SIFS" = y ]; then
|
2008-11-03 21:01:01 +05:30
|
|
|
IFS=$OIFS
|
|
|
|
else
|
|
|
|
unset IFS
|
|
|
|
fi
|
2009-04-27 13:21:18 +05:30
|
|
|
m="^($m)$"
|
2008-11-03 21:01:01 +05:30
|
|
|
fs=
|
2009-04-27 13:21:18 +05:30
|
|
|
for x in $net_fs_list; do
|
|
|
|
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 $?
|
|
|
|
}
|