diff options
author | Roy Marples <roy@marples.name> | 2007-11-23 12:04:11 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-11-23 12:04:11 +0000 |
commit | d81def80b00a3dbcb4f8980f4503c4d659b48a2a (patch) | |
tree | 64a5df4281620cacbc1f03838d42e88167886fc9 /init.d.BSD | |
parent | f077f179edaeb746b267421baa29ec751c38b713 (diff) |
Move /etc/conf.d/rc to /etc/rc.conf.
Lowercase all configurable variables, non configurations remain uppercase.
Replace rc_env_bool with rc_yesno.
Split localmount info procfs (Linux) and dumpon, savecore (BSD)
Diffstat (limited to 'init.d.BSD')
-rwxr-xr-x | init.d.BSD/clock | 25 | ||||
-rwxr-xr-x | init.d.BSD/dumpon | 47 | ||||
-rw-r--r-- | init.d.BSD/ipfw | 16 | ||||
-rw-r--r-- | init.d.BSD/moused | 32 | ||||
-rw-r--r-- | init.d.BSD/powerd | 19 | ||||
-rw-r--r-- | init.d.BSD/rarpd | 11 | ||||
-rw-r--r-- | init.d.BSD/rc-enabled | 3 | ||||
-rw-r--r-- | init.d.BSD/rpcbind | 2 | ||||
-rwxr-xr-x | init.d.BSD/savecore | 56 | ||||
-rw-r--r-- | init.d.BSD/syscons | 42 | ||||
-rw-r--r-- | init.d.BSD/syslogd | 2 |
11 files changed, 183 insertions, 72 deletions
diff --git a/init.d.BSD/clock b/init.d.BSD/clock index 99e92733..3bb51b77 100755 --- a/init.d.BSD/clock +++ b/init.d.BSD/clock @@ -29,19 +29,24 @@ extra_commands="save" description="Sets the local clock to UTC or Local Time." description_save="Saves the current time in the BIOS." +clock=${clock:-${CLOCK:-UTC}} +if [ "${clock}" = "UTC" ]; then + utc="UTC" +else + utc="Local Time" +fi + depend() { # BSD adjkerntz needs to be able to write to /etc - if [ "${CLOCK}" = "UTC" -a -e /etc/wall_cmos_clock ] || - [ "${CLOCK}" != "UTC" -a ! -e /etc/wall_cmos_clock ] ; then + if [ "${clock}" = "UTC" -a -e /etc/wall_cmos_clock ] || + [ "${clock}" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then need checkroot fi } start() { - local TBLURB="Local Time" - [ "${CLOCK}" = "UTC" ] && TBLURB="UTC" - ebegin "Starting the System Clock Adjuster [${TBLURB}]" - if [ "${CLOCK}" != "UTC" ] ; then + ebegin "Starting the System Clock Adjuster [${utc}]" + if [ "${clock}" != "UTC" ]; then echo >/etc/wall_cmos_clock start-stop-daemon --start --exec /sbin/adjkerntz -- -i else @@ -52,16 +57,16 @@ start() { } save() { - local TBLURB="Local Time" - [ "${CLOCK}" = "UTC" ] && TBLURB="UTC" - ebegin "Setting hardware clock using the system clock" "[${TBLURB}]" + ebegin "Setting hardware clock using the system clock [${utc}]" adjkerntz -a eend $? } stop() { # Don't tweak the hardware clock on LiveCD halt. - [ -z "${CDBOOT}" -a "${CLOCK_SYSTOHC}" = "yes" ] && save + if yesno "${clock_systohc:-${CLOCK_SYSTOHC}}"; then + [ -z "${CDBOOT}" ] && save + fi ebegin "Stopping the System Clock Adjuster" if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz ; then diff --git a/init.d.BSD/dumpon b/init.d.BSD/dumpon new file mode 100755 index 00000000..1faf23b1 --- /dev/null +++ b/init.d.BSD/dumpon @@ -0,0 +1,47 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +description="Configures a specific kernel dump device." + +depend() { + need swap + before savecore +} + +start() { + # Setup any user requested dump device + if [ -n "${dump_device}" ] ; then + ebegin "Activating kernel core dump device (${dump_device})" + dumpon ${dump_device} + eend $? + fi +} + +stop() { + ebegin "Deactiving kernel core dump device" + dumpon off + eend $? +} diff --git a/init.d.BSD/ipfw b/init.d.BSD/ipfw index f5dfa775..cdddfaeb 100644 --- a/init.d.BSD/ipfw +++ b/init.d.BSD/ipfw @@ -25,9 +25,9 @@ # This is based on /etc/rc.firewall and /etc/rc.firewall6 from FreeBSD -IP_IN=${IP_IN-any} -PORTS_IN=${PORTS_IN-auth ssh} -PORTS_NOLOG=${PORTS_NOLOG-135-139,445 1026,1027 1433,1434} +ipfw_ip_in=${ipfw_ip_in-any} +ipfw_ports_in=${ipfw_ports_in-auth ssh} +ipfw_ports_nolog=${ipfw_ports_nolog-135-139,445 1026,1027 1433,1434} opts="panic showstatus" @@ -105,8 +105,8 @@ start() { # Add permits for this workstations published services below # Only IPs and nets in firewall_allowservices is allowed in. - for i in ${IP_IN}; do - for p in ${PORTS_IN}; do + for i in ${ipfw_ip_in}; do + for p in ${ipfw_ports_in}; do ipfw add pass tcp from ${i} to me ${p} done done @@ -114,14 +114,14 @@ start() { # Allow all connections from trusted IPs. # Playing with the content of firewall_trusted could seriously # degrade the level of protection provided by the firewall. - for i in ${IP_TRUST}; do + for i in ${ipfw_ip_trust}; do ipfw add pass ip from ${i} to me done ipfw add 65000 count ip from any to any # Drop packets to ports where we don't want logging - for p in ${PORTS_NOLOG}; do + for p in ${ipfw_ports_nolog}; do ipfw add deny { tcp or udp } from any to any ${p} in done @@ -138,7 +138,7 @@ start() { ipfw add deny tcp from any 80,443 to any 1024-65535 in # Deny and (if wanted) log the rest unconditionally. - if [ "${LOG_DENY}" = "yes" ]; then + if yesno ${ipfw_log_deny:-no}; then log="log" sysctl net.inet.ip.fw.verbose=1 >/dev/null fi diff --git a/init.d.BSD/moused b/init.d.BSD/moused index 2fb36261..70b0f0cf 100644 --- a/init.d.BSD/moused +++ b/init.d.BSD/moused @@ -23,14 +23,15 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -name=${SVCNAME##*.} -if [ -n "${name}" -a "${name}" != "moused" ] ; then - device=/dev/"${name}" - pidfile=/var/run/moused-"${name}".pid +mouse=${SVCNAME##*.} +if [ -n "${name}" -a "${mouse}" != "moused" ] ; then + moused_device=/dev/"${mouse}" + pidfile=/var/run/moused-"${mouse}".pid else - name= pidfile=/var/run/moused.pid fi +name="Console Mouse Daemon" +[ -n "${moused_device}" ] && name="${name} (${moused_device})" depend() { need localmount @@ -38,45 +39,38 @@ depend() { } start() { - ebegin "Starting the Console Mouse Daemon" "${name}" + ebegin "Starting ${name}" - if [ -z "${device}" ] ; then + if [ -z "${moused_device}" ] ; then local dev= for dev in /dev/psm[0-9]* /dev/ums[0-9]* ; do [ -e "${dev}" ] || continue [ -e /var/run/moused-$(basename "${dev}").pid ] && continue - device=${dev} + moused_device=${dev} eindent - einfo "Using mouse on ${device}" + einfo "Using mouse on ${moused_device}" eoutdent break done fi - if [ -z "${device}" ] ; then + if [ -z "${moused_device}" ] ; then eend 1 "No mouse device found" return 1 fi start-stop-daemon --start --exec /usr/sbin/moused \ --pidfile "${pidfile}" \ - -- ${MOUSED_ARGS} -p "${device}" -I "${pidfile}" + -- ${moused_args} -p "${moused_device}" -I "${pidfile}" local retval=$? - [ -n "${MOUSE_CHAR_START}" ] && MOUSE_CHAR_START="-M ${MOUSE_CHAR_START}" local ttyv= for ttyv in /dev/ttyv*; do - vidcontrol < "${ttyv}" ${MOUSE_CHAR_START} -m on + vidcontrol < "${ttyv}" -m on : $((retval+= $?)) done eend ${retval} "Failed to start moused" } -stop() { - ebegin "Stopping the Console Mouse Daemon ${name}" - start-stop-daemon --quiet --stop --pidfile "${pidfile}" - eend $? "Failed to stop moused" -} - # vim: set ts=4 : diff --git a/init.d.BSD/powerd b/init.d.BSD/powerd index a97e2e02..c7886942 100644 --- a/init.d.BSD/powerd +++ b/init.d.BSD/powerd @@ -25,7 +25,7 @@ # SUCH DAMAGE. command=/usr/sbin/powerd -command_args=${POWERD_ARGS} +command_args=${powerd_args} pidfile=/var/run/powerd.pid name="Power Control Daemon" @@ -36,10 +36,19 @@ depend() { } start_pre() { - if [ -n "${BATTERY_MODE}" ]; then - command_args="${command_args} -b ${BATTERY_MODE}" + if [ -n "${powerd_battery_mode}" ]; then + command_args="${command_args} -b ${powerd_battery_mode}" fi - if [ -n "${AC_MODE}" ]; then - command_args="${command_args} -a ${AC_MODE}" + if [ -n "${powerd_ac_mode}" ]; then + command_args="${command_args} -a ${powerd_ac_mode}" + fi +} + +stop_post() +{ + local level=$(sysctl -n dev.cpu.0.freq_levels | + sed -e 's:/.*::') + if [ -n "${level}" ]; then + sysctl dev.cpu.0.freq="${level}" >/dev/null fi } diff --git a/init.d.BSD/rarpd b/init.d.BSD/rarpd index e054d56c..16ed6de6 100644 --- a/init.d.BSD/rarpd +++ b/init.d.BSD/rarpd @@ -25,14 +25,15 @@ # SUCH DAMAGE. command=/usr/sbin/rarpd -command_args="-f ${RARPD_ARGS}" +command_args="-f ${rarpd_args}" pidfile=/var/run/rarpd.pid name="Reverse ARP Daemon" +required_files="/etc/ethers" -if [ -z "${RARPD_INTERFACE}" ]; then +if [ -z "${rarpd_interface}" ]; then command_args="${command_args} -a" else - command_args="${command_args} ${RARPD_INTERFACE}" + command_args="${command_args} ${rarpd_interface}" fi command_background="YES" @@ -40,9 +41,9 @@ depend() { need localmount after bootmisc - if [ -z "${RARPD_INTERFACE}" ]; then + if [ -z "${rarpd_interface}" ]; then need net else - net net."${RARPD_INTERFACE}" + net net."${rarpd_interface}" fi } diff --git a/init.d.BSD/rc-enabled b/init.d.BSD/rc-enabled index 9ab95d5e..a43680cc 100644 --- a/init.d.BSD/rc-enabled +++ b/init.d.BSD/rc-enabled @@ -25,7 +25,8 @@ depend() { need localmount net - after $(ls -1 | grep -v local | xargs) + after * + before local } start() { diff --git a/init.d.BSD/rpcbind b/init.d.BSD/rpcbind index 403d0959..8a5299a9 100644 --- a/init.d.BSD/rpcbind +++ b/init.d.BSD/rpcbind @@ -25,7 +25,7 @@ # SUCH DAMAGE. command=/usr/sbin/rpcbind -command_args=${RPCBIND_ARGS} +command_args=${rpcbind_args} name="RPC program number mapper" depend() { diff --git a/init.d.BSD/savecore b/init.d.BSD/savecore new file mode 100755 index 00000000..8d8577f9 --- /dev/null +++ b/init.d.BSD/savecore @@ -0,0 +1,56 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +description="Saves a kernel dump." + +depend() { + need checkfs + before swap +} + +start() { + local dump_dir=${dump_dir:-/var/crash} + if ! [ -d "${dump_dir}" ]; then + mkdir -p "${dump_dir}" + chmod 700 "${dump_dir}" + fi + + if [ "${RC_UNAME}" = "FreeBSD" ] ; then + # Don't quote ${dump_device}, so that if it's unset, + # savecore will check on the partitions listed in fstab + # without errors in the output + savecore -C "${dump_dir}" ${dump_device} >/dev/null + else + ls "${dump_dir}"/bsd* > /dev/null 2>&1 + fi + [ $? = 0 ] || return 0 + + local sopts="${dump_dir} ${dump_device}" + yesno ${dump_compress} && sopts="-z ${sopts}" + ebegin "Saving kernel core dump in ${dump_dir}" + savecore ${sopts} >/dev/null + eend $? +} diff --git a/init.d.BSD/syscons b/init.d.BSD/syscons index 5fc0e7ce..ae174f3b 100644 --- a/init.d.BSD/syscons +++ b/init.d.BSD/syscons @@ -28,30 +28,29 @@ depend() { } start() { - if [ -n "${MODE}" ]; then - ebegin "Setting mode to ${MODE} for all screens" + if [ -n "${allscreen_flags}" ]; then + ebegin "Setting mode to ${allscreen_flags} for all screens" for v in /dev/ttyv*; do - [ -c "${v}" ] || continue - vidcontrol "${MODE}" <"${v}" + vidcontrol ${allscreen_flags} <"${v}" done eend $? fi - if [ -n "${KEYMAP}" ]; then - ebegin "Setting keymap to ${KEYMAP}" - kbdcontrol -l ${KEYMAP} </dev/console + if [ -n "${keymap}" ]; then + ebegin "Setting keymap to ${keymap}" + kbdcontrol -l ${keymap} </dev/console eend $? fi - if [ -n "${KEYRATE}" ]; then - ebegin "Setting keyrate to ${KEYRATE}" - kbdcontrol -r ${KEYRATE} </dev/console + if [ -n "${keyrate}" ]; then + ebegin "Setting keyrate to ${keyrate}" + kbdcontrol -r ${keyrate} </dev/console eend $? fi - if [ -n "${KEYCHANGE}" ]; then + if [ -n "${keychange}" ]; then ebegin "Changing function keys" - eval set -- "${KEYCHANGE}" + eval set -- "${keychange}" eindent while [ $# -gt 0 ] ; do veinfo "F$1 -> \`$2'" @@ -62,14 +61,14 @@ start() { eoutdent fi - if [ -n "${CURSOR}" ]; then + if [ -n "${cursor}" ]; then ebegin "Setting cursor" - vidcontrol -c ${CURSOR} + vidcontrol -c ${cursor} eend $? fi local v= f= - for v in FONT8x16 FONT8x14 FONT8x8; do + for v in font8x16 font8x14 font8x8; do f=$(eval \$"${v}") if [ -n "${f}" ]; then ebegin "Setting font ${f}" @@ -78,25 +77,24 @@ start() { fi done - if [ -n "${BLANKTIME}" ]; then + if [ -n "${blanktime}" ]; then ebegin "Setting blanktime" - vidcontrol -t ${BLANKTIME} + vidcontrol -t ${blanktime} eend $? fi - if [ -n "${SAVER}" ]; then + if [ -n "${saver}" ]; then local i= for i in $(kldstat | sed -n -e 's/.* \(splash_.*\)/\1/p'); do kldunload "${i}" done - kldstat -v | grep -q _saver || kldload ${SAVER}_saver + kldstat -v | grep -q _saver || kldload ${saver}_saver fi - if [ -n "${KBDFLAGS}" ]; then + if [ -n "${kbdflags}" ]; then ebegin "Setting keyboard flags for all screens" for v in /dev/ttyv*; do - [ -c "${v}" ] || continue - kbdcontrol ${KBDFLAGS} <"${v}" + kbdcontrol ${kbdflags} <${v} done eend $? fi diff --git a/init.d.BSD/syslogd b/init.d.BSD/syslogd index c0e57e11..d9a131ad 100644 --- a/init.d.BSD/syslogd +++ b/init.d.BSD/syslogd @@ -25,7 +25,7 @@ # SUCH DAMAGE. command=/usr/sbin/syslogd -command_args=${SYSLOGD_ARGS} +command_args=${syslogd_args} pidfile=/var/run/syslog.pid name="System Logger Daemon" |