Browse Source

- change [] tests to [[]]

- change -a, -o to &&, || inside [[]]
- remove unecessary quoting inside [[]]
- remove X"" constructs inside [[]]
- remove \ (line continuation) in case of &&, || and pipes
- replace backticks with $()
discussed with and OK aja@
OK tb
OPENBSD_6_3
rpe 6 years ago
parent
commit
9c629f7d09
15 changed files with 41 additions and 41 deletions
  1. +2
    -2
      src/etc/rc.d/amd
  2. +2
    -2
      src/etc/rc.d/bootparamd
  3. +2
    -2
      src/etc/rc.d/iked
  4. +2
    -2
      src/etc/rc.d/isakmpd
  5. +2
    -2
      src/etc/rc.d/ldattach
  6. +2
    -2
      src/etc/rc.d/mopd
  7. +3
    -3
      src/etc/rc.d/mountd
  8. +2
    -2
      src/etc/rc.d/nfsd
  9. +2
    -2
      src/etc/rc.d/rarpd
  10. +2
    -2
      src/etc/rc.d/spamd
  11. +2
    -2
      src/etc/rc.d/spamlogd
  12. +2
    -2
      src/etc/rc.d/unbound
  13. +2
    -2
      src/etc/rc.d/ypbind
  14. +12
    -12
      src/etc/rc.d/yppasswdd
  15. +2
    -2
      src/etc/rc.d/ypserv

+ 2
- 2
src/etc/rc.d/amd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/usr/sbin/amd"
@ -11,7 +11,7 @@ rc_reload=NO
rc_stop=NO rc_stop=NO
rc_pre() { rc_pre() {
[ -e ${amd_master} ] || return 1
[[ -e ${amd_master} ]] || return 1
daemon_flags="${daemon_flags} $(print -rn -- $(< ${amd_master}))" daemon_flags="${daemon_flags} $(print -rn -- $(< ${amd_master}))"
} }


+ 2
- 2
src/etc/rc.d/bootparamd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/usr/sbin/rpc.bootparamd"
@ -9,7 +9,7 @@ daemon="/usr/sbin/rpc.bootparamd"
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
[ -s /etc/bootparams ]
[[ -s /etc/bootparams ]]
} }
rc_cmd $1 rc_cmd $1

+ 2
- 2
src/etc/rc.d/iked View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/sbin/iked"
@ -9,7 +9,7 @@ daemon="/sbin/iked"
pexp="iked: parent.*" pexp="iked: parent.*"
rc_pre() { rc_pre() {
[ X"${sasyncd_flags}" != X"NO" ] && \
[[ ${sasyncd_flags} != NO ]] &&
daemon_flags="-S ${daemon_flags}" daemon_flags="-S ${daemon_flags}"
#return 0 #return 0
# child will not return a config parsing error to the parent # child will not return a config parsing error to the parent


+ 2
- 2
src/etc/rc.d/isakmpd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/sbin/isakmpd"
@ -9,7 +9,7 @@ daemon="/sbin/isakmpd"
pexp="isakmpd: monitor \[priv\]" pexp="isakmpd: monitor \[priv\]"
rc_pre() { rc_pre() {
[ X"${sasyncd_flags}" != X"NO" ] && \
[[ ${sasyncd_flags} != NO ]] &&
daemon_flags="-S ${daemon_flags}" daemon_flags="-S ${daemon_flags}"
return 0 return 0
} }


+ 2
- 2
src/etc/rc.d/ldattach View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/sbin/ldattach"
@ -9,7 +9,7 @@ daemon="/sbin/ldattach"
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
[ -n "${ldattach_flags}" ]
[[ -n ${ldattach_flags} ]]
} }
rc_cmd $1 rc_cmd $1

+ 2
- 2
src/etc/rc.d/mopd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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="/usr/sbin/mopd"
daemon_flags="-a" daemon_flags="-a"
@ -10,7 +10,7 @@ daemon_flags="-a"
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
[ -d /tftpboot/mop ]
[[ -d /tftpboot/mop ]]
} }
rc_cmd $1 rc_cmd $1

