Add noshutdown to dhcpcd and wpa_supplicant. Tweak for style.

This commit is contained in:
Roy Marples 2009-04-27 12:06:54 +00:00
parent 94b3057571
commit 71062f479a
11 changed files with 88 additions and 86 deletions

View File

@ -3,7 +3,7 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
command=@PKG_PREFIX@/sbin/avahi-dnsconfd command=@PKG_PREFIX@/sbin/avahi-dnsconfd
command_args="${avahi_dnsconfd_args} -D" command_args="$avahi_dnsconfd_args -D"
pidfile=@VARBASE@/run/avahi-dnsconfd.pid pidfile=@VARBASE@/run/avahi-dnsconfd.pid
name="Avahi DNS Configuration Daemon" name="Avahi DNS Configuration Daemon"

View File

@ -3,7 +3,7 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
command=@PKG_PREFIX@/sbin/avahi-daemon command=@PKG_PREFIX@/sbin/avahi-daemon
command_args="${avahid_args} -D" command_args="$avahid_args -D"
pidfile=@VARBASE@/run/avahi-daemon/pid pidfile=@VARBASE@/run/avahi-daemon/pid
name="Avahi Service Advertisement Daemon" name="Avahi Service Advertisement Daemon"

View File

@ -14,4 +14,5 @@ depend()
use logger use logger
after bootmisc modules after bootmisc modules
before dns before dns
keyword noshutdown
} }

View File

@ -3,7 +3,7 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
command=@PKG_PREFIX@/sbin/dnsmasq command=@PKG_PREFIX@/sbin/dnsmasq
command_args=${dnsmasq_args} command_args=$dnsmasq_args
pidfile=@VARBASE@/run/dnsmasq.pid pidfile=@VARBASE@/run/dnsmasq.pid
required_files=/etc/dnsmasq.conf required_files=/etc/dnsmasq.conf
@ -18,7 +18,7 @@ depend()
reload() reload()
{ {
ebegin "Reloading ${RC_SVCNAME}" ebegin "Reloading $RC_SVCNAME"
start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" start-stop-daemon --signal SIGHUP --pidfile "$pidfile"
eend $? eend $?
} }

View File

@ -4,7 +4,7 @@
command=@PKG_PREFIX@/sbin/hald command=@PKG_PREFIX@/sbin/hald
pidfile=@VARBASE@/run/hald/hald.pid pidfile=@VARBASE@/run/hald/hald.pid
command_args="${hald_args}" command_args=$hald_args
name="Hardware Abstraction Layer Daemon" name="Hardware Abstraction Layer Daemon"
depend() depend()

View File

