Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Jun 1997 00:22:21 -0300
From:      Harlan Stenn <Harlan.Stenn@pfcs.com>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   conf/3751: Improvements to /etc/rc{,.network,.pccard}
Message-ID:  <2668.865225341@mumps.pfcs.com>
Resent-Message-ID: <199706020430.VAA25408@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3751
>Category:       conf
>Synopsis:       Improvements to /etc/rc{,.network,.pccard}
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun  1 21:30:01 PDT 1997
>Last-Modified:
>Originator:     Harlan Stenn
>Organization:
PFCS Corporation
>Release:        FreeBSD 2.2-current i386
>Environment:

	-current (and before)

>Description:

	Several RC scripts use confusing syntax.  If I was really being a speed
	freak I'd replace the if [ ... ] stuff with case statements...

>How-To-Repeat:

	Examination.

>Fix:
	
	Untested...

--- rc-	Sun Jun  1 20:52:58 1997
+++ rc	Sun Jun  1 21:14:02 1997
@@ -29,7 +29,7 @@
 
 swapon -a
 
-if [ $1x = autobootx ]; then
+if [ "$1" = autoboot ]; then
 	echo Automatic reboot in progress...
 	fsck -p
 	case $? in
@@ -100,7 +100,7 @@
 
 
 # Add additional swapfile, if configured.
-if [ "x$swapfile" != "xNO" -a -w "$swapfile" -a -b /dev/vn0b ]; then
+if [ "$swapfile" != NO -a -w "$swapfile" -a -b /dev/vn0b ]; then
 	echo "Adding $swapfile as additional swap."
 	vnconfig /dev/vn0b $swapfile && swapon /dev/vn0b
 fi
@@ -133,13 +133,13 @@
 (cd /var/run && { cp /dev/null utmp; chmod 644 utmp; })
 
 # enable dumpdev so that savecore can see it
-if [ "X${dumpdev}" != X"NO" -a -e ${dumpdev} ]; then
+if [ "${dumpdev}" != NO -a -e ${dumpdev} ]; then
 	dumpon ${dumpdev}
 fi
 
 # /var/crash should be a directory or a symbolic link
 # to the crash directory if core dumps are to be saved.
-if [ "X${savecore_enable}" = X"YES" -a -d /var/crash ]; then
+if [ "${savecore_enable}" = YES -a -d /var/crash ]; then
 	echo -n checking for core dump...
 	savecore /var/crash
 fi
@@ -152,7 +152,7 @@
 # start system logging and name service (named needs to start before syslogd
 # if you don't have a /etc/resolv.conf)
 #
-if [ "X${syslogd_enable}" = X"YES" ]; then
+if [ "${syslogd_enable}" = YES ]; then
 	# Transitional symlink (for the next couple of years :) until all
 	# binaries had a chance to move towards /var/run/log.
 	if [ ! -h /dev/log ] ; then
@@ -164,7 +164,7 @@
 	echo -n ' syslogd';		syslogd ${syslogd_flags}
 fi
 
-if [ "X${tickadj_enable}" = X"YES" ]; then
+if [ "${tickadj_enable}" = YES ]; then
 	echo -n ' tickadj';	tickadj ${tickadj_flags--Aq}
 fi
 echo '.'
@@ -174,7 +174,7 @@
 fi
 
 # Check the quotas (must be after ypbind if using NIS)
-if [ "X${check_quotas}" = X"YES" ]; then
+if [ "${check_quotas}" = YES ]; then
 	echo -n 'checking quotas:'
 	quotacheck -a
 	echo ' done.'
@@ -197,7 +197,7 @@
 	"password file may be incorrect -- /etc/ptmp exists"
 fi
 
-if [ "X${accounting_enable}" = X"YES" -a -d /var/account ]; then
+if [ "${accounting_enable}" = YES -a -d /var/account ]; then
 	echo 'turning on accounting'
 	if [ ! -e /var/account/acct ]; then
 		touch /var/account/acct
@@ -220,11 +220,11 @@
 echo -n ' inetd';		inetd ${inetd_flags}
 echo -n ' cron';		cron
 
-if [ "X${lpd_enable}" = X"YES" ]; then
+if [ "${lpd_enable}" = YES ]; then
 	echo -n ' printer';		lpd ${lpd_flags}
 fi
 
-if [ "X${sendmail_enable}" = X"YES" -a -r /etc/sendmail.cf ]; then
+if [ "${sendmail_enable}" = YES -a -r /etc/sendmail.cf ]; then
 	echo -n ' sendmail';	/usr/sbin/sendmail ${sendmail_flags}
 fi
 