+ 3
- 3
src/etc/rc.d/mountd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/sbin/mountd"
@ -10,8 +10,8 @@ pexp="mountd: \[priv\]"
rc_stop=NO rc_stop=NO
rc_pre() { 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 echo -n > /var/db/mountdtab
} }


+ 2
- 2
src/etc/rc.d/nfsd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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="/sbin/nfsd"
daemon_flags="-tun 4" daemon_flags="-tun 4"
@ -12,7 +12,7 @@ pexp="(${daemon}( |$)|nfsd: (master|server)$)"
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
[ -s /etc/exports ] && grep -qv '^#' /etc/exports
[[ -s /etc/exports ]] && grep -qv '^#' /etc/exports
} }
rc_cmd $1 rc_cmd $1

+ 2
- 2
src/etc/rc.d/rarpd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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="/usr/sbin/rarpd"
daemon_flags="-a" daemon_flags="-a"
@ -10,7 +10,7 @@ daemon_flags="-a"
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
[ -s /etc/ethers ]
[[ -s /etc/ethers ]]
} }
rc_cmd $1 rc_cmd $1

+ 2
- 2
src/etc/rc.d/spamd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/usr/libexec/spamd"
@ -10,7 +10,7 @@ pexp="spamd: \[priv\].*"
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
if [ X"${spamd_black}" != X"NO" ]; then
if [[ ${spamd_black} != NO ]]; then
daemon_flags="-b ${daemon_flags}" daemon_flags="-b ${daemon_flags}"
spamd_setup_flags="-b" spamd_setup_flags="-b"
fi fi


+ 2
- 2
src/etc/rc.d/spamlogd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/usr/libexec/spamlogd"
@ -9,7 +9,7 @@ daemon="/usr/libexec/spamlogd"
rc_reload=NO rc_reload=NO
rc_pre() { 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 if pfctl -si | grep -q Enabled; then
ifconfig pflog0 create ifconfig pflog0 create
if ifconfig pflog0; then if ifconfig pflog0; then


+ 2
- 2
src/etc/rc.d/unbound View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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="/usr/sbin/unbound"
daemon_flags="-c /var/unbound/etc/unbound.conf" daemon_flags="-c /var/unbound/etc/unbound.conf"
@ -17,7 +17,7 @@ rc_pre() {
} }
rc_start() { rc_start() {
/usr/sbin/unbound-checkconf > /dev/null && \
/usr/sbin/unbound-checkconf > /dev/null &&
${rcexec} "unbound ${daemon_flags}" ${rcexec} "unbound ${daemon_flags}"
} }


+ 2
- 2
src/etc/rc.d/ypbind View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/usr/sbin/ypbind"
@ -10,7 +10,7 @@ rc_bg=YES
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
[ X"`domainname`" != X"" ]
[[ -n $(domainname) ]]
} }
rc_post() { rc_post() {


+ 12
- 12
src/etc/rc.d/yppasswdd View File

@ -1,6 +1,6 @@
#!/bin/ksh #!/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" daemon="/usr/sbin/rpc.yppasswdd"
@ -9,20 +9,20 @@ daemon="/usr/sbin/rpc.yppasswdd"
rc_reload=NO rc_reload=NO
rc_pre() { rc_pre() {
[ X"`domainname`" != X"" -a -d /var/yp/`domainname` ] || \
[[ -n $(domainname) && -d /var/yp/$(domainname) ]] ||
return 1 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 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 fi
[ "$_host2" = "$_host1" ]
[[ $_host2 == $_host1 ]]
} }
rc_cmd $1 rc_cmd $1

+ 2
- 2
src/etc/rc.d/ypserv View File

@ -1,13 +1,13 @@
#!/bin/ksh #!/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" daemon="/usr/sbin/ypserv"
. /etc/rc.d/rc.subr . /etc/rc.d/rc.subr
rc_pre() { rc_pre() {
[ X"`domainname`" != X"" -a -d /var/yp/`domainname` ]
[[ -n $(domainname) && -d /var/yp/$(domainname) ]]
} }
rc_cmd $1 rc_cmd $1

Loading…
Cancel
Save