Index: head/etc/rc.d/accounting =================================================================== --- head/etc/rc.d/accounting (revision 103018) +++ head/etc/rc.d/accounting (revision 103019) @@ -1,55 +1,55 @@ #!/bin/sh # # $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $ # $FreeBSD$ # # PROVIDE: accounting # REQUIRE: mountall # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="accounting" rcvar=`set_rcvar` accounting_command="/usr/sbin/accton" accounting_file="/var/account/acct" start_cmd="accounting_start" stop_cmd="accounting_stop" accounting_start() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) _dir=`dirname "$accounting_file"` if [ ! -d `dirname "$_dir"` ]; then if ! mkdir -p "$_dir" ; then warn "Could not create $_dir." return 1 fi fi if [ ! -e "$accounting_file" ]; then touch "$accounting_file" fi ;; *) ;; esac if [ ! -f ${accounting_file} ]; then echo "Creating accounting file ${accounting_file}" ( umask 022 ; > ${accounting_file} ) fi echo "Turning on accounting." ${accounting_command} ${accounting_file} } accounting_stop() { echo "Turning off accounting." ${accounting_command} } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/amd =================================================================== --- head/etc/rc.d/amd (revision 103018) +++ head/etc/rc.d/amd (revision 103019) @@ -1,70 +1,70 @@ #!/bin/sh # # $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $ # $FreeBSD$ # # PROVIDE: amd # REQUIRE: rpcbind mountall ypbind nfsclient # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="amd" rcvar=`set_rcvar` command="/usr/sbin/${name}" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_precmd="amd_precmd" command_args="&" ;; NetBSD) command_args='-p -a '$amd_dir' -F /etc/amd.conf >/var/run/amd.pid' required_dirs="$amd_dir" required_files="/etc/amd.conf" required_vars="rpcbind" ;; esac amd_precmd() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) if ! checkyesno nfs_client_enable ; then force_depend nfsclient || return 1 fi if ! checkyesno rpcbind_enable && \ ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 fi case ${amd_map_program} in [Nn][Oo] | '') ;; *) amd_flags="${amd_flags} `eval ${amd_map_program}`" ;; esac case "${amd_flags}" in '') if [ ! -r /etc/amd.conf ]; then warn 'amd will not load without arguments' return 1 fi ;; *) amd_flags="-p ${amd_flags} > /var/run/amd.pid 2> /dev/null" \ ;; esac ;; esac return 0 } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/apmd =================================================================== --- head/etc/rc.d/apmd (revision 103018) +++ head/etc/rc.d/apmd (revision 103019) @@ -1,39 +1,39 @@ #!/bin/sh # # $NetBSD: apmd,v 1.5 2002/03/22 04:33:58 thorpej Exp $ # $FreeBSD$ # # PROVIDE: apmd # REQUIRE: DAEMON apm # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="apmd" rcvar=`set_rcvar` command="/usr/sbin/${name}" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_precmd="apmd_prestart" ;; esac apmd_prestart() { case `${SYSCTL_N} hw.machine_arch` in i386) # Don't start if apm is already running /etc/rc.d/apm forcestatus > /dev/null && return 1 ;; *) return 1 ;; esac return 0 } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/bootparams =================================================================== --- head/etc/rc.d/bootparams (revision 103018) +++ head/etc/rc.d/bootparams (revision 103019) @@ -1,28 +1,28 @@ #!/bin/sh # # $NetBSD: bootparams,v 1.6 2002/03/22 04:33:58 thorpej Exp $ # $FreeBSD$ # # PROVIDE: bootparams # REQUIRE: rpcbind DAEMON # BEFORE: LOGIN # KEYWORD: FreeBSD . /etc/rc.subr name="bootparamd" rcvar=`set_rcvar` required_files="/etc/bootparams" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) command="/usr/sbin/${name}" ;; NetBSD) command="/usr/sbin/rpc.${name}" ;; esac load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/cleartmp =================================================================== --- head/etc/rc.d/cleartmp (revision 103018) +++ head/etc/rc.d/cleartmp (revision 103019) @@ -1,46 +1,46 @@ #!/bin/sh # # $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $ # $FreeBSD$ # # PROVIDE: cleartmp # REQUIRE: mountall # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="cleartmp" rcvar=`set_rcvar clear_tmp` start_cmd="cleartmp_start" stop_cmd=":" cleartmp_start() { echo "Clearing /tmp." # # Prune quickly with one rm, then use find to clean up # /tmp/[lq]* (this is not needed with mfs /tmp, but # doesn't hurt anything). # (cd /tmp && rm -rf [a-km-pr-zA-Z]* && find -x . ! -name . ! -name lost+found ! -name quota.user \ ! -name quota.group -exec rm -rf -- {} \; -type d -prune) - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # Remove X lock files, since they will prevent you from # restarting X # rm -f /tmp/.X*-lock rm -fr /tmp/.X11-unix mkdir -m 1777 /tmp/.X11-unix ;; NetBSD) ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/fsck =================================================================== --- head/etc/rc.d/fsck (revision 103018) +++ head/etc/rc.d/fsck (revision 103019) @@ -1,103 +1,103 @@ #!/bin/sh # # $NetBSD: fsck,v 1.2 2001/06/18 06:42:35 lukem Exp $ # $FreeBSD$ # # PROVIDE: fsck # REQUIRE: localswap # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="fsck" start_cmd="fsck_start" stop_cmd=":" stop_boot() { # Terminate the process (which may include the parent /etc/rc) # if booting directly to multiuser mode. # if [ "$autoboot" = yes ]; then kill -TERM $$ fi exit 1 } fsck_start() { if [ "$autoboot" = no ]; then echo "Fast boot: skipping disk checks." elif [ "$autoboot" = yes ]; then # During fsck ignore SIGQUIT trap : 3 echo "Starting file system checks:" - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) if checkyesno background_fsck; then fsck -F -p else fsck -p fi ;; NetBSD) fsck -p ;; esac case $? in 0) ;; 2) stop_boot ;; 4) echo "Rebooting..." reboot echo "Reboot failed; help!" stop_boot ;; 8) - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y." fsck -y case $? in 0) ;; *) echo "Automatic file system check failed; help!" stop_boot ;; esac else echo "Automatic file system check failed; help!" stop_boot fi ;; NetBSD) echo "Automatic file system check failed; help!" stop_boot ;; esac ;; 12) echo "Boot interrupted." stop_boot ;; 130) stop_boot ;; *) echo "Unknown error; help!" stop_boot ;; esac fi } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ipfilter =================================================================== --- head/etc/rc.d/ipfilter (revision 103018) +++ head/etc/rc.d/ipfilter (revision 103019) @@ -1,153 +1,153 @@ #!/bin/sh # # $NetBSD: ipfilter,v 1.10 2001/02/28 17:03:50 lukem Exp $ # $FreeBSD$ # # PROVIDE: ipfilter # REQUIRE: root beforenetlkm mountcritlocal tty # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ipfilter" rcvar=`set_rcvar` load_rc_config $name -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) stop_precmd="test -f ${ipfilter_rules}" ;; NetBSD) stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf" ;; esac start_precmd="ipfilter_prestart" start_cmd="ipfilter_start" stop_cmd="ipfilter_stop" reload_precmd="$stop_precmd" reload_cmd="ipfilter_reload" resync_precmd="$stop_precmd" resync_cmd="ipfilter_resync" status_precmd="$stop_precmd" status_cmd="ipfilter_status" extra_commands="reload resync status" ipfilter_prestart() { -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) # load ipfilter kernel module if needed if ! sysctl net.inet.ipf.fr_pass > /dev/null 2>&1; then if kldload ipl ; then echo 'IP-filter module loaded.' else warn 'IP-filter module failed to load.' return 1 fi fi # check for ipfilter rules if [ ! -r "${ipfilter_rules}" ]; then warn 'IP-filter: NO IPF RULES' return 1 fi ;; NetBSD) if [ ! -f /etc/ipf.conf ] && [ ! -f /etc/ipf6.conf ]; then warn "/etc/ipf*.conf not readable; ipfilter start aborted." # # If booting directly to multiuser, send SIGTERM to # the parent (/etc/rc) to abort the boot # if [ "$autoboot" = yes ]; then echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!" kill -TERM $$ exit 1 fi return 1 fi ;; esac return 0 } ipfilter_start() { echo "Enabling ipfilter." - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) ${ipfilter_program:-/sbin/ipf} -Fa -f \ "${ipfilter_rules}" ${ipfilter_flags} ;; NetBSD) /sbin/ipf -E -Fa if [ -f /etc/ipf.conf ]; then /sbin/ipf -f /etc/ipf.conf fi if [ -f /etc/ipf6.conf ]; then /sbin/ipf -6 -f /etc/ipf6.conf fi ;; esac } ipfilter_stop() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) echo "Saving firewall state tables" ${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags} ;; NetBSD) ;; esac # XXX - The following command is not effective for 'lkm's echo "Disabling ipfilter." /sbin/ipf -D } ipfilter_reload() { echo "Reloading ipfilter rules." - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) ${ipfilter_program:-/sbin/ipf} -I -Fa -f \ "${ipfilter_rules}" ${ipfilter_flags} ;; NetBSD) /sbin/ipf -I -Fa if [ -f /etc/ipf.conf ] && ! /sbin/ipf -I -f /etc/ipf.conf; then err 1 "reload of ipf.conf failed; not swapping to" \ " new ruleset." fi if [ -f /etc/ipf6.conf ] && \ ! /sbin/ipf -I -6 -f /etc/ipf6.conf; then err 1 "reload of ipf6.conf failed; not swapping to" \ " new ruleset." fi /sbin/ipf -s ;; esac } ipfilter_resync() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # Don't resync if ipfilter is not loaded [ sysctl net.inet.ipf.fr_pass > /dev/null 2>&1 ] && return ;; esac ${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags} } ipfilter_status() { ${ipfilter_program:-/sbin/ipf} -V } run_rc_command "$1" Index: head/etc/rc.d/ipmon =================================================================== --- head/etc/rc.d/ipmon (revision 103018) +++ head/etc/rc.d/ipmon (revision 103019) @@ -1,37 +1,37 @@ #!/bin/sh # # $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $ # $FreeBSD$ # # PROVIDE: ipmon # REQUIRE: syslogd # BEFORE: SERVERS # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ipmon" rcvar=`set_rcvar` -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) command="/sbin/ipmon" start_precmd="ipmon_precmd" ;; NetBSD) command="/usr/sbin/${name}" command_args="-D" esac ipmon_precmd() { # Make sure ipfilter is loaded before continuing if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1 ; then return 1 fi return 0 } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ipnat =================================================================== --- head/etc/rc.d/ipnat (revision 103018) +++ head/etc/rc.d/ipnat (revision 103019) @@ -1,85 +1,85 @@ #!/bin/sh # # $NetBSD: ipnat,v 1.6 2000/09/19 13:04:38 lukem Exp $ # $FreeBSD$ # # PROVIDE: ipnat # REQUIRE: ipfilter mountcritremote # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ipnat" rcvar=`set_rcvar` -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) IPNATDIR="/sbin" start_precmd="ipnat_precmd" reload_cmd="ipnat_start" ;; NetBSD) IPNATDIR="/usr/sbin" config="/etc/ipnat.conf" reload_cmd="/usr/sbin/ipnat -F -C -f ${config}" start_precmd= ;; esac start_cmd="ipnat_start" stop_cmd="${ipnat_program:-${IPNATDIR}/${name}} -F -C" extra_commands="reload" ipnat_precmd() { # Make sure ipfilter is loaded before continuing if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1 ; then err 'ipnat requires ipfilter be loaded' return 1 fi return 0 } ipnat_start() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) echo -n 'Installing NAT rules ... ' if [ -r "${ipnat_rules}" ]; then ${ipnat_program:-/sbin/ipnat} -CF -f \ "${ipnat_rules}" ${ipnat_flags} else echo -n ' NO IPNAT RULES' fi echo '.' # restore filter/NAT state tables after loading the rules if checkyesno ipfs_enable ; then if [ -r "/var/db/ipf/ipstate.ipf" ]; then echo -n ' ipfs' ${ipfs_program:-/sbin/ipfs} -R ${ipfs_flags} # remove files to avoid reloading old state # after an ungraceful shutdown rm -f /var/db/ipf/ipstate.ipf rm -f /var/db/ipf/ipnat.ipf fi fi ;; NetBSD) if [ ! -f ${config} ]; then return 0 fi if ! checkyesno ipfilter || [ ! -f /etc/ipf.conf ]; then echo "Enabling ipfilter for NAT." /sbin/ipf -E -Fa fi echo -n "Installing NAT rules ... " /usr/sbin/ipnat -F -f ${config} ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ipsec =================================================================== --- head/etc/rc.d/ipsec (revision 103018) +++ head/etc/rc.d/ipsec (revision 103019) @@ -1,81 +1,81 @@ #!/bin/sh # # $NetBSD: ipsec,v 1.7 2002/03/22 04:33:58 thorpej Exp $ # $FreeBSD$ # # PROVIDE: ipsec # REQUIRE: root beforenetlkm mountcritlocal tty # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD # it does not really require beforenetlkm. . /etc/rc.subr name="ipsec" rcvar=`set_rcvar` # This will be overiden from rc.conf on FreeBSD. ipsec_file="/etc/ipsec.conf" start_precmd="ipsec_prestart" start_cmd="ipsec_start" stop_precmd="test -f /etc/ipsec.conf" stop_cmd="ipsec_stop" reload_cmd="ipsec_reload" extra_commands="reload" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) ipsec_program="/usr/sbin/setkey" ;; NetBSD) ipsec_program="/sbin/setkey" ;; esac ipsec_prestart() { if [ ! -f "$ipsec_file" ]; then warn "$ipsec_file not readable; ipsec start aborted." # # If booting directly to multiuser, send SIGTERM to # the parent (/etc/rc) to abort the boot # if [ "$autoboot" = yes ]; then echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!" kill -TERM $$ exit 1 fi return 1 fi return 0 } ipsec_start() { echo "Installing ipsec manual keys/policies." ${ipsec_program} -f $ipsec_file } ipsec_stop() { echo "Clearing ipsec manual keys/policies." # still not 100% sure if we would like to do this. # it is very questionable to do this during shutdown session, since # it can hang any of remaining IPv4/v6 session. # ${ipsec_program} -F ${ipsec_program} -FP } ipsec_reload() { echo "Reloading ipsec manual keys/policies." ${ipsec_program} -F ${ipsec_program} -FP ${ipsec_program} -f "$ipsec_file" } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/isdnd =================================================================== --- head/etc/rc.d/isdnd (revision 103018) +++ head/etc/rc.d/isdnd (revision 103019) @@ -1,76 +1,76 @@ #!/bin/sh # # $NetBSD: isdnd,v 1.9 2002/04/10 23:37:13 martin Exp $ # $FreeBSD$ # # Mostly based on original script (/etc/rc.isdn) written by Hellmuth Michaelis # # PROVIDE: isdnd # REQUIRE: NETWORKING syslogd mountcritremote # BEFORE: SERVERS # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="isdnd" rcvar=`set_rcvar isdn` pidfile="/var/run/${name}.pid" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_cmd="isdnd_start" ;; NetBSD) command="/usr/sbin/${name}" required_files="/etc/isdn/${name}.rc" ;; esac isdnd_start() { echo -n 'ISDN subsystem setup:' # Check for pcvt driver (VT100/VT220 emulator) # if [ -x /usr/sbin/ispcvt ]; then if /usr/sbin/ispcvt; then # No vidcontrol if we are using pcvt # isdn_screenflags=NO fi fi # Start isdnd # echo -n ' isdnd' case ${isdn_fsdev} in [Nn][Oo] | '') /usr/sbin/isdnd ${isdn_flags} ;; *) # Change vidmode of ${isdn_fsdev} # case ${isdn_screenflags} in [Nn][Oo]) ;; *) /usr/sbin/vidcontrol < ${isdn_fsdev} > ${isdn_fsdev} 2>&1 ${isdn_screenflags} ;; esac /usr/sbin/isdnd ${isdn_flags} -f -r ${isdn_fsdev} -t ${isdn_ttype} ;; esac # Start isdntrace # if checkyesno isdn_trace ; then echo -n ' isdntrace' nohup /usr/sbin/isdntrace ${isdn_traceflags} >/dev/null 2>&1 & echo '.' fi } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ldconfig =================================================================== --- head/etc/rc.d/ldconfig (revision 103018) +++ head/etc/rc.d/ldconfig (revision 103019) @@ -1,68 +1,68 @@ #!/bin/sh # # $NetBSD: ldconfig,v 1.5 2002/03/22 04:33:58 thorpej Exp $ # $FreeBSD$ # # PROVIDE: ldconfig # REQUIRE: mountall # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ldconfig" ldconfig_command="/sbin/ldconfig" start_cmd="ldconfig_start" stop_cmd=":" ldconfig_start() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) ldconfig=${ldconfig_command} checkyesno ldconfig_insecure && ldconfig="${ldconfig} -i" if [ -x "${ldconfig_command}" ]; then case `/usr/bin/objformat` in elf) _LDC=/usr/lib for i in ${ldconfig_paths}; do if [ -d "${i}" ]; then _LDC="${_LDC} ${i}" fi done echo 'ELF ldconfig path:' ${_LDC} ${ldconfig} -elf ${_LDC} ;; esac # Legacy aout support for i386 only case `sysctl -n hw.machine_arch` in i386) # Default the a.out ldconfig path. : ${ldconfig_paths_aout=${ldconfig_paths}} _LDC=/usr/lib/aout for i in ${ldconfig_paths_aout}; do if [ -d "${i}" ]; then _LDC="${_LDC} ${i}" fi done echo 'a.out ldconfig path:' ${_LDC} ${ldconfig} -aout ${_LDC} ;; esac fi ;; NetBSD) if [ -f ${ldconfig_command} ]; then echo "Creating a.out runtime link editor directory cache." ${ldconfig_command} fi ;; *) ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/lockd =================================================================== --- head/etc/rc.d/lockd (revision 103018) +++ head/etc/rc.d/lockd (revision 103019) @@ -1,46 +1,46 @@ #!/bin/sh # # $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $ # $FreeBSD$ # # PROVIDE: nfslocking # REQUIRE: nfsserver nfsclient nfsd # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr arg=$1 -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) RCVAR_SERVER="nfs_server_enable" RCVAR_CLIENT="nfs_client_enable" RCVAR_STATD="rpc_statd_enable" RCVAR_LOCKD="rpc_lockd_enable" ;; NetBSD) RCVAR_SERVER="nfs_server" RCVAR_CLIENT="nfs_client" RCVAR_STATD="statd" RCVAR_LOCKD="lockd" ;; esac start_precmd="checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT} [ -n "$rc_force" ]" stop_precmd=$start_precmd status_precmd=$start_precmd name="statd" rcvar=${RCVAR_STATD} command="/usr/sbin/rpc.${name}" load_rc_config $name run_rc_command "$arg" name="lockd" rcvar=${RCVAR_LOCKD} command="/usr/sbin/rpc.${name}" load_rc_config $name run_rc_command "$arg" Index: head/etc/rc.d/lpd =================================================================== --- head/etc/rc.d/lpd (revision 103018) +++ head/etc/rc.d/lpd (revision 103019) @@ -1,28 +1,28 @@ #!/bin/sh # # $NetBSD: lpd,v 1.5 2002/03/22 04:33:59 thorpej Exp $ # $FreeBSD$ # # PROVIDE: lpd # REQUIRE: DAEMON # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="lpd" rcvar=`set_rcvar` command="/usr/sbin/${name}" required_files="/etc/printcap" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in NetBSD) pidfile="/var/run/${name}.pid" ;; *) ;; esac load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/motd =================================================================== --- head/etc/rc.d/motd (revision 103018) +++ head/etc/rc.d/motd (revision 103019) @@ -1,59 +1,59 @@ #!/bin/sh # # $NetBSD: motd,v 1.5 2000/09/19 13:04:38 lukem Exp $ # $FreeBSD$ # # PROVIDE: motd # REQUIRE: mountcritremote # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="motd" rcvar="update_motd" start_cmd="motd_start" stop_cmd=":" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) T=`mktemp /tmp/_motd.XXXXXX` PERMS="644" ;; NetBSD) T="/etc/_motd" PERMS="664" ;; esac motd_start() { # Update kernel info in /etc/motd # Must be done *before* interactive logins are possible # to prevent possible race conditions. # echo "Updating motd." if [ ! -f /etc/motd ]; then install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd fi - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) 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} ;; NetBSD) sysctl -n kern.version | while read i; do echo $i; break; done > $T sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T ;; esac cmp -s $T /etc/motd || { cp $T /etc/motd chmod ${PERMS} /etc/motd } rm -f $T } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/mountcritlocal =================================================================== --- head/etc/rc.d/mountcritlocal (revision 103018) +++ head/etc/rc.d/mountcritlocal (revision 103019) @@ -1,68 +1,68 @@ #!/bin/sh # # $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $ # $FreeBSD$ # # PROVIDE: mountcritlocal # REQUIRE: root # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="mountcritlocal" start_cmd="mountcritlocal_start" stop_cmd=":" mountcritlocal_start() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # Set up the list of network filesystem types for which mounting # should be delayed until after network initialization. networkfs_types='nfs:NFS smbfs:SMB portalfs:PORTAL' case ${extra_netfs_types} in [Nn][Oo]) ;; *) networkfs_types="${networkfs_types} ${extra_netfs_types}" ;; esac # Mount everything except nfs filesystems. mount_excludes='no' for i in ${networkfs_types}; do fstype=${i%:*} mount_excludes="${mount_excludes}${fstype}," done mount_excludes=${mount_excludes%,} mount -a -t ${mount_excludes} case $? in 0) ;; *) echo 'Mounting /etc/fstab filesystems failed,' \ ' startup aborted' exit 1 ;; esac ;; NetBSD) # Mount critical filesystems that are `local' # (as specified in $critical_filesystems_local) # This usually includes /var. # mount_critical_filesystems local # clean up left-over files. # this could include the cleanup of lock files and /var/run, etc. # rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/* (cd /var/run && rm -rf -- *) ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/mountcritremote =================================================================== --- head/etc/rc.d/mountcritremote (revision 103018) +++ head/etc/rc.d/mountcritremote (revision 103019) @@ -1,89 +1,89 @@ #!/bin/sh # # $NetBSD: mountcritremote,v 1.7 2002/04/29 12:29:53 lukem Exp $ # $FreeBSD$ # # PROVIDE: mountcritremote # REQUIRE: NETWORKING root mountcritlocal # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="mountcritremote" stop_cmd=":" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_cmd="mountcritremote_start" start_precmd="mountcritremote_precmd" ;; NetBSD) start_cmd="mountcritremote_start" ;; esac # Mount NFS filesystems if present in /etc/fstab # # XXX When the vfsload() issues with nfsclient support and related sysctls # have been resolved, this block can be removed, and the condition that # skips nfs in the following block (for "other network filesystems") can # be removed. # mountcritremote_precmd() { case "`mount -d -a -t nfs 2> /dev/null`" in *mount_nfs*) # Handle absent nfs client support if ! sysctl vfs.nfs >/dev/null 2>&1 ; then kldload nfsclient || warn 'nfs mount ' \ 'requested, but no nfs client in kernel' \ return 1 fi ;; esac return 0 } mountcritremote_start() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # Mount nfs filesystems. # echo -n 'Mounting NFS file systems:' mount -a -t nfs echo '.' # Mount other network filesystems if present in /etc/fstab for i in ${networkfs_types}; do fstype=${i%:*} fsdecr=${i#*:} [ "${fstype}" = "nfs" ] && continue case "`mount -d -a -t ${fstype}`" in *mount_${fstype}*) echo -n "Mounting ${fsdecr} file systems:" mount -a -t ${fstype} echo '.' ;; esac done # Cleanup /var again just in case it's a network mount /etc/rc.d/cleanvar start rm -f /var/run/clean_var /var/spool/lock/clean_var ;; NetBSD) # Mount critical filesystems that may be `remote'. # (as specified in $critical_filesystems_remote) # This usually includes /usr. # mount_critical_filesystems remote ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/mountd =================================================================== --- head/etc/rc.d/mountd (revision 103018) +++ head/etc/rc.d/mountd (revision 103019) @@ -1,51 +1,51 @@ #!/bin/sh # # $NetBSD: mountd,v 1.11 2002/01/31 01:26:06 lukem Exp $ # $FreeBSD$ # # PROVIDE: mountd # REQUIRE: NETWORKING mountall beforemountlkm nfsserver rpcbind quota # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="mountd" rcvar=`set_rcvar` command="/usr/sbin/${name}" required_files="/etc/exports" start_precmd="mountd_precmd" extra_commands="reload" mountd_precmd() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) if ! checkyesno rpcbind_enable && \ ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 fi # mountd flags will differ depending on rc.conf settings # case ${nfs_server_enable} in [Yy][Ee][Ss]) if checkyesno weak_mountd_authentication ; then mountd_flags="${mountd_flags} -n" fi ;; *) if checkyesno mountd_enable ; then checkyesno weak_mountd_authentication && mountd_flags="-n" fi esac ;; esac rm -f /var/db/mountdtab ( umask 022 ; > /var/db/mountdtab ) return 0 } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/moused =================================================================== --- head/etc/rc.d/moused (revision 103018) +++ head/etc/rc.d/moused (revision 103019) @@ -1,47 +1,47 @@ #!/bin/sh # # $NetBSD: moused,v 1.1 2001/10/29 23:25:01 augustss Exp $ # $FreeBSD$ # # PROVIDE: moused # REQUIRE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name=moused rcvar=`set_rcvar` -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_cmd="moused_start" ;; NetBSD) command="/usr/sbin/${name}" ;; esac moused_start() { echo -n 'Starting moused:' /usr/sbin/moused ${moused_flags} -p ${moused_port} -t ${moused_type} _mousechar_arg= case ${mousechar_start} in [Nn][Oo] | '') ;; *) echo -n ' mousechar_start' _mousechar_arg="-M ${mousechar_start}" ;; esac for ttyv in /dev/ttyv* ; do vidcontrol < ${ttyv} ${_mousechar_arg} -m on done echo '.' } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/named =================================================================== --- head/etc/rc.d/named (revision 103018) +++ head/etc/rc.d/named (revision 103019) @@ -1,124 +1,124 @@ #!/bin/sh # # $NetBSD: named,v 1.10 2002/03/22 04:33:59 thorpej Exp $ # $FreeBSD$ # # PROVIDE: named # REQUIRE: SERVERS # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="named" rcvar=`set_rcvar` command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="named_precmd" required_dirs="$named_chrootdir" # if it is set, it must exist extra_commands="reload" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) nuser=bind ngroup=bind ;; NetBSD) nuser=named ngroup=named ;; esac # If running in a chroot cage, ensure that the appropriate files # exist inside the cage, as well as helper symlinks into the cage # from outside. # # As this is called after the is_running and required_dir checks # are made in run_rc_command(), we can safely assume ${named_chrootdir} # exists and named isn't running at this point (unless forcestart # is used). # chroot_autoupdate() { # If the named-xfer in the system is newer than the one in the # chroot directory or if it (in the chrootdir) doesn't exist # copy it over # if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \ "${named_chrootdir}/usr/libexec/named-xfer" -ot \ /usr/libexec/named-xfer ]; then rm -f "${named_chrootdir}/usr/libexec/named-xfer" cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec" fi # Copy /dev/null over, if neccessary. Preserve everything (perms, # ownership, mod times). # if [ ! -c "${named_chrootdir}/dev/null" ]; then rm -f "${named_chrootdir}/dev/null" ( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" ) fi # Copy local timezone information if it's not up-to-date. # if [ -f /etc/localtime ]; then cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \ cp -p /etc/localtime "${named_chrootdir}/etc/localtime" fi } # Make symlinks to the correct pid and ndc socket files # make_symlinks() { ln -fs "${named_chrootdir}/var/run/named.pid" /var/run/named.pid ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc } named_precmd() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) ! checkyesno named_rcng && return 0 # Is the user using a sandbox? if [ -z "$named_chrootdir" ]; then rc_flags="-u $nuser -g $ngroup $rc_flags" return 0 fi # Do the following checks only if the user wants them done checkyesno named_chroot_autoupdate && chroot_autoupdate ;; NetBSD) chroot_autoupdate ;; esac - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # Make the symlinks only if the user wants them done. checkyesno named_symlink_enable && make_symlinks ;; NetBSD) make_symlinks ;; esac # Change run_rc_commands()'s internal copy of $named_flags # - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) ! checkyesno named_rcng && return ;; esac rc_flags="-u $nuser -g $ngroup -t ${named_chrootdir} $rc_flags" } load_rc_config $name # The following variable requires that rc.conf be loaded first # required_dirs="$named_chrootdir" # if it is set, it must exist run_rc_command "$1" Index: head/etc/rc.d/nfsd =================================================================== --- head/etc/rc.d/nfsd (revision 103018) +++ head/etc/rc.d/nfsd (revision 103019) @@ -1,55 +1,55 @@ #!/bin/sh # # $NetBSD: nfsd,v 1.4 2001/06/16 06:13:10 lukem Exp $ # $FreeBSD$ # # PROVIDE: nfsd # REQUIRE: mountd # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="nfsd" rcvar=`set_rcvar nfs_server` command="/usr/sbin/${name}" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) command_args="${nfs_server_flags}" start_precmd="nfsd_precmd" sig_stop="USR1" ;; NetBSD) required_vars="mountd rpcbind" start_precmd= ;; esac nfsd_precmd() { if ! sysctl vfs.nfsrv >/dev/null 2>&1; then force_depend nfsserver || return 1 fi if ! checkyesno rpcbind_enable && \ ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 fi if ! checkyesno mountd_enable && \ ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1 then force_depend mountd || return 1 fi if checkyesno nfs_reserved_port_only ; then echo 'NFS on reserved port only=YES' sysctl vfs.nfsrv.nfs_privport=1 > /dev/null fi return 0 } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/nfslocking =================================================================== --- head/etc/rc.d/nfslocking (revision 103018) +++ head/etc/rc.d/nfslocking (revision 103019) @@ -1,46 +1,46 @@ #!/bin/sh # # $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $ # $FreeBSD$ # # PROVIDE: nfslocking # REQUIRE: nfsserver nfsclient nfsd # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr arg=$1 -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) RCVAR_SERVER="nfs_server_enable" RCVAR_CLIENT="nfs_client_enable" RCVAR_STATD="rpc_statd_enable" RCVAR_LOCKD="rpc_lockd_enable" ;; NetBSD) RCVAR_SERVER="nfs_server" RCVAR_CLIENT="nfs_client" RCVAR_STATD="statd" RCVAR_LOCKD="lockd" ;; esac start_precmd="checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT} [ -n "$rc_force" ]" stop_precmd=$start_precmd status_precmd=$start_precmd name="statd" rcvar=${RCVAR_STATD} command="/usr/sbin/rpc.${name}" load_rc_config $name run_rc_command "$arg" name="lockd" rcvar=${RCVAR_LOCKD} command="/usr/sbin/rpc.${name}" load_rc_config $name run_rc_command "$arg" Index: head/etc/rc.d/ntpd =================================================================== --- head/etc/rc.d/ntpd (revision 103018) +++ head/etc/rc.d/ntpd (revision 103019) @@ -1,53 +1,53 @@ #!/bin/sh # # $NetBSD: ntpd,v 1.6 2002/03/22 04:33:59 thorpej Exp $ # $FreeBSD$ # # PROVIDE: ntpd # REQUIRE: DAEMON # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name=ntpd rcvar=`set_rcvar` command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" required_files="/etc/ntp.conf" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in NetBSD) start_precmd="ntpd_precmd" ;; esac ntpd_precmd() { if [ -z "$ntpd_chrootdir" ]; then return 0; fi # If running in a chroot cage, ensure that the appropriate files # exist inside the cage, as well as helper symlinks into the cage # from outside. # # As this is called after the is_running and required_dir checks # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir} # exists and ntpd isn't running at this point (unless forcestart # is used). # if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then rm -f "${ntpd_chrootdir}/dev/clockctl" ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" ) fi ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift # Change run_rc_commands()'s internal copy of $ntpd_flags # rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags" } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ntpdate =================================================================== --- head/etc/rc.d/ntpdate (revision 103018) +++ head/etc/rc.d/ntpdate (revision 103019) @@ -1,43 +1,43 @@ #!/bin/sh # # $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $ # $FreeBSD$ # # PROVIDE: ntpdate # REQUIRE: NETWORKING syslogd # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ntpdate" rcvar=`set_rcvar` -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) command="/usr/sbin/${name}" command_args=">/dev/null 2>&1" pidfile="/var/run/${name}.pid" ;; NetBSD) start_cmd="ntpdate_start" stop_cmd=":" ;; esac ntpdate_start() { if [ -z "$ntpdate_hosts" ]; then ntpdate_hosts=`awk ' /^server[ \t]*127.127/ {next} /^(server|peer)/ {print $2} ' /dev/null 2>&1 mount / # If we booted a special kernel remove the record # so we will boot the default kernel next time. [ -e /boot/nextkernel ] && rm -f /boot/nextkernel ;; NetBSD) umount -a >/dev/null 2>&1 mount / rm -f /fastboot ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/route6d =================================================================== --- head/etc/rc.d/route6d (revision 103018) +++ head/etc/rc.d/route6d (revision 103019) @@ -1,35 +1,35 @@ #!/bin/sh # # $NetBSD: route6d,v 1.5 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD$ # # PROVIDE: route6d # REQUIRE: DAEMON # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="route6d" # XXX - Executable may be in a different location. The $name variable # is different from the variable in rc.conf(5) so the # subroutines in rc.subr won't catch it. In this case, it # is also needed by the eval statement in the FreeBSD conditional. # load_rc_config $name -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) rcvar="ipv6_router_enable" command="${ipv6_router:-/usr/sbin/${name}}" eval ${name}_flags=\"${ipv6_router_flags}\" ;; NetBSD) rcvar=$name command="/usr/sbin/${name}" ;; esac run_rc_command "$1" Index: head/etc/rc.d/routed =================================================================== --- head/etc/rc.d/routed (revision 103018) +++ head/etc/rc.d/routed (revision 103019) @@ -1,44 +1,44 @@ #!/bin/sh # # $NetBSD: routed,v 1.7 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD$ # # PROVIDE: routed # REQUIRE: DAEMON # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="routed" # XXX - Executable may be in a different location. The $name variable # is different from the variable in rc.conf(5) so the # subroutines in rc.subr won't catch it. # load_rc_config $name -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) rcvar="router_enable" command="${router:-/sbin/${name}}" eval ${name}_flags=${router_flags} start_precmd= ;; NetBSD) rcvar=${name} command="/sbin/${name}" start_precmd="routed_precmd" ;; esac routed_precmd() { if checkyesno gated && checkyesno routed; then warn "gated and routed both requested to be run: only running gated." return 1 fi } run_rc_command "$1" Index: head/etc/rc.d/rpcbind =================================================================== --- head/etc/rc.d/rpcbind (revision 103018) +++ head/etc/rc.d/rpcbind (revision 103019) @@ -1,24 +1,24 @@ #!/bin/sh # # $NetBSD: rpcbind,v 1.6 2002/01/31 01:26:06 lukem Exp $ # $FreeBSD$ # # PROVIDE: rpcbind # REQUIRE: NETWORKING ntpdate syslogd named ppp # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="rpcbind" rcvar=`set_rcvar` command="/usr/sbin/${name}" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in NetBSD) pidfile="/var/run/${name}.pid" ;; esac load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/rtadvd =================================================================== --- head/etc/rc.d/rtadvd (revision 103018) +++ head/etc/rc.d/rtadvd (revision 103019) @@ -1,82 +1,82 @@ #!/bin/sh # # $NetBSD: rtadvd,v 1.5 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD$ # # PROVIDE: rtadvd # REQUIRE: DAEMON # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="rtadvd" rcvar=`set_rcvar` command="/usr/sbin/${name}" start_precmd="rtadvd_precmd" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) IS_GATEWAY="checkyesno ipv6_gateway_enable" ;; NetBSD) IS_GATEWAY="eval [ \"$ip6mode\" = \"router\" ]" ;; esac rtadvd_precmd() { if ! ${IS_GATEWAY} ; then warn \ "${name} cannot be used on IPv6 host, only on an IPv6 router." return 1 fi # This should be enabled with a great care. # You may want to fine-tune /etc/rtadvd.conf. # # And if you wish your rtadvd to receive and process # router renumbering messages, specify your Router Renumbering # security policy by -R option. # # See `man 3 ipsec_set_policy` for IPsec policy specification # details. # (CAUTION: This enables your routers prefix renumbering # from another machine, so if you enable this, do it with # enough care.) # - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # If specific interfaces haven't been specified, # get a list of interfaces and enable it on them # case ${rtadvd_interfaces} in '') for i in `ifconfig -l` ; do case $i in lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*) continue ;; *) rtadvd_interfaces="${rtadvd_interfaces} ${i}" ;; esac done ;; esac command_args="${rtadvd_interfaces}" # Enable Router Renumbering, unicast case # (use correct src/dst addr) # rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" ${ipv6_network_interfaces} # Enable Router Renumbering, multicast case # (use correct src addr) # rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" ${ipv6_network_interfaces} ;; esac return 0 } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/savecore =================================================================== --- head/etc/rc.d/savecore (revision 103018) +++ head/etc/rc.d/savecore (revision 103019) @@ -1,74 +1,74 @@ #!/bin/sh # # $NetBSD: savecore,v 1.5 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD$ # # PROVIDE: savecore # REQUIRE: syslogd # BEFORE: SERVERS # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="savecore" start_cmd="savecore_start" start_precmd="savecore_prestart" stop_cmd=":" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in NetBSD) rcvar=$name ;; esac savecore_prestart() { # ${DUMPDIR} should be a directory or a symbolic link # to the crash directory if core dumps are to be saved. # DUMPDIR="${dumpdir:-/var/crash}" - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # Quit if we have no dump device case ${dumpdev} in [Nn][Oo] | '') debug 'No dump device. Quitting.' return 1 ;; esac # If there is no crash directory set it now case ${dumpdir} in '') dumpdir='/var/crash' ;; [Nn][Oo]) dumpdir='NO' ;; esac if [ ! -e "${dumpdev}" -o ! -d "${dumpdir}" ]; then warn "Wrong dump device or directory. Savecore not run." return 1 fi ;; NetBSD) if [ ! -d "${dumpdir}" ]; then warn "No /var/crash directory; savecore not run." return 1 fi ;; esac return 0 } savecore_start() { echo "Checking for core dump..." savecore ${savecore_flags} ${DUMPDIR} } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/securelevel =================================================================== --- head/etc/rc.d/securelevel (revision 103018) +++ head/etc/rc.d/securelevel (revision 103019) @@ -1,56 +1,56 @@ #!/bin/sh # # $NetBSD: securelevel,v 1.4 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD$ # # PROVIDE: securelevel # REQUIRE: aftermountlkm ipnat mountd # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="securelevel" start_cmd="securelevel_start" stop_cmd=":" securelevel_start() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) case ${kern_securelevel_enable} in [Yy][Ee][Ss]) if [ ${kern_securelevel} -ge 0 ]; then echo 'Raising kernel security level: ' ${SYSCTL_W} kern.securelevel=${kern_securelevel} fi ;; esac ;; NetBSD) # if $securelevel is set higher, change it here, else if # it is 0, change it to 1 here, before we start daemons # or login services. # osecurelevel=`sysctl -n kern.securelevel` if [ -n "$securelevel" -a "$securelevel" != "$osecurelevel" ]; then if [ "$securelevel" -lt "$osecurelevel" ]; then echo "Can't lower securelevel." exit 1 else echo -n "Setting securelevel: " ${SYSCTL_W} kern.securelevel=$securelevel fi else if [ "$osecurelevel" = 0 ]; then echo -n "Setting securelevel: " ${SYSCTL_W} kern.securelevel=1 fi fi ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/sendmail =================================================================== --- head/etc/rc.d/sendmail (revision 103018) +++ head/etc/rc.d/sendmail (revision 103019) @@ -1,115 +1,115 @@ #!/bin/sh # # $NetBSD: sendmail,v 1.14 2002/02/12 01:26:36 lukem Exp $ # $FreeBSD$ # # PROVIDE: mail # REQUIRE: LOGIN # KEYWORD: FreeBSD NetBSD # we make mail start late, so that things like .forward's are not # processed until the system is fully operational # XXX - Get together with sendmail mantainer to figure out how to # better handle SENDMAIL_ENABLE and 3rd party MTAs. # . /etc/rc.subr name="sendmail" rcvar=`set_rcvar` required_files="/etc/mail/${name}.cf" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) command=${sendmail_program:-/usr/sbin/sendmail} pidfile=${sendmail_pidfile:-/var/run/sendmail.pid} load_rc_config $name case ${sendmail_enable} in [Nn][Oo][Nn][Ee]) sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" ;; esac ;; NetBSD) command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="sendmail_precmd" load_rc_config $name ;; esac sendmail_precmd() { # Die if there's pre-8.10 custom configuration file. This check is # mandatory for smooth upgrade. See NetBSD PR 10100 for details. # if checkyesno ${rcvar} && [ -f "/etc/${name}.cf" ]; then if ! cmp -s "/etc/mail/${name}.cf" "/etc/${name}.cf"; then warn \ "${name} was not started; you have multiple copies of sendmail.cf." return 1 fi fi # check modifications on /etc/mail/aliases if [ -f "/etc/mail/aliases.db" ]; then if [ "/etc/mail/aliases" -nt "/etc/mail/aliases.db" ]; then echo \ "${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating" /usr/bin/newaliases fi else echo \ "${name}: /etc/mail/aliases.db not present, generating" /usr/bin/newaliases fi # check couple of common db files, too for f in genericstable virtusertable domaintable mailertable; do if [ -r "/etc/mail/$f" -a \ "/etc/mail/$f" -nt "/etc/mail/$f.db" ]; then echo \ "${name}: /etc/mail/$f newer than /etc/mail/$f.db, regenerating" /usr/sbin/makemap hash /etc/mail/$f < /etc/mail/$f fi done } run_rc_command "$1" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) required_files= # I'd like to use checkyesno here, but for reason, sendmail_enable # get's reset after run_rc_command case ${sendmail_enable} in [Nn][Oo]*) name="sendmail_submit" rcvar=`set_rcvar` start_cmd="${command} ${sendmail_submit_flags}" run_rc_command "$1" ;; esac if ! checkyesno sendmail_outbound_enable; then name="sendmail_outbound" rcvar=`set_rcvar` start_cmd="${command} ${sendmail_outbound_flags}" run_rc_command "$1" fi name="sendmail_clientmqueue" rcvar="sendmail_msp_queue_enable" start_cmd="${command} ${sendmail_msp_queue_flags}" pidfile="${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}" required_files="/etc/mail/submit.cf" run_rc_command "$1" ;; esac Index: head/etc/rc.d/statd =================================================================== --- head/etc/rc.d/statd (revision 103018) +++ head/etc/rc.d/statd (revision 103019) @@ -1,46 +1,46 @@ #!/bin/sh # # $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $ # $FreeBSD$ # # PROVIDE: nfslocking # REQUIRE: nfsserver nfsclient nfsd # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr arg=$1 -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) RCVAR_SERVER="nfs_server_enable" RCVAR_CLIENT="nfs_client_enable" RCVAR_STATD="rpc_statd_enable" RCVAR_LOCKD="rpc_lockd_enable" ;; NetBSD) RCVAR_SERVER="nfs_server" RCVAR_CLIENT="nfs_client" RCVAR_STATD="statd" RCVAR_LOCKD="lockd" ;; esac start_precmd="checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT} [ -n "$rc_force" ]" stop_precmd=$start_precmd status_precmd=$start_precmd name="statd" rcvar=${RCVAR_STATD} command="/usr/sbin/rpc.${name}" load_rc_config $name run_rc_command "$arg" name="lockd" rcvar=${RCVAR_LOCKD} command="/usr/sbin/rpc.${name}" load_rc_config $name run_rc_command "$arg" Index: head/etc/rc.d/swap1 =================================================================== --- head/etc/rc.d/swap1 (revision 103018) +++ head/etc/rc.d/swap1 (revision 103019) @@ -1,50 +1,50 @@ #!/bin/sh # # $NetBSD: swap1,v 1.8 2002/03/24 15:52:41 lukem Exp $ # $FreeBSD$ # # PROVIDE: localswap # REQUIRE: disks # KEYWORD: FreeBSD NetBSD shutdown . /etc/rc.subr name="swap1" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_cmd='swapon -a' stop_cmd=':' ;; NetBSD) # Add all block-type swap devices; these might be necessary # during disk checks. # start_cmd="swap1_start" stop_cmd="swap1_stop" ;; esac # Add all block-type swap devices; these might be necessary # during disk checks. # swap1_start() { if ! checkyesno no_swap; then swapctl -A -t blk fi } # Remove all block-type swap devices # swap1_stop() { if checkyesno swapoff || [ -n "$rc_force" ]; then echo "Removing block-type swap devices" swapctl -U -t blk fi } load_rc_config swap run_rc_command "$1" Index: head/etc/rc.d/sysctl =================================================================== --- head/etc/rc.d/sysctl (revision 103018) +++ head/etc/rc.d/sysctl (revision 103019) @@ -1,70 +1,70 @@ #!/bin/sh # # $NetBSD: sysctl,v 1.12 2002/04/29 12:10:23 lukem Exp $ # $FreeBSD$ # # PROVIDE: sysctl # REQUIRE: root ipfilter ipsec # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="sysctl" stop_cmd=":" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_cmd="FreeBSD_start" extra_commands="reload lastload" reload_cmd="FreeBSD_start" lastload_cmd="FreeBSD_start last" ;; NetBSD) start_cmd="NetBSD_start" ;; esac FreeBSD_start() { # # Read in /etc/sysctl.conf and set things accordingly # if [ -f /etc/sysctl.conf ]; then while read var comments do case ${var} in \#*|'') ;; *) mib=${var%=*} val=${var#*=} if current_value=`${SYSCTL} -n ${mib} 2>/dev/null`; then case ${current_value} in ${val}) ;; *) sysctl ${var} ;; esac elif [ "$1" -eq "last" ]; then warn "sysctl ${mib} does not exits." fi ;; esac done < /etc/sysctl.conf fi } NetBSD_start() { if [ -r /etc/sysctl.conf ]; then echo "Setting sysctl variables:" ${SYSCTL} -f /etc/sysctl.conf fi } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/syslogd =================================================================== --- head/etc/rc.d/syslogd (revision 103018) +++ head/etc/rc.d/syslogd (revision 103019) @@ -1,80 +1,80 @@ #!/bin/sh # # $NetBSD: syslogd,v 1.12 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD$ # # PROVIDE: syslogd # REQUIRE: mountcritremote sysdb wscons # BEFORE: SERVERS # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="syslogd" rcvar=`set_rcvar` command="/usr/sbin/${name}" required_files="/etc/syslog.conf" start_precmd="syslogd_precmd" extra_commands="reload" _sockfile="/var/run/syslogd.sockets" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) pidfile="/var/run/syslog.pid" evalargs="rc_flags=\"\`set_socketlist\` \$rc_flags\"" altlog_proglist="named" ;; NetBSD) pidfile="/var/run/${name}.pid" evalargs="rc_flags=\"-P \$_sockfile \$rc_flags\"" altlog_proglist="named ntpd" ;; esac syslogd_precmd() { # Transitional symlink for old binaries # if [ ! -h /dev/log ]; then ln -sf /var/run/log /dev/log fi rm -f /var/run/log # Create default list of syslog sockets to watch # ( umask 022 ; > $_sockfile ) # If running named(8) or ntpd(8) chrooted, added appropriate # syslog socket to list of sockets to watch. # for _l in $altlog_proglist; do eval _ldir=\$${_l}_chrootdir if checkyesno `set_rcvar $_l` && [ -n "$_ldir" ]; then echo "${_ldir}/var/run/log" >> $_sockfile fi done # If other sockets have been provided, change run_rc_command()'s # internal copy of $syslogd_flags to force use of specific # syslogd sockets. # if [ -s $_sockfile ]; then echo "/var/run/log" >> $_sockfile eval $evalargs fi return 0 } set_socketlist() { _socketargs= for _s in `cat $_sockfile | tr '\n' ' '` ; do _socketargs="-l $_s $_socketargs" done echo $_socketargs } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ttys =================================================================== --- head/etc/rc.d/ttys (revision 103018) +++ head/etc/rc.d/ttys (revision 103019) @@ -1,50 +1,50 @@ #!/bin/sh # # $NetBSD: ttys,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $ # $FreeBSD$ # # PROVIDE: tty # REQUIRE: root # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ttyflags" start_cmd="ttyflags_start" stop_cmd=":" ttyflags_start() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) # Whack the pty perms back into shape. # XXX: there may be more ptys than this; maybe use # sysctl to find out how many? # if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then chflags 0 /dev/tty[pqrsPQRS]* chmod 666 /dev/tty[pqrsPQRS]* chown root:wheel /dev/tty[pqrsPQRS]* fi ;; NetBSD) # set flags on ttys. # (do early, in case they use tty for SLIP in network) # echo "Setting tty flags." ttyflags -a # setup ptys # # XXX: there may be more ptys than this; maybe use # sysctl to find out how many? # chmod 666 /dev/tty[pqrs]* ;; esac } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/virecover =================================================================== --- head/etc/rc.d/virecover (revision 103018) +++ head/etc/rc.d/virecover (revision 103019) @@ -1,73 +1,73 @@ #!/bin/sh # # $NetBSD: virecover,v 1.6 2002/03/22 04:34:00 thorpej Exp $ # $FreeBSD$ # # PROVIDE: virecover # REQUIRE: mountcritremote # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD # # XXX: should require `mail'! . /etc/rc.subr name="virecover" stop_cmd=":" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) start_cmd="virecover_start" ;; NetBSD) command="/usr/libexec/${name}" ;; esac virecover_start() { find /var/tmp/vi.recover ! -type f -a ! -type d -delete vibackup=`echo /var/tmp/vi.recover/vi.*` if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then echo -n 'Recovering vi editor sessions:' for i in /var/tmp/vi.recover/vi.*; do # Only test files that are readable. if [ ! -r "${i}" ]; then continue fi # Unmodified nvi editor backup files either have the # execute bit set or are zero length. Delete them. if [ -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 /var/tmp/vi.recover/recover.*; do # Only test files that are readable. if [ ! -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 [ -n "${recfile}" -a -s "${recfile}" ]; then sendmail -t < "${i}" else rm -f "${i}" fi done fi echo '.' fi } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ypbind =================================================================== --- head/etc/rc.d/ypbind (revision 103018) +++ head/etc/rc.d/ypbind (revision 103019) @@ -1,38 +1,38 @@ #!/bin/sh # # $NetBSD: ypbind,v 1.5 2002/03/22 04:34:01 thorpej Exp $ # $FreeBSD$ # # PROVIDE: ypbind # REQUIRE: ypserv # BEFORE: DAEMON # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ypbind" command="/usr/sbin/${name}" start_precmd="ypbind_precmd" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) rcvar="nis_client_enable" command_args="${nis_client_flags}" ;; NetBSD) rcvar=$name ;; esac ypbind_precmd() { _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." return 1 fi } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/yppasswdd =================================================================== --- head/etc/rc.d/yppasswdd (revision 103018) +++ head/etc/rc.d/yppasswdd (revision 103019) @@ -1,54 +1,54 @@ #!/bin/sh # # $NetBSD: yppasswdd,v 1.6 2002/03/22 04:34:01 thorpej Exp $ # $FreeBSD$ # # PROVIDE: yppasswdd # REQUIRE: ypserv ypbind # BEFORE: LOGIN # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="yppasswdd" command="/usr/sbin/rpc.{name}" start_precmd="yppasswdd_precmd" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) rcvar="nis_yppasswdd_enable" command_args="${nis_yppasswdd_flags}" ;; NetBSD) rcvar=$name required_vars="rpcbind ypserv" ;; esac yppasswdd_precmd() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) if ! checkyesno rpcbind_enable && \ ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 fi if ! checkyesno nis_server_enable && \ ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1 then force_depend ypserv || return 1 fi ;; esac _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." return 1 fi } load_rc_config $name run_rc_command "$1" Index: head/etc/rc.d/ypserv =================================================================== --- head/etc/rc.d/ypserv (revision 103018) +++ head/etc/rc.d/ypserv (revision 103019) @@ -1,53 +1,53 @@ #!/bin/sh # # $NetBSD: ypserv,v 1.5 2000/09/19 13:04:39 lukem Exp $ # $FreeBSD$ # # PROVIDE: ypserv # REQUIRE: rpcbind # KEYWORD: FreeBSD NetBSD . /etc/rc.subr name="ypserv" command="/usr/sbin/${name}" start_precmd="ypserv_precmd" -case `${CMD_OSTYPE}` in +case ${OSTYPE} in FreeBSD) rcvar="nis_server_enable" command_args="${nis_server_flags}" ;; NetBSD) rcvar=${name} required_vars="rpcbind" ;; esac ypserv_precmd() { - case `${CMD_OSTYPE}` in + case ${OSTYPE} in FreeBSD) if ! checkyesno rpcbind_enable && \ ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1 then force_depend rpcbind || return 1 fi ;; esac _domain=`domainname` if [ -z "$_domain" ]; then warn "domainname(1) is not set." return 1 fi if [ ! -d /var/yp/$_domain/. ]; then warn "/var/yp/$_domain is not a directory." return 1 fi } load_rc_config $name run_rc_command "$1"