@ -3,14 +3,14 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
command=/usr/sbin/named command=/usr/sbin/named
command_args=${named_args} command_args=$named_args
pidfile=@VARBASE@/run/named.pid pidfile=@VARBASE@/run/named.pid
name="Domain Name server" name="Domain Name server"
extra_started_commands="reload" extra_started_commands="reload"
namedb=/etc/namedb namedb=/etc/namedb
uid=named uid=named
case "${RC_UNAME}" in case "$RC_UNAME" in
FreeBSD) FreeBSD)
uid=bind uid=bind
pidfile=@VARBASE@/run/named/pid pidfile=@VARBASE@/run/named/pid
@ -19,7 +19,7 @@ case "${RC_UNAME}" in
uid=bind uid=bind
;; ;;
esac esac
named_uid=${named_uid:-${uid}} : ${named_uid:=${uid}}
depend() depend()
{ {
@ -30,68 +30,71 @@ depend()
start_pre() start_pre()
{ {
if [ -n "${named_chroot}" ]; then if [ -n "$named_chroot" ]; then
# Create (or update) the chroot directory structure # Create (or update) the chroot directory structure
if [ -r /etc/mtree/BIND.chroot.dist ]; then if [ -r /etc/mtree/BIND.chroot.dist ]; then
mtree -deU -f /etc/mtree/BIND.chroot.dist -p "${named_chroot}" mtree -deU -f /etc/mtree/BIND.chroot.dist -p "$named_chroot"
else else
ewarn "/etc/mtree/BIND.chroot.dist missing," ewarn "/etc/mtree/BIND.chroot.dist missing,"
ewarn "chroot directory structure not updated" ewarn "chroot directory structure not updated"
fi fi
if [ ! -d "${named_chroot}"/. ]; then if [ ! -d "$named_chroot"/. ]; then
eerror "chroot directory ${named_chroot} missing" eerror "chroot directory $named_chroot missing"
exit 1 exit 1
fi fi
# Create /etc/namedb symlink # Create /etc/namedb symlink
if [ ! -L "${namedb}" ]; then if [ ! -L "$namedb" ]; then
if [ -d "${namedb}" ]; then if [ -d "$namedb" ]; then
ewarn "named chroot: ${namedb} is a directory!" ewarn "named chroot: $namedb is a directory!"
elif [ -e "${namedb}" ]; then elif [ -e "$namedb" ]; then
ewarn "named chroot: ${namedb} exists!" ewarn "named chroot: $namedb exists!"
else else
ln -s "${named_chroot}${namedb}" "${namedb}" ln -s "$named_chroot$namedb" "$namedb"
fi fi
else else
# Make sure it points to the right place. # Make sure it points to the right place.
ln -shf "${named_chroot}${namedb}" "${namedb}" ln -shf "$named_chroot$namedb" "$namedb"
fi fi
case "${RC_UNAME}" in case "$RC_UNAME" in
*BSD|DragonFly) *BSD|DragonFly)
# Mount a devfs in the chroot directory if needed # Mount a devfs in the chroot directory if needed
umount "${named_chroot}"/dev 2>/dev/null umount "$named_chroot"/dev 2>/dev/null
mount -t devfs dev "${named_chroot}"/dev mount -t devfs dev "$named_chroot"/dev
devfs -m "${named_chroot}"/dev ruleset devfsrules_hide_all devfs -m "$named_chroot"/dev \
devfs -m "${named_chroot}"/dev rule apply path null unhide ruleset devfsrules_hide_all
devfs -m "${named_chroot}"/dev rule apply path random unhide devfs -m "$named_chroot"/dev \
rule apply path null unhide
devfs -m "$named_chroot"/dev \
rule apply path random unhide
;; ;;
esac esac
# Copy local timezone information if it is not up to date. # Copy local timezone information if it is not up to date.
if [ -r /etc/localtime ]; then if [ -r /etc/localtime ]; then
cmp -s /etc/localtime "${named_chroot}/etc/localtime" || cmp -s /etc/localtime "$named_chroot/etc/localtime" ||
cp -p /etc/localtime "${named_chroot}/etc/localtime" cp -p /etc/localtime "$named_chroot/etc/localtime"
fi fi
command_args="${command_args} -t ${named_chroot}" command_args="$command_args -t $named_chroot"
ln -fs "${named_chroot}${pidfile}" "${pidfile}" ln -fs "$named_chroot$pidfile" "$pidfile"
fi fi
if [ ! -s "${named_chroot}${namedb}/rndc.conf" ]; then if [ ! -s "$named_chroot$namedb/rndc.conf" ]; then
local confgen="${command%/named}/rndc-confgen -a -b256 -u ${named_uid} \ local confgen="${command%/named}/rndc-confgen -a -b256 -u $named_uid \
-c ${named_chrootdir}/etc/namedb/rndc.key" -c $named_chrootdir/etc/namedb/rndc.key"
if [ -s "${named_chroot}${namedb}/rndc.key" ]; then if [ -s "$named_chroot$namedb/rndc.key" ]; then
local getuser="stat -f%Su" local getuser="stat -f%Su"
[ "${RC_UNAME}" = "Linux" ] && getuser="stat -c%U" [ "$RC_UNAME" = Linux ] && getuser="stat -c%U"
case $(${getuser} "${named_chroot}${namedb}"/rndc.key) in case $(${getuser} "$named_chroot$namedb"/rndc.key) in
root|"${named_uid}");; root|"$named_uid");;
*) ${confgen};; *) $confgen;;
esac esac
else else
${confgen} $confgen
fi fi
fi fi
} }
@ -103,7 +106,7 @@ reload()
stop_post() stop_post()
{ {
if [ -n "${named_chroot}" -a -c "${named_chroot}"/dev/null ]; then if [ -n "$named_chroot" -a -c "$named_chroot"/dev/null ]; then
umount "${named_chroot}"/dev 2>/dev/null || true umount "$named_chroot"/dev 2>/dev/null || true
fi fi
} }

View File

