diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-08-25 16:01:45 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-08-25 16:01:45 +0000 |
commit | 8cec588c449f00982159304c76482d87d5194f0d (patch) | |
tree | c5b950c555128460f4c0f03bc9b54c807a922506 /etc/rc | |
parent | de5fc0125907bb6de177202bfa1b843589e80011 (diff) | |
download | FreeBSD-src-8cec588c449f00982159304c76482d87d5194f0d.zip FreeBSD-src-8cec588c449f00982159304c76482d87d5194f0d.tar.gz |
Style clean-up:
* All variables are now embraced: ${foo}
* All comparisons against some value now take the form:
[ "${foo}" ? "value" ]
where ? is a comparison operator
* All empty string tests now take the form:
[ -z "${foo}" ]
* All non-empty string tests now take the form:
[ -n "${foo}" ]
Submitted by: jkh
Diffstat (limited to 'etc/rc')
-rw-r--r-- | etc/rc | 108 |
1 files changed, 54 insertions, 54 deletions
@@ -1,5 +1,5 @@ #!/bin/sh -# $Id: rc,v 1.192 1999/08/06 06:20:19 peter Exp $ +# $Id: rc,v 1.193 1999/08/06 06:22:43 peter Exp $ # From: @(#)rc 5.27 (Berkeley) 6/5/91 # System startup script run by init on autoboot @@ -45,15 +45,15 @@ if [ -f /etc/ccd.conf ]; then ccdconfig -C fi -if [ X$start_vinum = XYES ]; then +if [ "${start_vinum}" = "YES" ]; then vinum start -elif [ -n "$vinum_drives" ]; then - vinum read $vinum_drives +elif [ -n "${vinum_drives}" ]; then + vinum read ${vinum_drives} fi swapon -a -if [ $1x = autobootx ]; then +if [ "$1" = "autoboot" ]; then echo Automatic reboot in progress... fsck -p case $? in @@ -95,7 +95,7 @@ trap "echo 'Reboot interrupted'; exit 1" 3 # diskless boot it does not have to be. # -if [ "X$root_rw_mount" != "XNO" ]; then +if [ "${root_rw_mount}" != "NO" ]; then mount -u -o rw / fi @@ -106,7 +106,7 @@ fi umount -a >/dev/null 2>&1 -if [ "X$early_nfs_mounts" != "XYES" ]; then +if [ "${early_nfs_mounts}" != "YES" ]; then mount -a -t nonfs else mount -a @@ -119,9 +119,9 @@ fi # Run custom disk mounting function here # -if [ "X$diskless_mount" != "X" ]; then - if [ -f $diskless_mount ]; then - sh $diskless_mount +if [ -n "${diskless_mount}" ]; then + if [ -f "${diskless_mount}" ]; then + sh ${diskless_mount} fi fi @@ -148,9 +148,9 @@ if [ -d /var/run -a -d /var/spool/lock -a -d /var/spool/uucp/.Temp ]; then fi # Add additional swapfile, if configured. -if [ "x$swapfile" != "xNO" -a -w "$swapfile" -a -b /dev/vn0b ]; then - echo "Adding $swapfile as additional swap." - vnconfig /dev/vn0b $swapfile && swapon /dev/vn0b +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 # set sysctl variables early as we can @@ -195,7 +195,7 @@ rm /var/run/clean_var # # See also the example of another cleanup policy in /etc/periodic/daily. # -if [ "X${clear_tmp_enable}" = X"YES" ]; then +if [ "${clear_tmp_enable}" = "YES" ]; then echo clearing /tmp # prune quickly with one rm, then use find to clean up /tmp/[lq]* @@ -217,7 +217,7 @@ echo -n 'additional daemons:' # 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 @@ -233,21 +233,21 @@ echo '.' # enable dumpdev so that savecore can see it # /var/crash should be a directory or a symbolic link # to the crash directory if core dumps are to be saved. -if [ "X${dumpdev}" != X"NO" -a -e ${dumpdev} -a -d /var/crash ]; then +if [ "${dumpdev}" != "NO" -a -e ${dumpdev} -a -d /var/crash ]; then dumpon ${dumpdev} echo -n checking for core dump... savecore /var/crash fi -if [ -n "$network_pass1_done" ]; then +if [ -n "${network_pass1_done}" ]; then network_pass2 fi # Enable/Check the quotas (must be after ypbind if using NIS) -if [ "X${enable_quotas}" = X"YES" ]; then +if [ "${enable_quotas}" = "YES" ]; then # Only check quotas if they have been previously enabled, and requested - if [ "X${check_quotas}" = X"YES" ]; then + if [ "${check_quotas}" = "YES" ]; then echo -n 'checking quotas:' quotacheck -a echo ' done.' @@ -258,7 +258,7 @@ if [ "X${enable_quotas}" = X"YES" ]; then echo ' done.' fi -if [ -n "$network_pass2_done" ]; then +if [ -n "${network_pass2_done}" ]; then network_pass3 fi @@ -274,7 +274,7 @@ then "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 @@ -285,11 +285,11 @@ fi # Make shared lib searching a little faster. Leave /usr/lib first if you # add your own entries or you may come to grief. if [ -x /sbin/ldconfig ]; then - if [ X"`/usr/bin/objformat`" = X"elf" ]; then + if [ "`/usr/bin/objformat`" = "elf" ]; then _LDC=/usr/lib - for i in $ldconfig_paths; do - if test -d $i; then - _LDC="${_LDC} $i" + for i in ${ldconfig_paths}; do + if test -d ${i}; then + _LDC="${_LDC} ${i}" fi done echo 'setting ELF ldconfig path:' ${_LDC} @@ -297,13 +297,13 @@ if [ -x /sbin/ldconfig ]; then fi # Legacy aout support for i386 only - if [ X"`sysctl -n hw.machine`" = X"i386" ]; then + if [ "`sysctl -n hw.machine`" = "i386" ]; then # Default the a.out ldconfig path. : ${ldconfig_paths_aout=${ldconfig_paths}} _LDC=/usr/lib/aout - for i in $ldconfig_paths_aout; do - if test -d $i; then - _LDC="${_LDC} $i" + for i in ${ldconfig_paths_aout}; do + if test -d ${i}; then + _LDC="${_LDC} ${i}" fi done echo 'setting a.out ldconfig path:' ${_LDC} @@ -314,23 +314,23 @@ fi # Now start up miscellaneous daemons that don't belong anywhere else # echo -n starting standard daemons: -if [ "X${inetd_enable}" != X"NO" ]; then +if [ "${inetd_enable}" != "NO" ]; then echo -n ' inetd'; inetd ${inetd_flags} fi -if [ "X${cron_enable}" != X"NO" ]; then +if [ "${cron_enable}" != "NO" ]; then echo -n ' cron'; cron fi -if [ "X${lpd_enable}" = X"YES" ]; then +if [ "${lpd_enable}" = "YES" ]; then echo -n ' printer'; ${lpd_program} ${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 -if [ "X${usbd_enable}" = X"YES" ]; then +if [ "${usbd_enable}" = "YES" ]; then echo -n ' usbd'; /usr/sbin/usbd ${usbd_flags} fi @@ -344,39 +344,39 @@ fi # Recover vi editor files. vibackup=`echo /var/tmp/vi.recover/vi.*` -if [ "$vibackup" != '/var/tmp/vi.recover/vi.*' ]; then +if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then echo 'Recovering vi editor sessions' - for i in $vibackup; do + for i in ${vibackup}; do # Only test files that are readable. - if test ! -r $i; then + if test ! -r ${i}; then continue fi # Unmodified nvi editor backup files either have the # execute bit set or are zero length. Delete them. - if test -x $i -o ! -s $i; then - rm -f $i + if test -x ${i} -o ! -s ${i}; then + rm -f ${i} fi done # It is possible to get incomplete recovery files, if the editor # crashes at the right time. virecovery=`echo /var/tmp/vi.recover/recover.*` - if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then - for i in $virecovery; do + if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then + for i in ${virecovery}; do # Only test files that are readable. - if test ! -r $i; then + if test ! -r ${i}; then continue fi # Delete any recovery files that are zero length, # corrupted, or that have no corresponding backup file. # Else send mail to the user. - recfile=`awk '/^X-vi-recover-path:/{print $2}' < $i` - if test -n "$recfile" -a -s "$recfile"; then - sendmail -t < $i + recfile=`awk '/^X-vi-recover-path:/{print $2}' < ${i}` + if test -n "${recfile}" -a -s "${recfile}"; then + sendmail -t < ${i} else - rm -f $i + rm -f ${i} fi done fi @@ -388,7 +388,7 @@ if [ ! -f /var/msgs/bounds ]; then 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 initialization:' for dir in ${local_startup}; do [ -d ${dir} ] && for script in ${dir}/*.sh; do @@ -399,16 +399,16 @@ if [ "X${local_startup}" != X"NO" ]; then echo . fi -if [ "X${update_motd}" != X"NO" ]; then +if [ "${update_motd}" != "NO" ]; then T=`mktemp /tmp/_motd.XXXXXX` if [ $? -eq 0 ]; then - uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > $T - awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> $T - cmp -s $T /etc/motd || { - cp $T /etc/motd + uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} + awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} + cmp -s ${T} /etc/motd || { + cp ${T} /etc/motd chmod 644 /etc/motd } - rm -f $T + rm -f ${T} fi fi @@ -437,7 +437,7 @@ fi # Raise kernel security level. This should be done only after `fsck' has # repaired local file systems if you want the securelevel to be greater than 1. -if [ "X${kern_securelevel_enable}" = X"YES" -a "${kern_securelevel}" -ge 0 ]; +if [ "${kern_securelevel_enable}" = "YES" -a "${kern_securelevel}" -ge 0 ]; then echo 'Raising kernel security level' sysctl -w kern.securelevel=${kern_securelevel} |