@@ -277,7 +277,7 @@
 fi
 
 # for each valid dir in $local_startup, search for init scripts matching *.sh
-if [ "X${local_startup}" != X"NO" ]; then
+if [ "${local_startup}" != NO ]; then
 	echo -n 'Local package startup:'
 	for dir in ${local_startup}; do
 		[ -d ${dir} ] && for script in ${dir}/*.sh; do
--- rc.network-	Sun Jun  1 20:52:58 1997
+++ rc.network	Sun Jun  1 21:15:56 1997
@@ -19,7 +19,7 @@
     fi
 
     # Set the domainname if we're using NIS
-    if [ -n "$nisdomainname" -a "x$nisdomainname" != "xNO" ] ; then
+    if [ -n "$nisdomainname" -a "$nisdomainname" != NO ] ; then
 	    domainname $nisdomainname
 	    echo -n ' domain'
     fi
@@ -56,18 +56,18 @@
     done
     
     # If IP filtering
-    if [ -n "$firewall" -a "x$firewall" != "xNO" -a -f /etc/rc.firewall ] ; then
+    if [ -n "$firewall" -a "$firewall" != NO -a -f /etc/rc.firewall ] ; then
 	    echo -n ' firewall'
 	    . /etc/rc.firewall
     fi
 
-    if [ "x$defaultrouter" != "xNO" ] ; then
+    if [ "$defaultrouter" != NO ] ; then
 	    static_routes="default ${static_routes}"
 	    route_default="default ${defaultrouter}"
     fi
     
     # Set up any static routes.  This should be done before router discovery.
-    if [ "x${static_routes}" != "x" ]; then
+    if [ "${static_routes}" != "" ]; then
 	    for i in ${static_routes}; do
 		    eval route_args=\$route_${i}
 		    route add ${route_args}
@@ -75,26 +75,26 @@
     fi
 
     echo -n 'Additional routing options:'
-    if [ "X$gateway_enable" = X"YES" ]; then
+    if [ "$gateway_enable" = YES ]; then
 	    echo -n ' IP gateway=YES'
 	    sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1
     fi
     
-    if [ "X$router_enable" = X"YES" ]; then
+    if [ "$router_enable" = YES ]; then
 	    echo -n " ${router}";	${router} ${router_flags}
     fi
     
-    if [ "X$ipxgateway_enable" = X"YES" ]; then
+    if [ "$ipxgateway_enable" = YES ]; then
 	    echo -n ' IPX gateway=YES'
 	    sysctl -w net.ipx.ipx.ipxforwarding=1 >/dev/null 2>&1
     fi
     
-    if [ "X$ipxrouted_enable" = X"YES" ]; then
+    if [ "$ipxrouted_enable" = YES ]; then
 	    echo -n ' IPXrouted: '
 	    IPXrouted ${ipxrouted_flags} > /dev/null 2>&1
     fi
     
-    if [ "X$arpproxy_all" = X"YES" ]; then
+    if [ "$arpproxy_all" = YES ]; then
 	    echo -n ' enabling ARP_PROXY_ALL: '
 	    sysctl -w net.link.ether.inet.proxyall=1 2>&1
     fi
@@ -104,51 +104,51 @@
 
 network_pass2() {
     echo -n 'Doing additional network setup:'
-    if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then
+    if [ -n "$tcp_extensions" -a "$tcp_extensions" != YES ] ; then
 	    echo -n ' tcp extensions=NO'
 	    sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1
 	    sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1
     fi
-    if [ "X${named_enable}" = X"YES" ]; then
+    if [ "${named_enable}" = YES ]; then
 	    echo -n ' named';		named ${named_flags}
     fi
 
-    if [ "X${ntpdate_enable}" = X"YES" -o "X${xntpd_enable}" = X"YES" ]; then
-	    if [ "X${ntpdate_enable}" = X"YES" ]; then
+    if [ "${ntpdate_enable}" = YES -o "${xntpd_enable}" = YES ]; then
+	    if [ "${ntpdate_enable}" = YES ]; then
 		    echo -n ' ntpdate';	ntpdate ${ntpdate_flags} >/dev/null 2>&1
 	    fi
 
-	    if [ "X${xntpd_enable}" = X"YES" ]; then
+	    if [ "${xntpd_enable}" = YES ]; then
 		    echo -n ' xntpd';	xntpd ${xntpd_flags}
 	    fi
     fi
 
-    if [ "X${timed_enable}" = X"YES" ]; then
+    if [ "${timed_enable}" = YES ]; then
 	    echo -n ' timed';		timed ${timed_flags}
     fi
 
-    if [ "X${portmap_enable}" = X"YES" ]; then
+    if [ "${portmap_enable}" = YES ]; then
 	    echo -n ' portmap';		portmap ${portmap_flags}
     fi
 
     # Start ypserv if we're an NIS server.
     # Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server.
-    if [ "X${nis_server_enable}" = X"YES" ]; then
+    if [ "${nis_server_enable}" = YES ]; then
 	    echo -n ' ypserv'; ypserv ${nis_server_flags}
 	    
-	    if [ "X${nis_ypxfrd_enable}" = X"YES" ]; then
+	    if [ "${nis_ypxfrd_enable}" = YES ]; then
 		    echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${nis_ypxfrd_flags}
 	    fi
 	    
-	    if [ "X${nis_yppasswdd_enable}" = X"YES" ]; then
+	    if [ "${nis_yppasswdd_enable}" = YES ]; then
 		    echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${nis_yppasswdd_flags}
 	    fi
     fi
 
     # Start ypbind if we're an NIS client
-    if [ "X${nis_client_enable}" = X"YES" ]; then
+    if [ "${nis_client_enable}" = YES ]; then
 	    echo -n ' ypbind'; ypbind ${nis_client_flags}
-	    if [ "X${nis_ypset_enable}" = X"YES" ]; then
+	    if [ "${nis_ypset_enable}" = YES ]; then
 		    echo -n ' ypset'; ypset ${nis_ypset_flags}
 	    fi
     fi
@@ -160,47 +160,47 @@
 network_pass3() {
     echo -n 'Starting final network daemons:'
 
-    if [ "X${nfs_server_enable}" = X"YES" -a -r /etc/exports ]; then
+    if [ "${nfs_server_enable}" = YES -a -r /etc/exports ]; then
 	    echo -n ' mountd'
-	    if [ "X${weak_mountd_authentication}" = X"YES" ]; then
+	    if [ "${weak_mountd_authentication}" = YES ]; then
 		    mountd_flags="-n"
 	    fi
 	    mountd ${mountd_flags}
-	    if [ "X${nfs_reserved_port_only}" = X"YES" ]; then
+	    if [ "${nfs_reserved_port_only}" = YES ]; then
 		    echo -n ' nfsprivport=YES'
 		    sysctl -w vfs.nfs.nfs_privport=1 >/dev/null 2>&1
 	    fi
 	    echo -n ' nfsd';		nfsd ${nfs_server_flags}
-	    if [ "X$rpc_lockd_enable" = X"YES" ]; then
+	    if [ "$rpc_lockd_enable" = YES ]; then
 		echo -n ' rpc.lockd';		rpc.lockd
 	    fi
-	    if [ "X$rpc_statd_enable" = X"YES" ]; then
+	    if [ "$rpc_statd_enable" = YES ]; then
 		echo -n ' rpc.statd';		rpc.statd
 	    fi
     fi
     
-    if [ "X${nfs_client_enable}" = X"YES" ]; then
+    if [ "${nfs_client_enable}" = YES ]; then
 	    echo -n ' nfsiod';		nfsiod ${nfs_client_flags}
     fi
 
-    if [ "X${amd_enable}" = X"YES" ]; then
+    if [ "${amd_enable}" = YES ]; then
 	    echo -n ' amd'
 	    amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null
     fi
 
-    if [ "X${rwhod_enable}" = X"YES" ]; then
+    if [ "${rwhod_enable}" = YES ]; then
 	    echo -n ' rwhod';	rwhod
     fi
 
     # Kerberos runs ONLY on the Kerberos server machine
-    if [ "X${kerberos_server_enable}" = X"YES" ]; then
+    if [ "${kerberos_server_enable}" = YES ]; then
 	    echo -n ' kerberos';	kerberos >> /var/log/kerberos.log &
 	    echo -n ' kadmind'; \
 		    (sleep 20; kadmind -n >/dev/null 2>&1 &) &
     fi
     
     # IP multicast routing daemon
-    if [ "X${mrouted_enable}" = X"YES" ]; then
+    if [ "${mrouted_enable}" = YES ]; then
 	    echo -n ' mrouted'; mrouted ${mrouted_flags}
     fi
     echo '.'
--- rc.pccard-	Sun Jun  1 20:52:58 1997
+++ rc.pccard	Sun Jun  1 21:16:06 1997
@@ -4,8 +4,8 @@
 # HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
 #
 
-if [ "X$pccard_enable" = X"YES" ] ; then
-	if [ "x$pccard_mem" != "xDEFAULT" ] ; then
+if [ "$pccard_enable" = YES ] ; then
+	if [ "$pccard_mem" != DEFAULT ] ; then
 		pccardc pccardmem $pccard_mem
 	else
 		pccardc pccardmem 0xd0000

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2668.865225341>