Compare commits
30 Commits
openrc-0.5
...
openrc-0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7fabeef95 | ||
|
|
07f9be7b1c | ||
|
|
42ca23b878 | ||
|
|
3dc712e222 | ||
|
|
44585fea46 | ||
|
|
6e485bde39 | ||
|
|
2ea1df634e | ||
|
|
807e5d7250 | ||
|
|
7012630302 | ||
|
|
51907c7368 | ||
|
|
8da7a49d02 | ||
|
|
29949a5496 | ||
|
|
7fbb6ad427 | ||
|
|
08b5664668 | ||
|
|
7962218dd8 | ||
|
|
889b317ac6 | ||
|
|
9907c90552 | ||
|
|
b4104957b1 | ||
|
|
6abeec7430 | ||
|
|
fbb78022f9 | ||
|
|
79b24f5b79 | ||
|
|
fc6cdefedb | ||
|
|
43f6c2196e | ||
|
|
c568baf8c8 | ||
|
|
aaced3face | ||
|
|
c3e9a7ec14 | ||
|
|
efec0b5012 | ||
|
|
278e65b24a | ||
|
|
1b3a413673 | ||
|
|
a685e4db0a |
12
Makefile
12
Makefile
@@ -2,9 +2,7 @@
|
||||
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
NAME= openrc
|
||||
VERSION= 0.5.0
|
||||
PKG= ${NAME}-${VERSION}
|
||||
include Makefile.inc
|
||||
|
||||
SUBDIR= conf.d etc init.d man sh src
|
||||
|
||||
@@ -16,6 +14,14 @@ _OLDNET_SH= case "${MKOLDNET}" in \
|
||||
_OLDNET!= ${_OLDNET_SH}
|
||||
SUBDIR+= ${_OLDNET}$(shell ${_OLDNET_SH})
|
||||
|
||||
# Build pkgconfig or not
|
||||
_PKGCONFIG_SH= case "${MKPKGCONFIG}" in \
|
||||
[Yy][Ee][Ss]|"") echo "pkgconfig";; \
|
||||
*) echo "";; \
|
||||
esac
|
||||
_PKGCONFIG!= ${_PKGCONFIG_SH}
|
||||
SUBDIR+= ${_PKGCONFIG}$(shell ${_PKGCONFIG_SH})
|
||||
|
||||
# We need to ensure that runlevels is done last
|
||||
SUBDIR+= runlevels
|
||||
|
||||
|
||||
3
Makefile.inc
Normal file
3
Makefile.inc
Normal file
@@ -0,0 +1,3 @@
|
||||
NAME= openrc
|
||||
VERSION= 0.5.1
|
||||
PKG= ${NAME}-${VERSION}
|
||||
1
README
1
README
@@ -11,6 +11,7 @@ PROGLDFLAGS=-static
|
||||
LIBNAME=lib64
|
||||
DESTDIR=/tmp/openrc-image
|
||||
MKPAM=pam
|
||||
MKPKGCONFIG=no
|
||||
MKTERMCAP=ncurses
|
||||
MKTERMCAP=termcap
|
||||
MKOLDNET=yes
|
||||
|
||||
@@ -992,7 +992,7 @@
|
||||
# # 'from 24.80.102.112/32 to 192.168.1.0/24 table localnet priority 100' \
|
||||
# # 'from 216.113.223.51/32 to 192.168.1.0/24 table localnet priority 100' \
|
||||
# #"
|
||||
# eval set -- $\rules_${IFVAR}
|
||||
# eval set -- \$rules_${IFVAR}
|
||||
# if [ $# != 0 ]; then
|
||||
# einfo "Adding IP policy routing rules"
|
||||
# eindent
|
||||
|
||||
@@ -14,7 +14,7 @@ depend()
|
||||
use logger
|
||||
after bootmisc modules
|
||||
before dns dhcpcd net
|
||||
keyword noshutdown
|
||||
keyword -shutdown
|
||||
}
|
||||
|
||||
find_wireless()
|
||||
@@ -24,7 +24,9 @@ find_wireless()
|
||||
case "$RC_UNAME" in
|
||||
Linux)
|
||||
for iface in /sys/class/net/*; do
|
||||
if [ -e "$iface"/wireless ]; then
|
||||
if [ -e "$iface"/wireless -o \
|
||||
-e "$iface"/phy80211 ]
|
||||
then
|
||||
echo "${iface##*/}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
1
init.d/.gitignore
vendored
1
init.d/.gitignore
vendored
@@ -35,5 +35,6 @@ rpcbind
|
||||
savecore
|
||||
swap-blk
|
||||
syslogd
|
||||
termencoding
|
||||
ttys
|
||||
wscons
|
||||
|
||||
@@ -22,7 +22,7 @@ depend()
|
||||
[ "$clock" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
|
||||
need root
|
||||
fi
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -8,7 +8,7 @@ depend()
|
||||
need localmount
|
||||
before logger
|
||||
after clock sysctl
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
dir_writeable()
|
||||
@@ -26,7 +26,7 @@ cleanup_tmp_dir()
|
||||
mkdir -p "$dir" || return $?
|
||||
fi
|
||||
dir_writeable "$dir" || return 1
|
||||
chmod +t "$dir"
|
||||
chmod a+rwt "$dir"
|
||||
cd "$dir"
|
||||
if yesno $wipe_tmp; then
|
||||
ebegin "Wiping $dir directory"
|
||||
@@ -76,9 +76,10 @@ start()
|
||||
# Remove any added console dirs
|
||||
rm -rf "$RC_LIBEXECDIR"/console
|
||||
|
||||
local logw=false runw=false
|
||||
local logw=false runw=false extra=
|
||||
# Ensure that our basic dirs exist
|
||||
for x in /var/log /var/run /tmp; do
|
||||
[ "$RC_UNAME" = Linux ] && extra=/var/lib/misc # Satisfy Linux FHS
|
||||
for x in /var/log /var/run /tmp $extra; do
|
||||
if ! [ -d $x ]; then
|
||||
if ! mkdir -p $x; then
|
||||
eend 1 "failed to create needed directory $x"
|
||||
@@ -105,7 +106,7 @@ start()
|
||||
# Clean stale sockets
|
||||
if [ -S "$x" ]; then
|
||||
if type fuser >/dev/null 2>&1; then
|
||||
fuser "$x" 2>/dev/null || rm -- "$x"
|
||||
fuser "$x" >/dev/null 2>&1 || rm -- "$x"
|
||||
else
|
||||
rm -- "$x"
|
||||
fi
|
||||
@@ -149,7 +150,7 @@ start()
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f /etc/nologin
|
||||
[ -w /etc/nologin ] && rm -f /etc/nologin
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ depend()
|
||||
{
|
||||
need localmount termencoding
|
||||
after hotplug bootmisc
|
||||
keyword noopenvz noprefix nouml novserver noxenu
|
||||
keyword -openvz -prefix -uml -vserver -xenu
|
||||
}
|
||||
|
||||
start()
|
||||
@@ -45,8 +45,10 @@ start()
|
||||
[ -d /dev/vc ] && ttydev=/dev/vc/
|
||||
x=1
|
||||
while [ $x -le $ttyn ]; do
|
||||
setfont $consolefont $param -C $ttydev$x >/dev/null
|
||||
retval=$(($retval + $?))
|
||||
if ! setfont $consolefont $param -C $ttydev$x >/dev/null; then
|
||||
retval=1
|
||||
break
|
||||
fi
|
||||
x=$(($x + 1))
|
||||
done
|
||||
eend $retval
|
||||
|
||||
@@ -10,7 +10,7 @@ depend() {
|
||||
need localmount
|
||||
after bootmisc
|
||||
before net.lo0
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Mount system critical filesystems in /dev."
|
||||
|
||||
depend() {
|
||||
use dev
|
||||
keyword noprefix novserver
|
||||
keyword -prefix -vserver
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Set the dmesg level for a cleaner boot"
|
||||
depend()
|
||||
{
|
||||
before dev modules
|
||||
keyword novserver
|
||||
keyword -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Configures a specific kernel dump device."
|
||||
|
||||
depend() {
|
||||
need swap
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
@@ -9,7 +9,7 @@ _IFS="
|
||||
depend()
|
||||
{
|
||||
use dev clock modules
|
||||
keyword nojail noopenvz noprefix notimeout novserver
|
||||
keyword -jail -openvz -prefix -timeout -vserver
|
||||
}
|
||||
|
||||
_abort() {
|
||||
@@ -51,6 +51,11 @@ _on_ac_power()
|
||||
"connected:"*"OFF") return 128;;
|
||||
esac
|
||||
done
|
||||
elif sysctl -q hw.acpi.acline >/dev/null 2>/dev/null; then
|
||||
case $(sysctl -n hw.acpi.acline) in
|
||||
0) return 1;;
|
||||
*) return 0;;
|
||||
esac
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -9,7 +9,7 @@ depend()
|
||||
{
|
||||
use root
|
||||
before devd net
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
_set()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
description="Sets the hostname of the machine."
|
||||
|
||||
depend() {
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -28,7 +28,7 @@ depend()
|
||||
else
|
||||
before *
|
||||
fi
|
||||
keyword noopenvz noprefix nouml novserver noxenu
|
||||
keyword -openvz -prefix -uml -vserver -xenu
|
||||
}
|
||||
|
||||
setupopts()
|
||||
@@ -118,7 +118,7 @@ stop()
|
||||
|
||||
if ! yesno $clock_adjfile; then
|
||||
# Some implementations don't handle adjustments
|
||||
if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then
|
||||
if LC_ALL=C hwclock --help 2>&1 | grep -q "\-\-noadjfile"; then
|
||||
utc_cmd="$utc_cmd --noadjfile"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -13,7 +13,7 @@ opts="panic showstatus"
|
||||
depend() {
|
||||
before net
|
||||
provide firewall
|
||||
keyword nojail
|
||||
keyword -jail
|
||||
}
|
||||
|
||||
ipfw() {
|
||||
|
||||
@@ -8,7 +8,7 @@ depend()
|
||||
{
|
||||
need localmount termencoding
|
||||
after bootmisc
|
||||
keyword noopenvz noprefix nouml novserver noxenu
|
||||
keyword -openvz -prefix -uml -vserver -xenu
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Kill all processes so we can unmount disks cleanly."
|
||||
|
||||
depend()
|
||||
{
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Executes user commands in /etc/conf.d/local"
|
||||
depend()
|
||||
{
|
||||
after *
|
||||
keyword notimeout
|
||||
keyword -timeout
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -8,7 +8,7 @@ depend()
|
||||
{
|
||||
need fsck
|
||||
use lvm modules mtab
|
||||
keyword nojail noopenvz noprefix novserver
|
||||
keyword -jail -openvz -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,7 +7,7 @@ extra_commands="restore"
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
restore()
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Loads a user defined list of kernel modules."
|
||||
depend()
|
||||
{
|
||||
use isapnp
|
||||
keyword noopenvz noprefix novserver
|
||||
keyword -openvz -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Re-mount filesytems read-only for a clean reboot."
|
||||
depend()
|
||||
{
|
||||
need killprocs savecache
|
||||
keyword noprefix noopenvz novserver
|
||||
keyword -prefix -openvz -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -16,7 +16,7 @@ depend()
|
||||
{
|
||||
need localmount
|
||||
after bootmisc
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,11 +7,17 @@ description="Update /etc/mtab to match what the kernel knows about"
|
||||
depend()
|
||||
{
|
||||
need root
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
# /etc/mtab could be a symlink to /proc/mounts
|
||||
if [ ! -w /etc/mtab -a -L /etc/mtab ]; then
|
||||
eeinfo "Skipping mtab update (non writeable symlink)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
ebegin "Updating /etc/mtab"
|
||||
if ! echo 2>/dev/null >/etc/mtab; then
|
||||
ewend 1 "/etc/mtab is not updateable"
|
||||
|
||||
@@ -21,7 +21,7 @@ depend()
|
||||
need localmount
|
||||
after bootmisc
|
||||
provide net
|
||||
keyword nojail noprefix novserver
|
||||
keyword -jail -prefix -vserver
|
||||
|
||||
case "${IFACE}" in
|
||||
lo|lo0);;
|
||||
|
||||
@@ -35,7 +35,7 @@ depend()
|
||||
need net $pmap
|
||||
use afc-client amd autofs openvpn
|
||||
use dns nfs nfsmount portmap rpcbind rpc.statd rpc.lockd
|
||||
keyword nojail noprefix novserver
|
||||
keyword -jail -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -13,7 +13,7 @@ depend()
|
||||
need localmount
|
||||
after bootmisc
|
||||
provide net
|
||||
keyword nojail noprefix novserver
|
||||
keyword -jail -prefix -vserver
|
||||
}
|
||||
|
||||
uniqify()
|
||||
|
||||
@@ -7,7 +7,7 @@ required_files="/etc/newsyslog.conf"
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword noopenvz noprefix novserver
|
||||
keyword -openvz -prefix -vserver
|
||||
}
|
||||
|
||||
_setleds()
|
||||
|
||||
@@ -11,7 +11,7 @@ extra_started_commands="reload"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -12,7 +12,7 @@ depend()
|
||||
need localmount
|
||||
use logger
|
||||
after bootmisc
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start_pre()
|
||||
|
||||
@@ -8,7 +8,7 @@ depend()
|
||||
{
|
||||
use modules devfs
|
||||
need localmount
|
||||
keyword noopenvz noprefix novserver
|
||||
keyword -openvz -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,7 +7,7 @@ depend()
|
||||
need localmount net
|
||||
after *
|
||||
before local
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Mount the root fs read/write"
|
||||
depend()
|
||||
{
|
||||
need fsck
|
||||
keyword nojail noopenvz noprefix novserver
|
||||
keyword -jail -openvz -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -7,7 +7,7 @@ description="Saves a kernel dump."
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
before fsck
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword nojail noopenvz noprefix novserver
|
||||
keyword -jail -openvz -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
keyword nojail noprefix
|
||||
keyword -jail -prefix
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
@@ -6,7 +6,7 @@ depend()
|
||||
{
|
||||
use hostname
|
||||
before bootmisc logger
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -6,7 +6,7 @@ depend()
|
||||
{
|
||||
use hostname
|
||||
before bootmisc logger
|
||||
keyword noopenvz noprefix novserver
|
||||
keyword -openvz -prefix -vserver
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -6,7 +6,7 @@ description="Mount the sys filesystem."
|
||||
|
||||
depend()
|
||||
{
|
||||
keyword noprefix novserver
|
||||
keyword -prefix -vserver
|
||||
}
|
||||
|
||||
mount_sys()
|
||||
|
||||
@@ -16,5 +16,5 @@ depend()
|
||||
use net newsyslog
|
||||
need localmount
|
||||
after bootmisc
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
||||
|
||||
depend()
|
||||
{
|
||||
keyword noopenvz noprefix nouml novserver noxenu
|
||||
keyword -openvz -prefix -uml -vserver -xenu
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
after fsck
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -8,7 +8,7 @@ description="Initializes the random number generator."
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword nojail noprefix
|
||||
keyword -jail -openvz -prefix
|
||||
}
|
||||
|
||||
save_seed()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
depend()
|
||||
{
|
||||
need localmount
|
||||
keyword noprefix
|
||||
keyword -prefix
|
||||
}
|
||||
|
||||
start()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 30, 2009
|
||||
.Dd July 1, 2009
|
||||
.Dt RUNSCRIPT 8 SMM
|
||||
.Os OpenRC
|
||||
.Sh NAME
|
||||
@@ -138,30 +138,30 @@ We should recalculate our dependencies if the listed files have changed.
|
||||
.It Ic keyword
|
||||
Tags a service with a keyword. Here's the keywords we currently understand:-
|
||||
.Bl -tag -width indent
|
||||
.It Dv nojail
|
||||
.It Dv -jail
|
||||
When in a jail, exclude this service from any dependencies. The service can
|
||||
still be run directly.
|
||||
.It Dv noopenvz
|
||||
Same as nojail, but for OpenVZ systems.
|
||||
.It Dv noshutdown
|
||||
.It Dv -openvz
|
||||
Same as -jail, but for OpenVZ systems.
|
||||
.It Dv -shutdown
|
||||
Don't stop this service when shutting the system down.
|
||||
This normally quite safe as remaining daemons will be sent a SIGTERM just
|
||||
before final shutdown.
|
||||
Network related services such as the network and dhcpcd init scripts normally
|
||||
have this keyword.
|
||||
.It Dv nostop
|
||||
.It Dv -stop
|
||||
Don't stop this service when changing runlevels, even if not present.
|
||||
This includes shutting the system down.
|
||||
.It Dv notimeout
|
||||
.It Dv -timeout
|
||||
Do not time out waiting for that service.
|
||||
.It Dv nouml
|
||||
Same as nojail, but for UML systems.
|
||||
.It Dv novserver
|
||||
Same as nojail, but for VServer systems.
|
||||
.It Dv noxen0
|
||||
Same as nojail, but for Xen DOM0 systems.
|
||||
.It Dv noxenu
|
||||
Same as nojail, but for Xen DOMU systems.
|
||||
.It Dv -uml
|
||||
Same as -jail, but for UML systems.
|
||||
.It Dv -vserver
|
||||
Same as -jail, but for VServer systems.
|
||||
.It Dv -xen0
|
||||
Same as -jail, but for Xen DOM0 systems.
|
||||
.It Dv -xenu
|
||||
Same as -jail, but for Xen DOMU systems.
|
||||
.El
|
||||
.El
|
||||
.Pp
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 22, 2009
|
||||
.Dd September 4, 2009
|
||||
.Dt START-STOP-DAEMON 8 SMM
|
||||
.Os OpenRC
|
||||
.Sh NAME
|
||||
@@ -98,6 +98,8 @@ Print the action(s) that would be taken, but don't actually do anything.
|
||||
The return value is set as if the command was taken and worked.
|
||||
.It Fl v , -verbose
|
||||
Print the action(s) that are taken just before doing them.
|
||||
.It Fl P , -progress
|
||||
Echo a . to the console for each second elapsed whilst waiting.
|
||||
.El
|
||||
.Pp
|
||||
These options are only used for starting daemons:
|
||||
|
||||
@@ -261,6 +261,17 @@ _tunnel()
|
||||
|
||||
ifconfig_pre_start()
|
||||
{
|
||||
local tunnel=
|
||||
eval tunnel=\$iptunnel_${IFVAR}
|
||||
if [ -n "${tunnel}" ]; then
|
||||
# Set our base metric to 1000
|
||||
metric=1000
|
||||
ebegin "Creating tunnel ${IFVAR}"
|
||||
iptunnel add ${tunnel}
|
||||
eend $? || return 1
|
||||
_up
|
||||
fi
|
||||
|
||||
# MTU support
|
||||
local mtu=
|
||||
eval mtu=\$mtu_${IFVAR}
|
||||
@@ -271,17 +282,7 @@ ifconfig_pre_start()
|
||||
eval len=\$txqueuelen_${IFVAR}
|
||||
[ -n "${len}" ] && ifconfig "${IFACE}" txqueuelen "${len}"
|
||||
|
||||
local tunnel=
|
||||
|
||||
eval tunnel=\$iptunnel_${IFVAR}
|
||||
[ -z "${tunnel}" ] && return 0
|
||||
|
||||
# Set our base metric to 1000
|
||||
metric=1000
|
||||
|
||||
ebegin "Creating tunnel ${IFVAR}"
|
||||
iptunnel add ${tunnel}
|
||||
eend $?
|
||||
return 0
|
||||
}
|
||||
|
||||
ifconfig_post_stop()
|
||||
|
||||
@@ -157,7 +157,10 @@ _add_route()
|
||||
shift
|
||||
done
|
||||
|
||||
if ! ${have_metric} && [ -n "${metric}" ]; then
|
||||
# We cannot use a metric if we're using a nexthop
|
||||
if ! ${have_metric} && \
|
||||
[ -n "${metric}" -a -z "${cmd##* nexthop }" ]
|
||||
then
|
||||
cmd="${cmd} metric ${metric}"
|
||||
fi
|
||||
|
||||
@@ -187,16 +190,6 @@ _tunnel()
|
||||
|
||||
iproute2_pre_start()
|
||||
{
|
||||
# MTU support
|
||||
local mtu=
|
||||
eval mtu=\$mtu_${IFVAR}
|
||||
[ -n "${mtu}" ] && ip link set "${IFACE}" mtu "${mtu}"
|
||||
|
||||
# TX Queue Length support
|
||||
local len=
|
||||
eval len=\$txqueuelen_${IFVAR}
|
||||
[ -n "${len}" ] && ip link set "${IFACE}" txqueuelen "${len}"
|
||||
|
||||
local tunnel=
|
||||
eval tunnel=\$iptunnel_${IFVAR}
|
||||
if [ -n "${tunnel}" ]; then
|
||||
@@ -209,6 +202,16 @@ iproute2_pre_start()
|
||||
_up
|
||||
fi
|
||||
|
||||
# MTU support
|
||||
local mtu=
|
||||
eval mtu=\$mtu_${IFVAR}
|
||||
[ -n "${mtu}" ] && ip link set "${IFACE}" mtu "${mtu}"
|
||||
|
||||
# TX Queue Length support
|
||||
local len=
|
||||
eval len=\$txqueuelen_${IFVAR}
|
||||
[ -n "${len}" ] && ip link set "${IFACE}" txqueuelen "${len}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -222,6 +225,8 @@ _iproute2_ipv6_tentative()
|
||||
|
||||
iproute2_post_start()
|
||||
{
|
||||
local n=5
|
||||
|
||||
# Kernel may not have IP built in
|
||||
if [ -e /proc/net/route ]; then
|
||||
ip route flush table cache dev "${IFACE}"
|
||||
@@ -229,11 +234,16 @@ iproute2_post_start()
|
||||
|
||||
if _iproute2_ipv6_tentative; then
|
||||
ebegin "Waiting for IPv6 addresses"
|
||||
while true; do
|
||||
while [ $n -ge 0 ]; do
|
||||
_iproute2_ipv6_tentative || break
|
||||
sleep 1
|
||||
n=$(($n - 1))
|
||||
done
|
||||
eend 0
|
||||
[ $n -ge 0 ]
|
||||
eend $?
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
iproute2_post_stop()
|
||||
|
||||
2
pkgconfig/.gitignore
vendored
Normal file
2
pkgconfig/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
einfo.pc
|
||||
openrc.pc
|
||||
11
pkgconfig/Makefile
Normal file
11
pkgconfig/Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
DIR= ${LIBDIR}/pkgconfig
|
||||
SRCS= einfo.pc.in openrc.pc.in
|
||||
INC= einfo.pc openrc.pc
|
||||
|
||||
sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
|
||||
|
||||
SED_EXTRA= -e 's:@VERSION@:${VERSION}:g'
|
||||
|
||||
MK= ../mk
|
||||
include ../Makefile.inc
|
||||
include ${MK}/scripts.mk
|
||||
9
pkgconfig/einfo.pc.in
Normal file
9
pkgconfig/einfo.pc.in
Normal file
@@ -0,0 +1,9 @@
|
||||
prefix=@PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/@LIB@
|
||||
includedir=/usr/include
|
||||
|
||||
Name: einfo
|
||||
Description: Pretty console informational display
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -leinfo
|
||||
10
pkgconfig/openrc.pc.in
Normal file
10
pkgconfig/openrc.pc.in
Normal file
@@ -0,0 +1,10 @@
|
||||
prefix=@PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/@LIB@
|
||||
includedir=/usr/include
|
||||
|
||||
Name: OpenRC
|
||||
Description: Universal init system
|
||||
Version: @VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lrc
|
||||
@@ -25,6 +25,29 @@ shift
|
||||
# Compat
|
||||
export SVCNAME=$RC_SVCNAME
|
||||
|
||||
# Dependency function
|
||||
config() {
|
||||
[ -n "$*" ] && echo "config $*"
|
||||
}
|
||||
need() {
|
||||
[ -n "$*" ] && echo "need $*"
|
||||
}
|
||||
use() {
|
||||
[ -n "$*" ] && echo "use $*"
|
||||
}
|
||||
before() {
|
||||
[ -n "$*" ] && echo "before $*"
|
||||
}
|
||||
after() {
|
||||
[ -n "$*" ] && echo "after $*"
|
||||
}
|
||||
provide() {
|
||||
[ -n "$*" ] && echo "provide $*"
|
||||
}
|
||||
keyword() {
|
||||
[ -n "$*" ] && echo "keyword $*"
|
||||
}
|
||||
|
||||
# Descript the init script to the user
|
||||
describe()
|
||||
{
|
||||
@@ -165,7 +188,7 @@ unset _f
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
# See if we have the required function and run it
|
||||
for _cmd in describe start stop status ${extra_commands:-$opts} \
|
||||
for _cmd in describe start stop status depend ${extra_commands:-$opts} \
|
||||
$extra_started_commands
|
||||
do
|
||||
if [ "$_cmd" = "$1" ]; then
|
||||
|
||||
@@ -738,7 +738,7 @@ rc_deptree_update(void)
|
||||
RC_STRING *s, *s2, *s2_np, *s3, *s4;
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
char *depend, *depends, *service, *type, *nosys;
|
||||
char *depend, *depends, *service, *type, *nosys, *onosys;
|
||||
size_t i, k, l;
|
||||
bool retval = true;
|
||||
const char *sys = rc_sys();
|
||||
@@ -802,6 +802,11 @@ rc_deptree_update(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Don't provide ourself */
|
||||
if (strcmp(type, "iprovide") == 0 &&
|
||||
strcmp(depend, service) == 0)
|
||||
continue;
|
||||
|
||||
/* .sh files are not init scripts */
|
||||
l = strlen(depend);
|
||||
if (l > 2 &&
|
||||
@@ -841,17 +846,25 @@ rc_deptree_update(void)
|
||||
* work for them. This doesn't stop them from being run directly. */
|
||||
if (sys) {
|
||||
len = strlen(sys);
|
||||
nosys = xmalloc(len + 3);
|
||||
nosys[0] = 'n';
|
||||
nosys[1] = 'o';
|
||||
nosys = xmalloc(len + 1);
|
||||
nosys[0] = '-';
|
||||
for (i = 0; i < len; i++)
|
||||
nosys[i + 2] = (char)tolower((unsigned char)sys[i]);
|
||||
nosys[i + 2] = '\0';
|
||||
nosys[i + 1] = (char)tolower((unsigned char)sys[i]);
|
||||
nosys[i + 1] = '\0';
|
||||
|
||||
onosys = xmalloc(len + 3);
|
||||
onosys[0] = 'n';
|
||||
onosys[1] = 'o';
|
||||
for (i = 0; i < len; i++)
|
||||
onosys[i + 2] = (char)tolower((unsigned char)sys[i]);
|
||||
onosys[i + 2] = '\0';
|
||||
|
||||
TAILQ_FOREACH_SAFE(depinfo, deptree, entries, depinfo_np)
|
||||
if ((deptype = get_deptype(depinfo, "keyword")))
|
||||
TAILQ_FOREACH(s, deptype->services, entries)
|
||||
if (strcmp(s->value, nosys) == 0) {
|
||||
if (strcmp(s->value, nosys) == 0 ||
|
||||
strcmp(s->value, onosys) == 0)
|
||||
{
|
||||
provide = get_deptype(depinfo, "iprovide");
|
||||
TAILQ_REMOVE(deptree, depinfo, entries);
|
||||
TAILQ_FOREACH(di, deptree, entries) {
|
||||
@@ -870,6 +883,7 @@ rc_deptree_update(void)
|
||||
}
|
||||
}
|
||||
free(nosys);
|
||||
free(onosys);
|
||||
}
|
||||
|
||||
/* Phase 3 - add our providers to the tree */
|
||||
|
||||
@@ -468,7 +468,7 @@ rc_service_exists(const char *service)
|
||||
}
|
||||
librc_hidden_def(rc_service_exists)
|
||||
|
||||
#define OPTSTR ". '%s'; echo \"${opts}\""
|
||||
#define OPTSTR ". '%s'; echo $opts"
|
||||
RC_STRINGLIST *
|
||||
rc_service_extra_commands(const char *service)
|
||||
{
|
||||
|
||||
@@ -72,8 +72,6 @@
|
||||
#define librc_hidden_proto(x) hidden_proto(x)
|
||||
#define librc_hidden_def(x) hidden_def(x)
|
||||
|
||||
ssize_t rc_getline(char **, size_t *, FILE *);
|
||||
|
||||
librc_hidden_proto(rc_config_list)
|
||||
librc_hidden_proto(rc_config_load)
|
||||
librc_hidden_proto(rc_config_value)
|
||||
|
||||
@@ -517,5 +517,9 @@ typedef LIST_HEAD(rc_pidlist, rc_pid) RC_PIDLIST;
|
||||
* @return NULL terminated list of pids */
|
||||
RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t);
|
||||
|
||||
/* getline is a handy glibc function that not all libcs have, so
|
||||
* we have our own */
|
||||
ssize_t rc_getline(char **, size_t *, FILE *);
|
||||
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@ global:
|
||||
rc_deptree_update_needed;
|
||||
rc_environ_fd;
|
||||
rc_find_pids;
|
||||
rc_getline;
|
||||
rc_newer_than;
|
||||
rc_older_than;
|
||||
rc_runlevel_exists;
|
||||
|
||||
@@ -34,6 +34,7 @@ CPPFLAGS+= -I../includes -I../librc -I../libeinfo
|
||||
LDFLAGS+= -L../librc -L../libeinfo
|
||||
LDADD+= -lutil -lrc -leinfo
|
||||
|
||||
include ../../Makefile.inc
|
||||
MK= ../../mk
|
||||
include ${MK}/debug.mk
|
||||
include ${MK}/prog.mk
|
||||
@@ -46,7 +47,7 @@ include ${MK}/${MKPAM}.mk
|
||||
|
||||
${SRCS}: version.h
|
||||
version.h:
|
||||
sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
|
||||
echo "#define VERSION \"${VERSION}${GITVER}\"" >version.h
|
||||
if test -n "${BRANDING}"; then \
|
||||
echo "#define BRANDING \"${BRANDING}\"" >> version.h; \
|
||||
fi
|
||||
|
||||
28
src/rc/rc.c
28
src/rc/rc.c
@@ -43,10 +43,6 @@ const char rc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifdef __linux__
|
||||
# include <asm/setup.h> /* for COMMAND_LINE_SIZE */
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
@@ -177,10 +173,8 @@ static char *
|
||||
proc_getent(const char *ent)
|
||||
{
|
||||
FILE *fp;
|
||||
char proc[COMMAND_LINE_SIZE];
|
||||
char *p;
|
||||
char *value = NULL;
|
||||
int i;
|
||||
char *proc, *p, *value = NULL;
|
||||
size_t i;
|
||||
|
||||
if (!exists("/proc/cmdline"))
|
||||
return NULL;
|
||||
@@ -190,11 +184,11 @@ proc_getent(const char *ent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(proc, 0, sizeof(proc));
|
||||
p = fgets(proc, sizeof(proc), fp);
|
||||
if (p == NULL)
|
||||
eerror("fgets: %s", strerror(errno));
|
||||
else if (*proc && (p = strstr(proc, ent))) {
|
||||
proc = NULL;
|
||||
i = 0;
|
||||
if (rc_getline(&proc, &i, fp) == -1 || proc == NULL)
|
||||
eerror("rc_getline: %s", strerror(errno));
|
||||
if (*proc && (p = strstr(proc, ent))) {
|
||||
i = p - proc;
|
||||
if (i == '\0' || proc[i - 1] == ' ') {
|
||||
p += strlen(ent);
|
||||
@@ -205,6 +199,7 @@ proc_getent(const char *ent)
|
||||
} else
|
||||
errno = ENOENT;
|
||||
fclose(fp);
|
||||
free(proc);
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -605,8 +600,11 @@ do_stop_services(const char *newlevel, bool parallel, bool going_down)
|
||||
continue;
|
||||
}
|
||||
kwords = rc_deptree_depend(deptree, service->value, "keyword");
|
||||
if (rc_stringlist_find(kwords, "nostop") ||
|
||||
(going_down && rc_stringlist_find(kwords, "noshutdown")))
|
||||
if (rc_stringlist_find(kwords, "-stop") ||
|
||||
rc_stringlist_find(kwords, "nostop") ||
|
||||
(going_down &&
|
||||
(rc_stringlist_find(kwords, "-shutdown") ||
|
||||
rc_stringlist_find(kwords, "noshutdown"))))
|
||||
nstop = true;
|
||||
else
|
||||
nstop = false;
|
||||
|
||||
@@ -471,7 +471,8 @@ svc_wait(const char *svc)
|
||||
|
||||
/* Some services don't have a timeout, like fsck */
|
||||
keywords = rc_deptree_depend(deptree, svc, "keyword");
|
||||
if (rc_stringlist_find(keywords, "notimeout"))
|
||||
if (rc_stringlist_find(keywords, "-timeout") ||
|
||||
rc_stringlist_find(keywords, "notimeout"))
|
||||
forever = true;
|
||||
rc_stringlist_free(keywords);
|
||||
|
||||
@@ -755,13 +756,10 @@ static void svc_start_real()
|
||||
if (ibsave)
|
||||
unsetenv("IN_BACKGROUND");
|
||||
|
||||
if (!started)
|
||||
if (rc_service_state(service) & RC_SERVICE_INACTIVE)
|
||||
ewarnx("WARNING: %s has started, but is inactive", applet);
|
||||
else if (!started)
|
||||
eerrorx("ERROR: %s failed to start", applet);
|
||||
else {
|
||||
if (rc_service_state(service) & RC_SERVICE_INACTIVE)
|
||||
ewarnx("WARNING: %s has started, but is inactive",
|
||||
applet);
|
||||
}
|
||||
|
||||
rc_service_mark(service, RC_SERVICE_STARTED);
|
||||
exclusive_fd = svc_unlock(applet, exclusive_fd);
|
||||
@@ -1275,7 +1273,8 @@ runscript(int argc, char **argv)
|
||||
doneone = true;
|
||||
|
||||
if (strcmp(optarg, "describe") == 0 ||
|
||||
strcmp(optarg, "help") == 0)
|
||||
strcmp(optarg, "help") == 0 ||
|
||||
strcmp(optarg, "depend") == 0)
|
||||
{
|
||||
save = prefix;
|
||||
eprefix(NULL);
|
||||
|
||||
@@ -155,7 +155,8 @@ parse_signal(const char *sig)
|
||||
{ "STOP", SIGSTOP },
|
||||
{ "TSTP", SIGTSTP },
|
||||
{ "TTIN", SIGTTIN },
|
||||
{ "TTOU", SIGTTOU }
|
||||
{ "TTOU", SIGTTOU },
|
||||
{ "NULL", 0 },
|
||||
};
|
||||
|
||||
unsigned int i = 0;
|
||||
@@ -165,7 +166,7 @@ parse_signal(const char *sig)
|
||||
return -1;
|
||||
|
||||
if (sscanf(sig, "%u", &i) == 1) {
|
||||
if (i > 0 && i < sizeof(signallist) / sizeof(signallist[0]))
|
||||
if (i < NSIG)
|
||||
return i;
|
||||
eerrorx("%s: `%s' is not a valid signal", applet, sig);
|
||||
}
|
||||
@@ -369,16 +370,17 @@ do_stop(const char *exec, const char *const *argv,
|
||||
static int
|
||||
run_stop_schedule(const char *exec, const char *const *argv,
|
||||
const char *pidfile, uid_t uid,
|
||||
bool quiet, bool verbose, bool test)
|
||||
bool quiet, bool verbose, bool test, bool progress)
|
||||
{
|
||||
SCHEDULEITEM *item = TAILQ_FIRST(&schedule);
|
||||
int nkilled = 0;
|
||||
int tkilled = 0;
|
||||
int nrunning = 0;
|
||||
long nloops;
|
||||
long nloops, nsecs;
|
||||
struct timespec ts;
|
||||
pid_t pid = 0;
|
||||
const char *const *p;
|
||||
bool progressed = false;
|
||||
|
||||
if (verbose) {
|
||||
if (exec)
|
||||
@@ -416,6 +418,8 @@ run_stop_schedule(const char *exec, const char *const *argv,
|
||||
quiet, verbose, test);
|
||||
if (nkilled == 0) {
|
||||
if (tkilled == 0) {
|
||||
if (progressed)
|
||||
printf("\n");
|
||||
if (! quiet)
|
||||
eerror("%s: no matching "
|
||||
"processes found", applet);
|
||||
@@ -433,30 +437,47 @@ run_stop_schedule(const char *exec, const char *const *argv,
|
||||
break;
|
||||
}
|
||||
|
||||
nloops = (ONE_SECOND / POLL_INTERVAL) * item->value;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = POLL_INTERVAL;
|
||||
|
||||
while (nloops) {
|
||||
if ((nrunning = do_stop(exec, argv, pid,
|
||||
uid, 0, true, false, true)) == 0)
|
||||
return 0;
|
||||
|
||||
if (nanosleep(&ts, NULL) == -1) {
|
||||
if (errno == EINTR)
|
||||
eerror("%s: caught an"
|
||||
" interrupt", applet);
|
||||
else {
|
||||
eerror("%s: nanosleep: %s",
|
||||
applet, strerror(errno));
|
||||
for (nsecs = 0; nsecs < item->value; nsecs++) {
|
||||
for (nloops = 0;
|
||||
nloops < ONE_SECOND / POLL_INTERVAL;
|
||||
nloops++)
|
||||
{
|
||||
if ((nrunning = do_stop(exec, argv,
|
||||
pid, uid, 0, true, false,
|
||||
true)) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
if (nanosleep(&ts, NULL) == -1) {
|
||||
if (progressed) {
|
||||
printf("\n");
|
||||
progressed = false;
|
||||
}
|
||||
if (errno == EINTR)
|
||||
eerror("%s: caught an"
|
||||
" interrupt", applet);
|
||||
else {
|
||||
eerror("%s: nanosleep: %s",
|
||||
applet, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
nloops --;
|
||||
if (progress) {
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
progressed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (progressed) {
|
||||
printf("\n");
|
||||
progressed = false;
|
||||
}
|
||||
eerror("%s: invalid schedule item `%d'",
|
||||
applet, item->type);
|
||||
return 0;
|
||||
@@ -469,6 +490,8 @@ run_stop_schedule(const char *exec, const char *const *argv,
|
||||
if (test || (tkilled > 0 && nrunning == 0))
|
||||
return nkilled;
|
||||
|
||||
if (progressed)
|
||||
printf("\n");
|
||||
if (! quiet) {
|
||||
if (nrunning == 1)
|
||||
eerror("%s: %d process refused to stop",
|
||||
@@ -549,7 +572,7 @@ expand_home(const char *home, const char *path)
|
||||
ppath++;
|
||||
|
||||
if (!home) {
|
||||
free(opath);
|
||||
free(opath);
|
||||
return xstrdup(path);
|
||||
}
|
||||
if (!ppath) {
|
||||
@@ -565,7 +588,7 @@ expand_home(const char *home, const char *path)
|
||||
}
|
||||
|
||||
#include "_usage.h"
|
||||
#define getoptstring "KN:R:Sbc:d:e:g:ik:mn:op:s:tu:r:w:x:1:2:" getoptstring_COMMON
|
||||
#define getoptstring "KN:PR:Sbc:d:e:g:ik:mn:op:s:tu:r:w:x:1:2:" getoptstring_COMMON
|
||||
static const struct option longopts[] = {
|
||||
{ "stop", 0, NULL, 'K'},
|
||||
{ "nicelevel", 1, NULL, 'N'},
|
||||
@@ -591,6 +614,7 @@ static const struct option longopts[] = {
|
||||
{ "exec", 1, NULL, 'x'},
|
||||
{ "stdout", 1, NULL, '1'},
|
||||
{ "stderr", 1, NULL, '2'},
|
||||
{ "progress", 0, NULL, 'P'},
|
||||
longopts_COMMON
|
||||
};
|
||||
static const char * const longopts_help[] = {
|
||||
@@ -618,6 +642,7 @@ static const char * const longopts_help[] = {
|
||||
"Binary to start/stop",
|
||||
"Redirect stdout to file",
|
||||
"Redirect stderr to file",
|
||||
"Print dots each second while waiting",
|
||||
longopts_help_COMMON
|
||||
};
|
||||
#include "_usage.c"
|
||||
@@ -648,11 +673,12 @@ start_stop_daemon(int argc, char **argv)
|
||||
char *name = NULL;
|
||||
char *pidfile = NULL;
|
||||
char *retry = NULL;
|
||||
int sig = 0;
|
||||
int sig = -1;
|
||||
int nicelevel = 0;
|
||||
bool background = false;
|
||||
bool makepidfile = false;
|
||||
bool interpreted = false;
|
||||
bool progress = false;
|
||||
uid_t uid = 0;
|
||||
gid_t gid = 0;
|
||||
char *home = NULL;
|
||||
@@ -714,12 +740,17 @@ start_stop_daemon(int argc, char **argv)
|
||||
case 'K': /* --stop */
|
||||
stop = true;
|
||||
break;
|
||||
|
||||
case 'N': /* --nice */
|
||||
if (sscanf(optarg, "%d", &nicelevel) != 1)
|
||||
eerrorx("%s: invalid nice level `%s'",
|
||||
applet, optarg);
|
||||
break;
|
||||
|
||||
case 'P': /* --progress */
|
||||
progress = true;
|
||||
break;
|
||||
|
||||
case 'R': /* --retry <schedule>|<timeout> */
|
||||
retry = optarg;
|
||||
break;
|
||||
@@ -885,8 +916,8 @@ start_stop_daemon(int argc, char **argv)
|
||||
else if (exec)
|
||||
*--argv = exec;
|
||||
|
||||
if (stop || sig != 0) {
|
||||
if (sig == 0)
|
||||
if (stop || sig != -1) {
|
||||
if (sig == -1)
|
||||
sig = SIGTERM;
|
||||
if (!*argv && !pidfile && !name && !uid)
|
||||
eerrorx("%s: --stop needs --exec, --pidfile,"
|
||||
@@ -989,8 +1020,8 @@ start_stop_daemon(int argc, char **argv)
|
||||
}
|
||||
margv = nav ? nav : argv;
|
||||
|
||||
if (stop || sig) {
|
||||
if (sig == 0)
|
||||
if (stop || sig != -1) {
|
||||
if (sig == -1)
|
||||
sig = SIGTERM;
|
||||
if (!stop)
|
||||
oknodo = true;
|
||||
@@ -1001,7 +1032,7 @@ start_stop_daemon(int argc, char **argv)
|
||||
else
|
||||
parse_schedule(NULL, sig);
|
||||
i = run_stop_schedule(exec, (const char *const *)margv,
|
||||
pidfile, uid, quiet, verbose, test);
|
||||
pidfile, uid, quiet, verbose, test, progress);
|
||||
|
||||
if (i < 0)
|
||||
/* We failed to stop something */
|
||||
|
||||
@@ -20,6 +20,8 @@ rc_deptree_update_needed
|
||||
rc_deptree_update_needed@@RC_1.0
|
||||
rc_find_pids
|
||||
rc_find_pids@@RC_1.0
|
||||
rc_getline
|
||||
rc_getline@@RC_1.0
|
||||
rc_newer_than
|
||||
rc_newer_than@@RC_1.0
|
||||
rc_older_than
|
||||
|
||||
Reference in New Issue
Block a user