2013-12-22 02:21:11 +05:30
|
|
|
|
#!@SBINDIR@/openrc-run
|
2015-12-05 04:22:19 +05:30
|
|
|
|
# Copyright (c) 2007-2015 The OpenRC Authors.
|
|
|
|
|
# See the Authors file at the top-level directory of this distribution and
|
2021-12-21 06:37:00 +05:30
|
|
|
|
# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
|
2015-12-05 04:22:19 +05:30
|
|
|
|
#
|
|
|
|
|
# This file is part of OpenRC. It is subject to the license terms in
|
|
|
|
|
# the LICENSE file found in the top-level directory of this
|
2021-12-21 06:37:00 +05:30
|
|
|
|
# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
|
2015-12-05 04:22:19 +05:30
|
|
|
|
# This file may not be copied, modified, propagated, or distributed
|
|
|
|
|
# except according to the terms contained in the LICENSE file.
|
2007-11-14 20:52:04 +05:30
|
|
|
|
|
2008-01-11 17:43:46 +05:30
|
|
|
|
depend()
|
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
|
need localmount
|
|
|
|
|
before logger
|
2013-12-08 23:53:56 +05:30
|
|
|
|
after clock root sysctl
|
2012-07-03 08:34:22 +05:30
|
|
|
|
keyword -prefix -timeout
|
2007-04-05 16:48:42 +05:30
|
|
|
|
}
|
|
|
|
|
|
2009-04-27 13:21:18 +05:30
|
|
|
|
: ${wipe_tmp:=${WIPE_TMP:-yes}}
|
2011-09-27 21:45:08 +05:30
|
|
|
|
: ${log_dmesg:=${LOG_DMESG:-yes}}
|
2009-04-27 13:21:18 +05:30
|
|
|
|
|
2008-01-11 17:43:46 +05:30
|
|
|
|
cleanup_tmp_dir()
|
|
|
|
|
{
|
2008-04-09 05:36:50 +05:30
|
|
|
|
local dir="$1"
|
2007-09-09 21:22:05 +05:30
|
|
|
|
|
2009-04-27 13:21:18 +05:30
|
|
|
|
if ! [ -d "$dir" ]; then
|
|
|
|
|
mkdir -p "$dir" || return $?
|
2008-04-09 04:55:48 +05:30
|
|
|
|
fi
|
2012-01-29 00:02:05 +05:30
|
|
|
|
checkpath -W "$dir" || return 1
|
2011-01-07 05:50:53 +05:30
|
|
|
|
chmod a+rwt "$dir" 2> /dev/null
|
bootmisc: clean up tmpdir cleaning
Make sure that the `cd` into the $dir actually happened. This we don't
have to worry about relative paths deleting stuff it shouldn't. This
step shouldn't fail, but who knows, and better to be sane than to wipe
out someone's valuables.
When wiping, automatically fall back to a dedicated `find` if the initial
`rm` failed on us. This should help with the speed issues related to the
later `find`.
Have the later find only search the top level allowing `rm` to walk the
directory contents. This means that -xdev no longer applies, but since
the earlier `rm` wasn't doing -xdev either and no one has complained thus
far, let's assume it isn't an issue. Also convert to the -exec...+ form
so that we don't have to worry about long argument lists, and add -- to
the `rm` that was previously missing. In practice, this shouldn't matter
as we've already deleted all those files, but better safe than sorry.
When cleaning, since we've already done a `cd` into the $dir, no point in
prefixing all the paths with $dir too. Go with the relative loving.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
X-Gentoo-Bug: 359831
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=359831
2011-03-24 00:12:42 +05:30
|
|
|
|
cd "$dir" || return 1
|
2009-04-27 13:21:18 +05:30
|
|
|
|
if yesno $wipe_tmp; then
|
|
|
|
|
ebegin "Wiping $dir directory"
|
2007-09-09 21:22:05 +05:30
|
|
|
|
|
bootmisc: clean up tmpdir cleaning
Make sure that the `cd` into the $dir actually happened. This we don't
have to worry about relative paths deleting stuff it shouldn't. This
step shouldn't fail, but who knows, and better to be sane than to wipe
out someone's valuables.
When wiping, automatically fall back to a dedicated `find` if the initial
`rm` failed on us. This should help with the speed issues related to the
later `find`.
Have the later find only search the top level allowing `rm` to walk the
directory contents. This means that -xdev no longer applies, but since
the earlier `rm` wasn't doing -xdev either and no one has complained thus
far, let's assume it isn't an issue. Also convert to the -exec...+ form
so that we don't have to worry about long argument lists, and add -- to
the `rm` that was previously missing. In practice, this shouldn't matter
as we've already deleted all those files, but better safe than sorry.
When cleaning, since we've already done a `cd` into the $dir, no point in
prefixing all the paths with $dir too. Go with the relative loving.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
X-Gentoo-Bug: 359831
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=359831
2011-03-24 00:12:42 +05:30
|
|
|
|
# Faster than raw find
|
2012-11-07 04:19:49 +05:30
|
|
|
|
if ! rm -rf -- [!ajlq\.]* 2>/dev/null ; then
|
bootmisc: clean up tmpdir cleaning
Make sure that the `cd` into the $dir actually happened. This we don't
have to worry about relative paths deleting stuff it shouldn't. This
step shouldn't fail, but who knows, and better to be sane than to wipe
out someone's valuables.
When wiping, automatically fall back to a dedicated `find` if the initial
`rm` failed on us. This should help with the speed issues related to the
later `find`.
Have the later find only search the top level allowing `rm` to walk the
directory contents. This means that -xdev no longer applies, but since
the earlier `rm` wasn't doing -xdev either and no one has complained thus
far, let's assume it isn't an issue. Also convert to the -exec...+ form
so that we don't have to worry about long argument lists, and add -- to
the `rm` that was previously missing. In practice, this shouldn't matter
as we've already deleted all those files, but better safe than sorry.
When cleaning, since we've already done a `cd` into the $dir, no point in
prefixing all the paths with $dir too. Go with the relative loving.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
X-Gentoo-Bug: 359831
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=359831
2011-03-24 00:12:42 +05:30
|
|
|
|
# Blah, too many files
|
2012-11-07 04:31:42 +05:30
|
|
|
|
find . -maxdepth 1 -name '[!ajlq\.]*' -exec rm -rf -- {} +
|
bootmisc: clean up tmpdir cleaning
Make sure that the `cd` into the $dir actually happened. This we don't
have to worry about relative paths deleting stuff it shouldn't. This
step shouldn't fail, but who knows, and better to be sane than to wipe
out someone's valuables.
When wiping, automatically fall back to a dedicated `find` if the initial
`rm` failed on us. This should help with the speed issues related to the
later `find`.
Have the later find only search the top level allowing `rm` to walk the
directory contents. This means that -xdev no longer applies, but since
the earlier `rm` wasn't doing -xdev either and no one has complained thus
far, let's assume it isn't an issue. Also convert to the -exec...+ form
so that we don't have to worry about long argument lists, and add -- to
the `rm` that was previously missing. In practice, this shouldn't matter
as we've already deleted all those files, but better safe than sorry.
When cleaning, since we've already done a `cd` into the $dir, no point in
prefixing all the paths with $dir too. Go with the relative loving.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
X-Gentoo-Bug: 359831
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=359831
2011-03-24 00:12:42 +05:30
|
|
|
|
fi
|
2007-09-09 21:22:05 +05:30
|
|
|
|
|
2010-11-01 00:09:41 +05:30
|
|
|
|
# pam_mktemp creates a .private directory within which
|
|
|
|
|
# each user gets a private directory with immutable
|
|
|
|
|
# bit set; remove the immutable bit before trying to
|
|
|
|
|
# remove it.
|
2010-11-27 02:24:30 +05:30
|
|
|
|
[ -d /tmp/.private ] && chattr -R -a /tmp/.private 2> /dev/null
|
2010-11-01 00:09:41 +05:30
|
|
|
|
|
bootmisc: clean up tmpdir cleaning
Make sure that the `cd` into the $dir actually happened. This we don't
have to worry about relative paths deleting stuff it shouldn't. This
step shouldn't fail, but who knows, and better to be sane than to wipe
out someone's valuables.
When wiping, automatically fall back to a dedicated `find` if the initial
`rm` failed on us. This should help with the speed issues related to the
later `find`.
Have the later find only search the top level allowing `rm` to walk the
directory contents. This means that -xdev no longer applies, but since
the earlier `rm` wasn't doing -xdev either and no one has complained thus
far, let's assume it isn't an issue. Also convert to the -exec...+ form
so that we don't have to worry about long argument lists, and add -- to
the `rm` that was previously missing. In practice, this shouldn't matter
as we've already deleted all those files, but better safe than sorry.
When cleaning, since we've already done a `cd` into the $dir, no point in
prefixing all the paths with $dir too. Go with the relative loving.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
X-Gentoo-Bug: 359831
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=359831
2011-03-24 00:12:42 +05:30
|
|
|
|
# Prune the paths that are left
|
|
|
|
|
find . -maxdepth 1 \
|
|
|
|
|
! -name . \
|
|
|
|
|
! -name lost+found \
|
|
|
|
|
! -name quota.user \
|
|
|
|
|
! -name aquota.user \
|
|
|
|
|
! -name quota.group \
|
|
|
|
|
! -name aquota.group \
|
|
|
|
|
! -name journal \
|
|
|
|
|
-exec rm -rf -- {} +
|
2007-09-09 21:22:05 +05:30
|
|
|
|
eend 0
|
|
|
|
|
else
|
2009-04-27 13:21:18 +05:30
|
|
|
|
ebegin "Cleaning $dir directory"
|
bootmisc: clean up tmpdir cleaning
Make sure that the `cd` into the $dir actually happened. This we don't
have to worry about relative paths deleting stuff it shouldn't. This
step shouldn't fail, but who knows, and better to be sane than to wipe
out someone's valuables.
When wiping, automatically fall back to a dedicated `find` if the initial
`rm` failed on us. This should help with the speed issues related to the
later `find`.
Have the later find only search the top level allowing `rm` to walk the
directory contents. This means that -xdev no longer applies, but since
the earlier `rm` wasn't doing -xdev either and no one has complained thus
far, let's assume it isn't an issue. Also convert to the -exec...+ form
so that we don't have to worry about long argument lists, and add -- to
the `rm` that was previously missing. In practice, this shouldn't matter
as we've already deleted all those files, but better safe than sorry.
When cleaning, since we've already done a `cd` into the $dir, no point in
prefixing all the paths with $dir too. Go with the relative loving.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
X-Gentoo-Bug: 359831
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=359831
2011-03-24 00:12:42 +05:30
|
|
|
|
rm -rf -- .X*-lock esrv* kio* \
|
|
|
|
|
jpsock.* .fam* .esd* \
|
|
|
|
|
orbit-* ssh-* ksocket-* \
|
|
|
|
|
.*-unix
|
2007-09-09 21:22:05 +05:30
|
|
|
|
eend 0
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-16 12:18:36 +05:30
|
|
|
|
cleanup_var_run_dir()
|
|
|
|
|
{
|
|
|
|
|
ebegin "Cleaning /var/run"
|
|
|
|
|
for x in $(find /var/run ! -type d ! -name utmp \
|
|
|
|
|
! -name random-seed ! -name dev.db \
|
2017-04-10 19:37:17 +05:30
|
|
|
|
! -name ld-elf.so.hints ! -name ld-elf32.so.hints \
|
|
|
|
|
! -name ld.so.hints);
|
2013-02-16 12:18:36 +05:30
|
|
|
|
do
|
|
|
|
|
# Clean stale sockets
|
|
|
|
|
if [ -S "$x" ]; then
|
2013-12-02 06:55:01 +05:30
|
|
|
|
if command -v fuser >/dev/null 2>&1; then
|
2013-02-16 12:18:36 +05:30
|
|
|
|
fuser "$x" >/dev/null 2>&1 || rm -- "$x"
|
|
|
|
|
else
|
|
|
|
|
rm -- "$x"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
[ ! -f "$x" ] && continue
|
|
|
|
|
# Do not remove pidfiles of already running daemons
|
|
|
|
|
case "$x" in
|
|
|
|
|
*.pid)
|
|
|
|
|
start-stop-daemon --test --quiet \
|
|
|
|
|
--stop --pidfile "$x" && continue
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
rm -f -- "$x"
|
|
|
|
|
done
|
|
|
|
|
eend 0
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-17 05:09:37 +05:30
|
|
|
|
mkutmp()
|
|
|
|
|
{
|
|
|
|
|
: >"$1"
|
2009-04-18 06:26:48 +05:30
|
|
|
|
# Not all systems have the utmp group
|
|
|
|
|
chgrp utmp "$1" 2>/dev/null
|
2009-04-17 05:09:37 +05:30
|
|
|
|
chmod 0664 "$1"
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-30 21:30:44 +05:30
|
|
|
|
migrate_to_run()
|
|
|
|
|
{
|
|
|
|
|
src="$1"
|
|
|
|
|
dst="$2"
|
|
|
|
|
if [ -L $src -a "$(readlink -f $src)" != $dst ]; then
|
|
|
|
|
ewarn "$src does not point to $dst."
|
|
|
|
|
ewarn "Setting $src to point to $dst."
|
|
|
|
|
rm $src
|
|
|
|
|
elif [ ! -L $src -a -d $src ]; then
|
|
|
|
|
ebegin "Migrating $src to $dst"
|
2016-08-17 20:48:21 +05:30
|
|
|
|
if ! rmdir $src 2>/dev/null; then
|
|
|
|
|
cp -a $src/* $dst/
|
|
|
|
|
rm -rf $src
|
|
|
|
|
fi
|
2011-11-30 21:30:44 +05:30
|
|
|
|
eend $?
|
|
|
|
|
fi
|
|
|
|
|
# If $src doesn't exist at all, just run this
|
|
|
|
|
if [ ! -e $src ]; then
|
|
|
|
|
ln -s $dst $src
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-31 23:35:37 +05:30
|
|
|
|
clean_run()
|
|
|
|
|
{
|
2014-08-11 03:45:05 +05:30
|
|
|
|
[ "$RC_SYS" = VSERVER -o "$RC_SYS" = LXC ] && return 0
|
2013-01-31 23:35:37 +05:30
|
|
|
|
local dir
|
2015-02-27 07:28:22 +05:30
|
|
|
|
# If / is still read-only due to a problem, this will fail!
|
|
|
|
|
if ! checkpath -W /; then
|
2015-10-05 21:51:55 +05:30
|
|
|
|
ewarn "/ is not writable; unable to clean up underlying /run"
|
2015-02-27 07:28:22 +05:30
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
if ! checkpath -W /tmp; then
|
2015-10-05 21:51:55 +05:30
|
|
|
|
ewarn "/tmp is not writable; unable to clean up underlying /run"
|
2015-02-27 07:28:22 +05:30
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
# Now we know that we can modify /tmp and /
|
|
|
|
|
# if mktemp -d fails, it returns an EMPTY string
|
|
|
|
|
# STDERR: mktemp: failed to create directory via template ‘/tmp/tmp.XXXXXXXXXX’: Read-only file system
|
|
|
|
|
# STDOUT: ''
|
|
|
|
|
rc=0
|
2013-01-31 23:35:37 +05:30
|
|
|
|
dir=$(mktemp -d)
|
2015-02-27 07:28:22 +05:30
|
|
|
|
if [ -n "$dir" -a -d $dir -a -w $dir ]; then
|
|
|
|
|
mount --bind / $dir && rm -rf $dir/run/* || rc=1
|
2015-10-05 21:38:11 +05:30
|
|
|
|
umount $dir && rmdir $dir
|
2015-02-27 07:28:22 +05:30
|
|
|
|
else
|
|
|
|
|
rc=1
|
|
|
|
|
fi
|
|
|
|
|
if [ $rc -ne 0 ]; then
|
2015-10-05 21:51:55 +05:30
|
|
|
|
ewarn "Could not clean up underlying /run on /"
|
2015-02-27 07:28:22 +05:30
|
|
|
|
return 1
|
|
|
|
|
fi
|
2013-01-31 23:35:37 +05:30
|
|
|
|
}
|
|
|
|
|
|
2008-01-11 17:43:46 +05:30
|
|
|
|
start()
|
|
|
|
|
{
|
2009-04-27 13:21:18 +05:30
|
|
|
|
# Remove any added console dirs
|
2014-01-15 22:13:52 +05:30
|
|
|
|
if checkpath -W "$RC_LIBEXECDIR"; then
|
|
|
|
|
rm -rf "$RC_LIBEXECDIR"/console/*
|
|
|
|
|
fi
|
2009-04-27 13:21:18 +05:30
|
|
|
|
|
2009-06-09 02:48:39 +05:30
|
|
|
|
local logw=false runw=false extra=
|
2007-07-30 17:01:29 +05:30
|
|
|
|
# Ensure that our basic dirs exist
|
2011-11-30 21:30:44 +05:30
|
|
|
|
if [ "$RC_UNAME" = Linux ]; then
|
|
|
|
|
# Satisfy Linux FHS
|
|
|
|
|
extra=/var/lib/misc
|
|
|
|
|
if [ ! -d /run ]; then
|
|
|
|
|
extra="/var/run $extra"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
extra=/var/run
|
|
|
|
|
fi
|
|
|
|
|
for x in /var/log /tmp $extra; do
|
2009-04-27 13:21:18 +05:30
|
|
|
|
if ! [ -d $x ]; then
|
|
|
|
|
if ! mkdir -p $x; then
|
|
|
|
|
eend 1 "failed to create needed directory $x"
|
2007-07-30 17:01:29 +05:30
|
|
|
|
return 1
|
|
|
|
|
fi
|
2011-01-17 15:19:07 +05:30
|
|
|
|
fi
|
2007-07-30 17:01:29 +05:30
|
|
|
|
done
|
2007-04-05 16:48:42 +05:30
|
|
|
|
|
2012-10-17 00:57:19 +05:30
|
|
|
|
if [ "$RC_UNAME" = Linux -a -d /run ]; then
|
2011-11-30 21:30:44 +05:30
|
|
|
|
migrate_to_run /var/lock /run/lock
|
|
|
|
|
migrate_to_run /var/run /run
|
2013-01-31 23:35:37 +05:30
|
|
|
|
clean_run
|
2011-11-30 21:30:44 +05:30
|
|
|
|
fi
|
|
|
|
|
|
2012-01-29 00:02:05 +05:30
|
|
|
|
if checkpath -W /var/run; then
|
2008-04-09 04:55:48 +05:30
|
|
|
|
ebegin "Creating user login records"
|
2009-04-17 05:09:37 +05:30
|
|
|
|
local xtra=
|
2009-04-27 13:21:18 +05:30
|
|
|
|
[ "$RC_UNAME" = NetBSD ] && xtra=x
|
2009-04-17 05:09:37 +05:30
|
|
|
|
for x in "" $xtra; do
|
2009-04-27 13:21:18 +05:30
|
|
|
|
mkutmp /var/run/utmp$x
|
2009-04-17 05:09:37 +05:30
|
|
|
|
done
|
2009-11-11 01:39:03 +05:30
|
|
|
|
[ -e /var/log/wtmp ] || mkutmp /var/log/wtmp
|
2008-04-09 04:55:48 +05:30
|
|
|
|
eend 0
|
|
|
|
|
|
2013-02-16 12:18:36 +05:30
|
|
|
|
mountinfo -q -f tmpfs /var/run || cleanup_var_run_dir
|
2008-04-09 04:55:48 +05:30
|
|
|
|
fi
|
2007-04-05 16:48:42 +05:30
|
|
|
|
|
2007-09-09 21:22:05 +05:30
|
|
|
|
# Clean up /tmp directories
|
2007-11-20 17:50:50 +05:30
|
|
|
|
local tmp=
|
2009-02-23 15:06:48 +05:30
|
|
|
|
for tmp in ${clean_tmp_dirs:-${wipe_tmp_dirs-/tmp}}; do
|
2013-02-16 12:18:36 +05:30
|
|
|
|
mountinfo -q -f tmpfs "$tmp" || cleanup_tmp_dir "$tmp"
|
2007-09-09 21:22:05 +05:30
|
|
|
|
done
|
2007-09-09 21:38:32 +05:30
|
|
|
|
|
2012-01-29 00:02:05 +05:30
|
|
|
|
if checkpath -W /tmp; then
|
2008-04-09 04:55:48 +05:30
|
|
|
|
# Make sure our X11 stuff have the correct permissions
|
|
|
|
|
# Omit the chown as bootmisc is run before network is up
|
|
|
|
|
# and users may be using lame LDAP auth #139411
|
2011-01-17 15:19:07 +05:30
|
|
|
|
rm -rf /tmp/.ICE-unix /tmp/.X11-unix
|
2008-04-09 04:55:48 +05:30
|
|
|
|
mkdir -p /tmp/.ICE-unix /tmp/.X11-unix
|
|
|
|
|
chmod 1777 /tmp/.ICE-unix /tmp/.X11-unix
|
2009-04-27 13:21:18 +05:30
|
|
|
|
if [ -x /sbin/restorecon ]; then
|
|
|
|
|
restorecon /tmp/.ICE-unix /tmp/.X11-unix
|
|
|
|
|
fi
|
2008-04-09 04:55:48 +05:30
|
|
|
|
fi
|
|
|
|
|
|
2011-09-27 21:45:08 +05:30
|
|
|
|
if yesno $log_dmesg; then
|
2012-01-29 00:02:05 +05:30
|
|
|
|
if $logw || checkpath -W /var/log; then
|
2011-09-27 21:45:08 +05:30
|
|
|
|
# Create an 'after-boot' dmesg log
|
2015-05-28 09:31:43 +05:30
|
|
|
|
case "$RC_SYS" in
|
|
|
|
|
VSERVER|OPENVZ|LXC|SYSTEMD-NSPAWN) ;;
|
|
|
|
|
*)
|
2022-01-30 02:31:20 +05:30
|
|
|
|
if yesno ${previous_dmesg:-no} && [ -e /var/log/dmesg ]; then
|
2015-10-22 00:31:57 +05:30
|
|
|
|
mv /var/log/dmesg /var/log/dmesg.old
|
|
|
|
|
fi
|
2015-05-28 09:31:43 +05:30
|
|
|
|
dmesg > /var/log/dmesg
|
|
|
|
|
chmod 640 /var/log/dmesg
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2008-04-09 04:55:48 +05:30
|
|
|
|
fi
|
2007-04-26 19:52:54 +05:30
|
|
|
|
fi
|
2008-01-11 04:52:46 +05:30
|
|
|
|
|
2008-04-09 05:36:50 +05:30
|
|
|
|
return 0
|
2007-04-05 16:48:42 +05:30
|
|
|
|
}
|
|
|
|
|
|
2008-01-11 17:43:46 +05:30
|
|
|
|
stop()
|
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
|
# Write a halt record if we're shutting down
|
2009-04-27 13:21:18 +05:30
|
|
|
|
if [ "$RC_RUNLEVEL" = shutdown ]; then
|
2020-11-28 02:43:40 +05:30
|
|
|
|
if [ "$RC_UNAME" = Linux ]; then
|
|
|
|
|
if [ -x /sbin/halt ]; then
|
|
|
|
|
halt -w
|
|
|
|
|
else
|
|
|
|
|
openrc-shutdown -w
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2009-04-27 13:21:18 +05:30
|
|
|
|
if [ "$RC_SYS" = OPENVZ ]; then
|
|
|
|
|
yesno $RC_REBOOT && printf "" >/reboot
|
2009-02-10 20:46:25 +05:30
|
|
|
|
fi
|
2009-02-10 20:36:48 +05:30
|
|
|
|
fi
|
2007-11-20 18:25:56 +05:30
|
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
|
return 0
|
|
|
|
|
}
|
2012-10-17 00:30:45 +05:30
|
|
|
|
|
|
|
|
|
# vim: ft=sh
|