diff --git a/init.d.misc/avahi-dnsconfd.in b/init.d.misc/avahi-dnsconfd.in index 8153f0c4..257f7606 100644 --- a/init.d.misc/avahi-dnsconfd.in +++ b/init.d.misc/avahi-dnsconfd.in @@ -3,7 +3,7 @@ # All rights reserved. Released under the 2-clause BSD license. command=@PKG_PREFIX@/sbin/avahi-dnsconfd -command_args="${avahi_dnsconfd_args} -D" +command_args="$avahi_dnsconfd_args -D" pidfile=@VARBASE@/run/avahi-dnsconfd.pid name="Avahi DNS Configuration Daemon" diff --git a/init.d.misc/avahid.in b/init.d.misc/avahid.in index 458fc0bc..b035d594 100644 --- a/init.d.misc/avahid.in +++ b/init.d.misc/avahid.in @@ -3,7 +3,7 @@ # All rights reserved. Released under the 2-clause BSD license. command=@PKG_PREFIX@/sbin/avahi-daemon -command_args="${avahid_args} -D" +command_args="$avahid_args -D" pidfile=@VARBASE@/run/avahi-daemon/pid name="Avahi Service Advertisement Daemon" diff --git a/init.d.misc/dhcpcd.in b/init.d.misc/dhcpcd.in index 40234cfe..91f0110c 100644 --- a/init.d.misc/dhcpcd.in +++ b/init.d.misc/dhcpcd.in @@ -14,4 +14,5 @@ depend() use logger after bootmisc modules before dns + keyword noshutdown } diff --git a/init.d.misc/dnsmasq.in b/init.d.misc/dnsmasq.in index 02e146c1..8b11de86 100644 --- a/init.d.misc/dnsmasq.in +++ b/init.d.misc/dnsmasq.in @@ -3,7 +3,7 @@ # All rights reserved. Released under the 2-clause BSD license. command=@PKG_PREFIX@/sbin/dnsmasq -command_args=${dnsmasq_args} +command_args=$dnsmasq_args pidfile=@VARBASE@/run/dnsmasq.pid required_files=/etc/dnsmasq.conf @@ -18,7 +18,7 @@ depend() reload() { - ebegin "Reloading ${RC_SVCNAME}" - start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" + ebegin "Reloading $RC_SVCNAME" + start-stop-daemon --signal SIGHUP --pidfile "$pidfile" eend $? } diff --git a/init.d.misc/hald.in b/init.d.misc/hald.in index dd7802d1..25c03a84 100644 --- a/init.d.misc/hald.in +++ b/init.d.misc/hald.in @@ -4,7 +4,7 @@ command=@PKG_PREFIX@/sbin/hald pidfile=@VARBASE@/run/hald/hald.pid -command_args="${hald_args}" +command_args=$hald_args name="Hardware Abstraction Layer Daemon" depend() diff --git a/init.d.misc/named.in b/init.d.misc/named.in index 3674442d..6088f43f 100644 --- a/init.d.misc/named.in +++ b/init.d.misc/named.in @@ -3,14 +3,14 @@ # All rights reserved. Released under the 2-clause BSD license. command=/usr/sbin/named -command_args=${named_args} +command_args=$named_args pidfile=@VARBASE@/run/named.pid name="Domain Name server" extra_started_commands="reload" namedb=/etc/namedb uid=named -case "${RC_UNAME}" in +case "$RC_UNAME" in FreeBSD) uid=bind pidfile=@VARBASE@/run/named/pid @@ -19,7 +19,7 @@ case "${RC_UNAME}" in uid=bind ;; esac -named_uid=${named_uid:-${uid}} +: ${named_uid:=${uid}} depend() { @@ -30,68 +30,71 @@ depend() start_pre() { - if [ -n "${named_chroot}" ]; then + if [ -n "$named_chroot" ]; then # Create (or update) the chroot directory structure 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 ewarn "/etc/mtree/BIND.chroot.dist missing," ewarn "chroot directory structure not updated" fi - if [ ! -d "${named_chroot}"/. ]; then - eerror "chroot directory ${named_chroot} missing" + if [ ! -d "$named_chroot"/. ]; then + eerror "chroot directory $named_chroot missing" exit 1 fi # Create /etc/namedb symlink - if [ ! -L "${namedb}" ]; then - if [ -d "${namedb}" ]; then - ewarn "named chroot: ${namedb} is a directory!" - elif [ -e "${namedb}" ]; then - ewarn "named chroot: ${namedb} exists!" + if [ ! -L "$namedb" ]; then + if [ -d "$namedb" ]; then + ewarn "named chroot: $namedb is a directory!" + elif [ -e "$namedb" ]; then + ewarn "named chroot: $namedb exists!" else - ln -s "${named_chroot}${namedb}" "${namedb}" + ln -s "$named_chroot$namedb" "$namedb" fi else # Make sure it points to the right place. - ln -shf "${named_chroot}${namedb}" "${namedb}" + ln -shf "$named_chroot$namedb" "$namedb" fi - case "${RC_UNAME}" in + case "$RC_UNAME" in *BSD|DragonFly) # Mount a devfs in the chroot directory if needed - umount "${named_chroot}"/dev 2>/dev/null - mount -t devfs dev "${named_chroot}"/dev - devfs -m "${named_chroot}"/dev ruleset devfsrules_hide_all - devfs -m "${named_chroot}"/dev rule apply path null unhide - devfs -m "${named_chroot}"/dev rule apply path random unhide + umount "$named_chroot"/dev 2>/dev/null + mount -t devfs dev "$named_chroot"/dev + devfs -m "$named_chroot"/dev \ + ruleset devfsrules_hide_all + devfs -m "$named_chroot"/dev \ + rule apply path null unhide + devfs -m "$named_chroot"/dev \ + rule apply path random unhide ;; esac # Copy local timezone information if it is not up to date. if [ -r /etc/localtime ]; then - cmp -s /etc/localtime "${named_chroot}/etc/localtime" || - cp -p /etc/localtime "${named_chroot}/etc/localtime" + cmp -s /etc/localtime "$named_chroot/etc/localtime" || + cp -p /etc/localtime "$named_chroot/etc/localtime" 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 - if [ ! -s "${named_chroot}${namedb}/rndc.conf" ]; then - local confgen="${command%/named}/rndc-confgen -a -b256 -u ${named_uid} \ - -c ${named_chrootdir}/etc/namedb/rndc.key" - if [ -s "${named_chroot}${namedb}/rndc.key" ]; then + if [ ! -s "$named_chroot$namedb/rndc.conf" ]; then + local confgen="${command%/named}/rndc-confgen -a -b256 -u $named_uid \ + -c $named_chrootdir/etc/namedb/rndc.key" + if [ -s "$named_chroot$namedb/rndc.key" ]; then local getuser="stat -f%Su" - [ "${RC_UNAME}" = "Linux" ] && getuser="stat -c%U" - case $(${getuser} "${named_chroot}${namedb}"/rndc.key) in - root|"${named_uid}");; - *) ${confgen};; + [ "$RC_UNAME" = Linux ] && getuser="stat -c%U" + case $(${getuser} "$named_chroot$namedb"/rndc.key) in + root|"$named_uid");; + *) $confgen;; esac else - ${confgen} + $confgen fi fi } @@ -103,7 +106,7 @@ reload() stop_post() { - if [ -n "${named_chroot}" -a -c "${named_chroot}"/dev/null ]; then - umount "${named_chroot}"/dev 2>/dev/null || true + if [ -n "$named_chroot" -a -c "$named_chroot"/dev/null ]; then + umount "$named_chroot"/dev 2>/dev/null || true fi } diff --git a/init.d.misc/ntpd.in b/init.d.misc/ntpd.in index 70393239..aec0b67e 100644 --- a/init.d.misc/ntpd.in +++ b/init.d.misc/ntpd.in @@ -1,13 +1,14 @@ #!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples +# Copyright 2007-2009 Roy Marples # All rights reserved. Released under the 2-clause BSD license. -ntpd_config=${ntpd_config:-/etc/ntp.conf} -ntpd_drift=${ntpd_drift:-/var/db/ntpd.drift} +: ${ntpd_config:=/etc/ntp.conf} +: ${ntpd_drift:=/var/db/ntpd.drift} command=/usr/sbin/ntpd +required_files=$ntpd_config 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" depend() @@ -19,22 +20,18 @@ depend() start_pre() { - if [ ! -r "${ntpd_config}" ]; then - eerror "${ntpd_config} is not readable" - return 1 - fi - - if [ -n "${ntpd_chroot}" ]; then - case "${RC_UNAME}" in + if [ -n "$ntpd_chroot" ]; then + case "$RC_UNAME" in *BSD|DragonFly) - if [ ! -c "${ntpd_chroot}/dev/clockctl" ]; then - rm -f "${ntpd_chroot}/dev/clockctl" - (cd /dev; /bin/pax -rw -pe clockctl "${ntpd_chroot}/dev") + if [ ! -c "$ntpd_chroot/dev/clockctl" ]; then + rm -f "$ntpd_chroot/dev/clockctl" + (cd /dev; /bin/pax -rw -pe clockctl \ + "$ntpd_chroot/dev") fi ;; 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 } diff --git a/init.d.misc/openvpn.in b/init.d.misc/openvpn.in index 4f60b83a..55ff1f76 100644 --- a/init.d.misc/openvpn.in +++ b/init.d.misc/openvpn.in @@ -4,28 +4,29 @@ vpn=${RC_SVCNAME#*.} name="OpenVPN" -[ "${vpn}" != "openvpn" ] && name="${name} (${vpn})" +[ "$vpn" != openvpn ] && name="$name ($vpn)" command=@PKG_PREFIX@/sbin/openvpn -pidfile=@VARBASE@/run/"${RC_SVCNAME}".pid -openvpn_dir=${openvpn_dir:-@PKG_PREFIX@/etc/openvpn} -openvpn_config=${openvpn_config:-${openvpn_dir}/${vpn}.conf} -command_args="${openvpn_args} --daemon --config ${openvpn_config} --writepid ${pidfile}" -required_dirs="${openvpn_dir}" -required_files="${openvpn_config}" +pidfile=@VARBASE@/run/"$RC_SVCNAME".pid +: ${openvpn_dir:=@PKG_PREFIX@/etc/openvpn} +: ${openvpn_config:=$openvpn_dir/$vpn.conf} +command_args="$openvpn_args --daemon --config $openvpn_config" +command_args="$command_args --writepid $pidfile" +required_dirs=$openvpn_dir +required_files=$openvpn_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 -if yesno "${openvpn_client}"; then - openvpn_up=${openvpn_up:-${openvpn_dir}/up.sh} - openvpn_down=${openvpn_down:-${openvpn_dir}/down.sh} - command_args="${command_args} --nobind --up-delay --up-restart --down-pre" - command_args="${command_args} --up ${openvpn_up}" - command_args="${command_args} --down ${openvpn_down}" - required_files="${required_files} ${openvpn_up} ${openvpn_down}" +if yesno $openvpn_client; then + : ${openvpn_up:=${openvpn_dir}/up.sh} + : ${openvpn_down:=${openvpn_dir}/down.sh} + command_args="$command_args --nobind --up-delay --up-restart --down-pre" + command_args="$command_args --up $openvpn_up" + command_args="$command_args --down $openvpn_down" + required_files="$required_files $openvpn_up $openvpn_down" in_background_fake="start stop" - start_inactive="YES" + start_inactive=YES fi depend() @@ -38,7 +39,7 @@ depend() start_pre() { # Linux has good dynamic tun/tap creation - if [ "${RC_UNAME}" = "Linux" ]; then + if [ "$RC_UNAME" = Linux ]; then if [ ! -e /dev/net/tun ]; then if ! modprobe tun; then eerror "TUN/TAP support is not available in this kernel" @@ -60,8 +61,7 @@ start_pre() fi # 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 - command_args="${command_args} --cd ${openvpn_dir}" + if ! grep -q "^[ \t]*cd[ \t].*" "$openvpn_config"; then + command_args="$command_args --cd $openvpn_dir" fi } diff --git a/init.d.misc/polkitd.in b/init.d.misc/polkitd.in index a1736a98..13415f23 100644 --- a/init.d.misc/polkitd.in +++ b/init.d.misc/polkitd.in @@ -4,7 +4,7 @@ command=@PKG_PREFIX@/sbin/polkitd pidfile=@VARBASE@/run/polkitd/polkitd.pid -command_args="${polkitd_args}" +command_args="$polkitd_args" name="PolicyKit Daemon" depend() diff --git a/init.d.misc/sshd.in b/init.d.misc/sshd.in index 8c5c8b35..a3722528 100644 --- a/init.d.misc/sshd.in +++ b/init.d.misc/sshd.in @@ -3,7 +3,7 @@ # All rights reserved. Released under the 2-clause BSD license. command=/usr/sbin/sshd -command_args=${sshd_args} +command_args=$sshd_args pidfile=@VARBASE@/run/sshd.pid required_files=/etc/ssh/sshd_config @@ -31,5 +31,5 @@ start_pre() eend $? || return 1 fi - ${command} -t + $command -t } diff --git a/init.d.misc/wpa_supplicant.in b/init.d.misc/wpa_supplicant.in index 951d82f6..7b337ffb 100644 --- a/init.d.misc/wpa_supplicant.in +++ b/init.d.misc/wpa_supplicant.in @@ -4,8 +4,8 @@ command=/usr/sbin/wpa_supplicant wpa_supplicant_conf=/etc/wpa_supplicant.conf -wpa_supplicant_if=${wpa_supplicant_if:+-i}${wpa_supplicant_if} -command_args="-B -c${wpa_supplicant_conf} ${wpa_supplicant_if}" +wpa_supplicant_if=${wpa_supplicant_if:+-i}$wpa_supplicant_if +command_args="-B -c$wpa_supplicant_conf $wpa_supplicant_if" name="WPA Supplicant Daemon" depend() @@ -14,16 +14,17 @@ depend() use logger after bootmisc modules before dns dhcpcd net + keyword noshutdown } find_wireless() { local iface= - case "${RC_UNAME}" in + case "$RC_UNAME" in Linux) for iface in /sys/class/net/*; do - if [ -e "${iface}"/wireless ]; then + if [ -e "$iface"/wireless ]; then echo "${iface##*/}" return 0 fi @@ -49,8 +50,8 @@ append_wireless() local iface= iface=$(find_wireless) - if [ -n "${iface}" ]; then - command_args="${command_args} -i${iface}" + if [ -n "$iface" ]; then + command_args="$command_args -i$iface" else eerror "Could not find a wireless interface" fi @@ -58,7 +59,7 @@ append_wireless() start_pre() { - case " ${command_args}" in + case " $command_args" in *" -i"*) ;; *) append_wireless;; esac