@ -1,13 +1,14 @@
#!@PREFIX@/sbin/runscript #!@PREFIX@/sbin/runscript
# Copyright 2007-2008 Roy Marples <roy@marples.name> # Copyright 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
ntpd_config=${ntpd_config:-/etc/ntp.conf} : ${ntpd_config:=/etc/ntp.conf}
ntpd_drift=${ntpd_drift:-/var/db/ntpd.drift} : ${ntpd_drift:=/var/db/ntpd.drift}
command=/usr/sbin/ntpd command=/usr/sbin/ntpd
required_files=$ntpd_config
pidfile=/var/run/ntpd.pid pidfile=/var/run/ntpd.pid
command_args="${ntpd_args} -c ${ntpd_config} -f ${ntpd_drift} -p ${pidfile}" command_args="$ntpd_args -c $ntpd_config -f $ntpd_drift -p $pidfile"
name="Network Time Protocol Daemon" name="Network Time Protocol Daemon"
depend() depend()
@ -19,22 +20,18 @@ depend()
start_pre() start_pre()
{ {
if [ ! -r "${ntpd_config}" ]; then if [ -n "$ntpd_chroot" ]; then
eerror "${ntpd_config} is not readable" case "$RC_UNAME" in
return 1
fi
if [ -n "${ntpd_chroot}" ]; then
case "${RC_UNAME}" in
*BSD|DragonFly) *BSD|DragonFly)
if [ ! -c "${ntpd_chroot}/dev/clockctl" ]; then if [ ! -c "$ntpd_chroot/dev/clockctl" ]; then
rm -f "${ntpd_chroot}/dev/clockctl" rm -f "$ntpd_chroot/dev/clockctl"
(cd /dev; /bin/pax -rw -pe clockctl "${ntpd_chroot}/dev") (cd /dev; /bin/pax -rw -pe clockctl \
"$ntpd_chroot/dev")
fi fi
;; ;;
esac esac
ln -fs "${ntpd_chroot}${ntpd_drift}" "${ntpd_drift}" ln -fs "$ntpd_chroot$ntpd_drift" "$ntpd_drift"
command_args="${command_args} -u ntpd:ntpd -i ${ntpd_chroot}" command_args="$command_args -u ntpd:ntpd -i $ntpd_chroot"
fi fi
} }

View File

