diff --git a/src/etc/rc.d/amd b/src/etc/rc.d/amd index 348ebcb9..3bfe9dc5 100644 --- a/src/etc/rc.d/amd +++ b/src/etc/rc.d/amd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: amd,v 1.8 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: amd,v 1.9 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/amd" @@ -11,7 +11,7 @@ rc_reload=NO rc_stop=NO rc_pre() { - [ -e ${amd_master} ] || return 1 + [[ -e ${amd_master} ]] || return 1 daemon_flags="${daemon_flags} $(print -rn -- $(< ${amd_master}))" } diff --git a/src/etc/rc.d/bootparamd b/src/etc/rc.d/bootparamd index c3561f47..651d797f 100644 --- a/src/etc/rc.d/bootparamd +++ b/src/etc/rc.d/bootparamd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: bootparamd,v 1.3 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: bootparamd,v 1.4 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/rpc.bootparamd" @@ -9,7 +9,7 @@ daemon="/usr/sbin/rpc.bootparamd" rc_reload=NO rc_pre() { - [ -s /etc/bootparams ] + [[ -s /etc/bootparams ]] } rc_cmd $1 diff --git a/src/etc/rc.d/iked b/src/etc/rc.d/iked index 176a3bd9..405f0adb 100644 --- a/src/etc/rc.d/iked +++ b/src/etc/rc.d/iked @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: iked,v 1.4 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: iked,v 1.5 2018/01/11 21:09:26 rpe Exp $ daemon="/sbin/iked" @@ -9,7 +9,7 @@ daemon="/sbin/iked" pexp="iked: parent.*" rc_pre() { - [ X"${sasyncd_flags}" != X"NO" ] && \ + [[ ${sasyncd_flags} != NO ]] && daemon_flags="-S ${daemon_flags}" #return 0 # child will not return a config parsing error to the parent diff --git a/src/etc/rc.d/isakmpd b/src/etc/rc.d/isakmpd index 70cf07d7..1f554005 100644 --- a/src/etc/rc.d/isakmpd +++ b/src/etc/rc.d/isakmpd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: isakmpd,v 1.2 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: isakmpd,v 1.3 2018/01/11 21:09:26 rpe Exp $ daemon="/sbin/isakmpd" @@ -9,7 +9,7 @@ daemon="/sbin/isakmpd" pexp="isakmpd: monitor \[priv\]" rc_pre() { - [ X"${sasyncd_flags}" != X"NO" ] && \ + [[ ${sasyncd_flags} != NO ]] && daemon_flags="-S ${daemon_flags}" return 0 } diff --git a/src/etc/rc.d/ldattach b/src/etc/rc.d/ldattach index 42e2c478..259568ea 100644 --- a/src/etc/rc.d/ldattach +++ b/src/etc/rc.d/ldattach @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: ldattach,v 1.3 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: ldattach,v 1.4 2018/01/11 21:09:26 rpe Exp $ daemon="/sbin/ldattach" @@ -9,7 +9,7 @@ daemon="/sbin/ldattach" rc_reload=NO rc_pre() { - [ -n "${ldattach_flags}" ] + [[ -n ${ldattach_flags} ]] } rc_cmd $1 diff --git a/src/etc/rc.d/mopd b/src/etc/rc.d/mopd index 11f03c02..49706ecc 100644 --- a/src/etc/rc.d/mopd +++ b/src/etc/rc.d/mopd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: mopd,v 1.4 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: mopd,v 1.5 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/mopd" daemon_flags="-a" @@ -10,7 +10,7 @@ daemon_flags="-a" rc_reload=NO rc_pre() { - [ -d /tftpboot/mop ] + [[ -d /tftpboot/mop ]] } rc_cmd $1 diff --git a/src/etc/rc.d/mountd b/src/etc/rc.d/mountd index c1833799..ffedeb74 100644 --- a/src/etc/rc.d/mountd +++ b/src/etc/rc.d/mountd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: mountd,v 1.7 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: mountd,v 1.8 2018/01/11 21:09:26 rpe Exp $ daemon="/sbin/mountd" @@ -10,8 +10,8 @@ pexp="mountd: \[priv\]" rc_stop=NO rc_pre() { - [ -s /etc/exports ] && grep -qv '^#' /etc/exports && \ - rm -f /var/db/mountdtab && \ + [[ -s /etc/exports ]] && grep -qv '^#' /etc/exports && + rm -f /var/db/mountdtab && echo -n > /var/db/mountdtab } diff --git a/src/etc/rc.d/nfsd b/src/etc/rc.d/nfsd index 665552b8..2020f159 100644 --- a/src/etc/rc.d/nfsd +++ b/src/etc/rc.d/nfsd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: nfsd,v 1.7 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: nfsd,v 1.8 2018/01/11 21:09:26 rpe Exp $ daemon="/sbin/nfsd" daemon_flags="-tun 4" @@ -12,7 +12,7 @@ pexp="(${daemon}( |$)|nfsd: (master|server)$)" rc_reload=NO rc_pre() { - [ -s /etc/exports ] && grep -qv '^#' /etc/exports + [[ -s /etc/exports ]] && grep -qv '^#' /etc/exports } rc_cmd $1 diff --git a/src/etc/rc.d/rarpd b/src/etc/rc.d/rarpd index 779ebb45..98f5ad34 100644 --- a/src/etc/rc.d/rarpd +++ b/src/etc/rc.d/rarpd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: rarpd,v 1.4 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: rarpd,v 1.5 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/rarpd" daemon_flags="-a" @@ -10,7 +10,7 @@ daemon_flags="-a" rc_reload=NO rc_pre() { - [ -s /etc/ethers ] + [[ -s /etc/ethers ]] } rc_cmd $1 diff --git a/src/etc/rc.d/spamd b/src/etc/rc.d/spamd index dfc06d28..10971e34 100644 --- a/src/etc/rc.d/spamd +++ b/src/etc/rc.d/spamd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: spamd,v 1.9 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: spamd,v 1.10 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/libexec/spamd" @@ -10,7 +10,7 @@ pexp="spamd: \[priv\].*" rc_reload=NO rc_pre() { - if [ X"${spamd_black}" != X"NO" ]; then + if [[ ${spamd_black} != NO ]]; then daemon_flags="-b ${daemon_flags}" spamd_setup_flags="-b" fi diff --git a/src/etc/rc.d/spamlogd b/src/etc/rc.d/spamlogd index 1c24c2bf..ced8f07e 100644 --- a/src/etc/rc.d/spamlogd +++ b/src/etc/rc.d/spamlogd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: spamlogd,v 1.3 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: spamlogd,v 1.4 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/libexec/spamlogd" @@ -9,7 +9,7 @@ daemon="/usr/libexec/spamlogd" rc_reload=NO rc_pre() { - [ X"${spamd_flags}" != X"NO" -a X"${spamd_black}" = X"NO" ] + [[ ${spamd_flags} != NO && ${spamd_black} == NO ]] if pfctl -si | grep -q Enabled; then ifconfig pflog0 create if ifconfig pflog0; then diff --git a/src/etc/rc.d/unbound b/src/etc/rc.d/unbound index fd1e2e7c..a27a6703 100644 --- a/src/etc/rc.d/unbound +++ b/src/etc/rc.d/unbound @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: unbound,v 1.4 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: unbound,v 1.5 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/unbound" daemon_flags="-c /var/unbound/etc/unbound.conf" @@ -17,7 +17,7 @@ rc_pre() { } rc_start() { - /usr/sbin/unbound-checkconf > /dev/null && \ + /usr/sbin/unbound-checkconf > /dev/null && ${rcexec} "unbound ${daemon_flags}" } diff --git a/src/etc/rc.d/ypbind b/src/etc/rc.d/ypbind index ddb450e6..d28b8d79 100644 --- a/src/etc/rc.d/ypbind +++ b/src/etc/rc.d/ypbind @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: ypbind,v 1.8 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: ypbind,v 1.9 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/ypbind" @@ -10,7 +10,7 @@ rc_bg=YES rc_reload=NO rc_pre() { - [ X"`domainname`" != X"" ] + [[ -n $(domainname) ]] } rc_post() { diff --git a/src/etc/rc.d/yppasswdd b/src/etc/rc.d/yppasswdd index 5fb13ac4..1e12d23a 100644 --- a/src/etc/rc.d/yppasswdd +++ b/src/etc/rc.d/yppasswdd @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: yppasswdd,v 1.5 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: yppasswdd,v 1.6 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/rpc.yppasswdd" @@ -9,20 +9,20 @@ daemon="/usr/sbin/rpc.yppasswdd" rc_reload=NO rc_pre() { - [ X"`domainname`" != X"" -a -d /var/yp/`domainname` ] || \ + [[ -n $(domainname) && -d /var/yp/$(domainname) ]] || return 1 - _host1=`ypwhich -m passwd 2> /dev/null` - _host2=`hostname` - if [ `grep '^lookup' /etc/resolv.conf | grep yp | wc -c` -ne 0 ]; then - _host1=`ypmatch $_host1 hosts | cut -d' ' -f2` - _host2=`ypmatch $_host2 hosts | cut -d' ' -f2 | head -1` + _host1=$(ypwhich -m passwd 2> /dev/null) + _host2=$(hostname) + if [[ $(grep '^lookup' /etc/resolv.conf | grep yp | wc -c) -ne 0 ]]; then + _host1=$(ypmatch $_host1 hosts | cut -d' ' -f2) + _host2=$(ypmatch $_host2 hosts | cut -d' ' -f2 | head -1) else - _host1=`echo $_host1 | nslookup | grep '^Name: ' | \ - sed -e 's/^Name: //'` - _host2=`echo $_host2 | nslookup | grep '^Name: ' | \ - sed -e 's/^Name: //'` + _host1=$(echo $_host1 | nslookup | grep '^Name: ' | + sed -e 's/^Name: //') + _host2=$(echo $_host2 | nslookup | grep '^Name: ' | + sed -e 's/^Name: //') fi - [ "$_host2" = "$_host1" ] + [[ $_host2 == $_host1 ]] } rc_cmd $1 diff --git a/src/etc/rc.d/ypserv b/src/etc/rc.d/ypserv index ccbf31fa..803ac50f 100644 --- a/src/etc/rc.d/ypserv +++ b/src/etc/rc.d/ypserv @@ -1,13 +1,13 @@ #!/bin/ksh # -# $OpenBSD: ypserv,v 1.5 2018/01/11 19:52:12 rpe Exp $ +# $OpenBSD: ypserv,v 1.6 2018/01/11 21:09:26 rpe Exp $ daemon="/usr/sbin/ypserv" . /etc/rc.d/rc.subr rc_pre() { - [ X"`domainname`" != X"" -a -d /var/yp/`domainname` ] + [[ -n $(domainname) && -d /var/yp/$(domainname) ]] } rc_cmd $1