2013-12-22 02:21:11 +05:30
|
|
|
#!@SBINDIR@/openrc-run
|
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
|
2015-04-29 06:33:49 +05:30
|
|
|
keyword -openvz -prefix -systemd-nspawn -vserver -lxc
|
2008-11-03 21:01:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
2012-08-19 02:07:15 +05:30
|
|
|
local ret=0
|
|
|
|
|
2008-11-03 21:01:01 +05:30
|
|
|
# Flush all pending disk writes now
|
2013-10-19 02:56:46 +05:30
|
|
|
sync
|
2008-11-03 21:01:01 +05:30
|
|
|
|
|
|
|
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
|
2011-09-11 18:42:54 +05:30
|
|
|
|
|
|
|
# Bug 381783
|
|
|
|
local rc_svcdir=$(echo $RC_SVCDIR | sed 's:/lib\(32\|64\)\?/:/lib(32|64)?/:g')
|
|
|
|
|
2012-05-03 01:10:16 +05:30
|
|
|
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|/run|${rc_svcdir}" x= fs=
|
2011-09-11 18:42:54 +05:30
|
|
|
m="$m|/bin|/sbin|/lib(32|64)?|/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" \
|
2011-09-11 18:42:54 +05:30
|
|
|
"${fs:+--skip-fstype-regex}" $fs --nonetdev
|
2012-08-19 02:07:15 +05:30
|
|
|
ret=$?
|
|
|
|
|
2008-11-03 21:01:01 +05:30
|
|
|
eoutdent
|
2012-08-19 02:07:15 +05:30
|
|
|
|
|
|
|
eend $ret
|
2008-11-03 21:01:01 +05:30
|
|
|
}
|