@ -4,28 +4,29 @@
vpn=${RC_SVCNAME#*.} vpn=${RC_SVCNAME#*.}
name="OpenVPN" name="OpenVPN"
[ "${vpn}" != "openvpn" ] && name="${name} (${vpn})" [ "$vpn" != openvpn ] && name="$name ($vpn)"
command=@PKG_PREFIX@/sbin/openvpn command=@PKG_PREFIX@/sbin/openvpn
pidfile=@VARBASE@/run/"${RC_SVCNAME}".pid pidfile=@VARBASE@/run/"$RC_SVCNAME".pid
openvpn_dir=${openvpn_dir:-@PKG_PREFIX@/etc/openvpn} : ${openvpn_dir:=@PKG_PREFIX@/etc/openvpn}
openvpn_config=${openvpn_config:-${openvpn_dir}/${vpn}.conf} : ${openvpn_config:=$openvpn_dir/$vpn.conf}
command_args="${openvpn_args} --daemon --config ${openvpn_config} --writepid ${pidfile}" command_args="$openvpn_args --daemon --config $openvpn_config"
required_dirs="${openvpn_dir}" command_args="$command_args --writepid $pidfile"
required_files="${openvpn_config}" required_dirs=$openvpn_dir
required_files=$openvpn_config
# If we're an openvpn client, then supply a nice default config # If we're an openvpn client, then supply a nice default config
# You can find sample up/down scripts in the OpenRC support/openvpn dir # You can find sample up/down scripts in the OpenRC support/openvpn dir
if yesno "${openvpn_client}"; then if yesno $openvpn_client; then
openvpn_up=${openvpn_up:-${openvpn_dir}/up.sh} : ${openvpn_up:=${openvpn_dir}/up.sh}
openvpn_down=${openvpn_down:-${openvpn_dir}/down.sh} : ${openvpn_down:=${openvpn_dir}/down.sh}
command_args="${command_args} --nobind --up-delay --up-restart --down-pre" command_args="$command_args --nobind --up-delay --up-restart --down-pre"
command_args="${command_args} --up ${openvpn_up}" command_args="$command_args --up $openvpn_up"
command_args="${command_args} --down ${openvpn_down}" command_args="$command_args --down $openvpn_down"
required_files="${required_files} ${openvpn_up} ${openvpn_down}" required_files="$required_files $openvpn_up $openvpn_down"
in_background_fake="start stop" in_background_fake="start stop"
start_inactive="YES" start_inactive=YES
fi fi
depend() depend()
@ -38,7 +39,7 @@ depend()
start_pre() start_pre()
{ {
# Linux has good dynamic tun/tap creation # Linux has good dynamic tun/tap creation
if [ "${RC_UNAME}" = "Linux" ]; then if [ "$RC_UNAME" = Linux ]; then
if [ ! -e /dev/net/tun ]; then if [ ! -e /dev/net/tun ]; then
if ! modprobe tun; then if ! modprobe tun; then
eerror "TUN/TAP support is not available in this kernel" eerror "TUN/TAP support is not available in this kernel"
@ -60,8 +61,7 @@ start_pre()
fi fi
# If the config file does not specify the cd option, we do # If the config file does not specify the cd option, we do
# But if we specify it, we override the config option which we do not want if ! grep -q "^[ \t]*cd[ \t].*" "$openvpn_config"; then
if ! grep -q "^[ \t]*cd[ \t].*" "${openvpn_config}"; then command_args="$command_args --cd $openvpn_dir"
command_args="${command_args} --cd ${openvpn_dir}"
fi fi
} }

View File

@ -4,7 +4,7 @@
command=@PKG_PREFIX@/sbin/polkitd command=@PKG_PREFIX@/sbin/polkitd
pidfile=@VARBASE@/run/polkitd/polkitd.pid pidfile=@VARBASE@/run/polkitd/polkitd.pid
command_args="${polkitd_args}" command_args="$polkitd_args"
name="PolicyKit Daemon" name="PolicyKit Daemon"
depend() depend()

View File

@ -3,7 +3,7 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
command=/usr/sbin/sshd command=/usr/sbin/sshd
command_args=${sshd_args} command_args=$sshd_args
pidfile=@VARBASE@/run/sshd.pid pidfile=@VARBASE@/run/sshd.pid
required_files=/etc/ssh/sshd_config required_files=/etc/ssh/sshd_config
@ -31,5 +31,5 @@ start_pre()
eend $? || return 1 eend $? || return 1
fi fi
${command} -t $command -t
} }

View File

@ -4,8 +4,8 @@
command=/usr/sbin/wpa_supplicant command=/usr/sbin/wpa_supplicant
wpa_supplicant_conf=/etc/wpa_supplicant.conf wpa_supplicant_conf=/etc/wpa_supplicant.conf
wpa_supplicant_if=${wpa_supplicant_if:+-i}${wpa_supplicant_if} wpa_supplicant_if=${wpa_supplicant_if:+-i}$wpa_supplicant_if
command_args="-B -c${wpa_supplicant_conf} ${wpa_supplicant_if}" command_args="-B -c$wpa_supplicant_conf $wpa_supplicant_if"
name="WPA Supplicant Daemon" name="WPA Supplicant Daemon"
depend() depend()
@ -14,16 +14,17 @@ depend()
use logger use logger
after bootmisc modules after bootmisc modules
before dns dhcpcd net before dns dhcpcd net
keyword noshutdown
} }
find_wireless() find_wireless()
{ {
local iface= local iface=
case "${RC_UNAME}" in case "$RC_UNAME" in
Linux) Linux)
for iface in /sys/class/net/*; do for iface in /sys/class/net/*; do
if [ -e "${iface}"/wireless ]; then if [ -e "$iface"/wireless ]; then
echo "${iface##*/}" echo "${iface##*/}"
return 0 return 0
fi fi
@ -49,8 +50,8 @@ append_wireless()
local iface= local iface=
iface=$(find_wireless) iface=$(find_wireless)
if [ -n "${iface}" ]; then if [ -n "$iface" ]; then
command_args="${command_args} -i${iface}" command_args="$command_args -i$iface"
else else
eerror "Could not find a wireless interface" eerror "Could not find a wireless interface"
fi fi
@ -58,7 +59,7 @@ append_wireless()
start_pre() start_pre()
{ {
case " ${command_args}" in case " $command_args" in
*" -i"*) ;; *" -i"*) ;;
*) append_wireless;; *) append_wireless;;
esac esac