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)
This commit is contained in:
Roy Marples 2007-11-23 12:04:11 +00:00
parent f077f179ed
commit d81def80b0
64 changed files with 755 additions and 477 deletions

View File

@ -2,14 +2,10 @@
# Set to your mouse device psm[0-9] for PS/2 ports, ums[0-9] for USB ports # Set to your mouse device psm[0-9] for PS/2 ports, ums[0-9] for USB ports
# Leave blank to try to autodetect it # Leave blank to try to autodetect it
MOUSED_DEVICE="" #moused_device="/dev/psm0"
# Any additional arguments required # Any additional arguments required
MOUSED_ARGS="" moused_args=""
# If 0xd0-0xd3 default range is occupied in your language code table, specify
# alternative range start like MOUSECHAR_START="3", see vidcontrol(1)
MOUSECHAR_START=""
# You can also multiplex the init script for each device like so # You can also multiplex the init script for each device like so
# ln -s moused /etc/init.d/moused.ums0 # ln -s moused /etc/init.d/moused.ums0

View File

@ -1,7 +1,7 @@
# Mode allowed: maximum, minimum, adaptive # Mode allowed: maximum, minimum, adaptive
# Default unless specified is adaptive # Default unless specified is adaptive
AC_MODE="maximum" powerd_ac_mode="maximum"
#BATTERY_MODE="minimum" #powerd_battery_mode="minimum"
# Addiditonal arguments for powerd # Addiditonal arguments for powerd - see the man page for details
POWERD_OPTS="" powerd_args=""

View File

@ -1,3 +1,3 @@
# To start rarpd only for a given interface, set the # To start rarpd only for a given interface, set the
# following variable. Otherwise we listen on all interfaces. # following variable. Otherwise we listen on all interfaces.
#RARPD_INTERFACE="rl0" #rarpd_interface="rl0"

View File

@ -4,16 +4,16 @@
# NOTE:- This will blank the screen after this command is run # NOTE:- This will blank the screen after this command is run
# NOTE:- You can get more modes if you load the vesa kernel module, but this # NOTE:- You can get more modes if you load the vesa kernel module, but this
# may require the SC_PIXEL_MODE kernel option # may require the SC_PIXEL_MODE kernel option
#MODE="VGA_80x30" #allscreen_flags="VGA_80x30"
# Set the keymap to "uk.iso". # Set the keymap to "uk.iso".
#KEYMAP="uk.iso" #keymap="uk.iso"
# Set the keyboard rate to 250ms delay, and 34 repeat rate. # Set the keyboard rate to 250ms delay, and 34 repeat rate.
#KEYRATE="250.34" #keyrate="250.34"
# Change the behaviour of F-unction keys (see kbdcontrol(1)). # Change the behaviour of F-unction keys (see kbdcontrol(1)).
#KEYCHANGE="10 'ssh myhost'" #keychange="10 'ssh myhost'"
# See vidcontrol(1) -t # See vidcontrol(1) -t
#BLANKTIME="off" #blanktime="off"

View File

@ -1,6 +1,6 @@
DIR = /etc/conf.d DIR = /etc/conf.d
CONF = consolefont keymaps net.example CONF = consolefont keymaps net.example
CONF_APPEND = clock rc CONF_APPEND = clock
TOPDIR = .. TOPDIR = ..
include $(TOPDIR)/default.mk include $(TOPDIR)/default.mk

View File

@ -2,11 +2,11 @@
# Put a nologin file in /etc to prevent people from logging in before # Put a nologin file in /etc to prevent people from logging in before
# system startup is complete # system startup is complete
DELAYLOGIN="no" delaylogin="no"
# List of /tmp directories we should clean up # List of /tmp directories we should clean up
WIPE_TMP_DIRS="/tmp" wipe_tmp_dirs="/tmp"
# Should we wipe the tmp paths completely or just selectively remove known # Should we wipe the tmp paths completely or just selectively remove known
# locks / files / etc... ? # locks / files / etc... ?
WIPE_TMP="yes" wipe_tmp="yes"

View File

@ -1,7 +1,7 @@
# FSCK_SHUTDOWN causes checkfs to trigger during shutdown as well as startup. # fsck_shutdown causes checkfs to trigger during shutdown as well as startup.
# The end result of this is that if any periodic non-root filesystem checks are # The end result of this is that if any periodic non-root filesystem checks are
# scheduled, under normal circumstances the actual check will happen during # scheduled, under normal circumstances the actual check will happen during
# shutdown rather than at next boot. # shutdown rather than at next boot.
# This is useful when periodic filesystem checks are causing undesirable # This is useful when periodic filesystem checks are causing undesirable
# delays at startup, but such delays at shutdown are acceptable. # delays at startup, but such delays at shutdown are acceptable.
FSCK_SHUTDOWN="no" fsck_shutdown="NO"

View File

@ -4,16 +4,9 @@
# Greenwich Mean Time). If your clock is set to the local time, then # Greenwich Mean Time). If your clock is set to the local time, then
# set CLOCK to "local". Note that if you dual boot with Windows, then # set CLOCK to "local". Note that if you dual boot with Windows, then
# you should set it to "local". # you should set it to "local".
CLOCK="UTC" clock="UTC"
# If you want to set the Hardware Clock to the current System Time # If you want to set the Hardware Clock to the current System Time
# during shutdown, then say "yes" here. # during shutdown, then say "YES" here.
# You normally don't need to do this if you run a ntp daemon. # You normally don't need to do this if you run a ntp daemon.
CLOCK_SYSTOHC="no" clock_systohc="NO"
# Select the proper timezone. For valid values, peek inside of the
# /usr/share/zoneinfo/ directory. For example, some common values are
# "America/New_York" or "EST5EDT" or "Europe/Berlin". If you want to
# manage /etc/localtime yourself, set this to "".
TIMEZONE="Factory"

View File

@ -1,2 +1,2 @@
# Set to the hostname of this machine # Set to the hostname of this machine
HOSTNAME="localhost" hostname="localhost"

View File

@ -4,4 +4,4 @@
# (say for crypt swap), so you will need to customize this # (say for crypt swap), so you will need to customize this
# behavior. If you have /var on a separate partition, then # behavior. If you have /var on a separate partition, then
# make sure this path lives on your root device somewhere. # make sure this path lives on your root device somewhere.
URANDOM_SEED="/var/run/random-seed" urandom_seed="/var/run/random-seed"

View File

@ -41,6 +41,7 @@ install::
install:: $(BIN) $(CONF) $(CONF_APPEND) install:: $(BIN) $(CONF) $(CONF_APPEND)
if test -n "$(DIR)" ; then $(INSTALL) -d $(DESTDIR)$(DIR) || exit $$?; fi if test -n "$(DIR)" ; then $(INSTALL) -d $(DESTDIR)$(DIR) || exit $$?; fi
if test -n "$(BIN)" ; then $(INSTALL) $(BIN) $(DESTDIR)$(DIR) || exit $$?; fi if test -n "$(BIN)" ; then $(INSTALL) $(BIN) $(DESTDIR)$(DIR) || exit $$?; fi
if test -n "$(INC)" ; then $(INSTALL) -m 0644 $(INC) $(DESTDIR)$(DIR) || exit $$?; fi
for x in $(CONF); do \ for x in $(CONF); do \
if ! test -e $(DESTDIR)$(DIR)/$$x; then \ if ! test -e $(DESTDIR)$(DIR)/$$x; then \
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \ $(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \

View File

@ -1,5 +1,6 @@
DIR = /etc DIR = /etc
CONF = inittab CONF = inittab
CONF_APPEND = rc
TOPDIR = .. TOPDIR = ..
include $(TOPDIR)/default.mk include $(TOPDIR)/default.mk

View File

@ -4,16 +4,7 @@
# This is the number of tty's used in most of the rc-scripts (like # This is the number of tty's used in most of the rc-scripts (like
# consolefont, numlock, etc ...) # consolefont, numlock, etc ...)
RC_TTY_NUMBER=12 rc_tty_number=12
# RC_DOWN_INTERFACE allows you to specify if RC will bring the interface
# completely down when it stops. The default is yes, but there are some
# instances where you may not want this to happen such as using Wake On LAN.
RC_DOWN_INTERFACE="yes"
# RC_DOWN_HARDDISK allows you to specify if RC will put harddisks to
# standby mode when it stops.
RC_DOWN_HARDDISK="yes"
# Use this variable to control the /dev management behavior. # Use this variable to control the /dev management behavior.
# auto - let the scripts figure out what's best at boot # auto - let the scripts figure out what's best at boot
@ -21,7 +12,7 @@ RC_DOWN_HARDDISK="yes"
# mdev - use mdev (requires sys-apps/busybox) # mdev - use mdev (requires sys-apps/busybox)
# udev - use udev (requires sys-fs/udev) # udev - use udev (requires sys-fs/udev)
# static - let the user manage /dev (YOU need to create ALL device nodes) # static - let the user manage /dev (YOU need to create ALL device nodes)
RC_DEVICES="auto" rc_devices="auto"
# UDEV OPTION: # UDEV OPTION:
# Set to "yes" if you want to save /dev to a tarball on shutdown # Set to "yes" if you want to save /dev to a tarball on shutdown
@ -29,7 +20,6 @@ RC_DEVICES="auto"
# custom device nodes that udev does not handle/know about. # custom device nodes that udev does not handle/know about.
RC_DEVICE_TARBALL="no" RC_DEVICE_TARBALL="no"
# RC_DMESG_LEVEL sets the level at which logging of messages is done to the # Sets the level at which logging of messages is done to the
# console. See dmesg(8) for more info. # console. See dmesg(8) for more info.
RC_DMESG_LEVEL="1" dmesg_level="1"

5
etc/Makefile Normal file
View File

@ -0,0 +1,5 @@
DIR = /etc
CONF = rc.conf
TOPDIR = ..
include $(TOPDIR)/default.mk

View File

@ -1,68 +1,59 @@
# /etc/conf.d/rc: Global config file for OpenRC # /etc/rc.conf: Global OpenRC configuration settings
# Set to "yes" if you want the rc system to try and start services # Set to "YES" if you want the rc system to try and start services
# in parallel for a slight speed improvement. When running in parallel we # in parallel for a slight speed improvement. When running in parallel we
# prefix the service output with it's name as the output will get # prefix the service output with it's name as the output will get
# jumbled up. # jumbled up.
RC_PARALLEL="no" rc_parallel="NO"
# Set RC_INTERACTIVE to "yes" and you'll be able to press the I key during # Set rc_interactive to "YES" and you'll be able to press the I key during
# boot so you can choose to start specific services. Set to "no" to disable # boot so you can choose to start specific services. Set to "NO" to disable
# this feature. # this feature.
RC_INTERACTIVE="yes" rc_interactive="YES"
# RC_VERBOSE will make init scripts more verbose and adds
# "Service FOO starting/started/stopping/stopped" messages around each
# init script.
RC_VERBOSE="no"
# RC_QUIET on the other hand will make init scripts quiet and produce no
# output.
RC_QUIET="no"
# Do we allow any started service in the runlevel to satisfy the depedency # Do we allow any started service in the runlevel to satisfy the depedency
# or do we want all of them regardless of state? For example, if net.eth0 # or do we want all of them regardless of state? For example, if net.eth0
# and net.eth1 are in the default runlevel then with RC_DEPEND_STRICT="no" # and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
# both will be started, but services that depend on 'net' will work if either # both will be started, but services that depend on 'net' will work if either
# one comes up. With RC_DEPEND_STRICT="yes" we would require them both to # one comes up. With rc_depend_strict="YES" we would require them both to
# come up. # come up.
RC_DEPEND_STRICT="yes" rc_depend_strict="YES"
# Do we allow services to be hotplugged? If not, set to RC_HOTPLUG="no" # Do we allow services to be hotplugged? If not, set to rc_hotplug="NO"
# NOTE: This does not affect anything hotplug/udev/devd related, just the # NOTE: This does not affect anything hotplug/udev/devd related, just the
# starting/stopping of the init.d service triggered by it. # starting/stopping of the init.d service triggered by it.
RC_HOTPLUG="yes" rc_hotplug="YES"
# Dynamic /dev managers can trigger coldplug events which cause services to # Dynamic /dev managers can trigger coldplug events which cause services to
# start before we are ready for them. If this happens, we can defer these # start before we are ready for them. If this happens, we can defer these
# services to start in the boot runlevel. Set RC_COLDPLUG="no" if you don't # services to start in the boot runlevel. Set rc_coldplug="NO" if you don't
# want this. # want this.
# NOTE: This also affects module coldplugging in udev-096 and higher # NOTE: This also affects module coldplugging in udev-096 and higher
# If you want module coldplugging but not coldplugging of services then you # If you want module coldplugging but not coldplugging of services then you
# can set RC_COLDPLUG="yes" and RC_PLUG_SERVICES="!*" # can set rc_coldplug="YES" and rc_plug_services="!*"
RC_COLDPLUG="yes" rc_coldplug="YES"
# Some people want a finer grain over hotplug/coldplug. RC_PLUG_SERVICES is a # Some people want a finer grain over hotplug/coldplug. rc_plug_services is a
# list of services that are matched in order, either allowing or not. By # list of services that are matched in order, either allowing or not. By
# default we allow services through as RC_COLDPLUG/RC_HOTPLUG has to be yes # default we allow services through as rc_coldplug/rc_hotplug has to be YES
# anyway. # anyway.
# Example - RC_PLUG_SERVICES="net.wlan !net.*" # Example - rc_plug_services="net.wlan !net.*"
# This allows net.wlan and any service not matching net.* to be plugged. # This allows net.wlan and any service not matching net.* to be plugged.
RC_PLUG_SERVICES="" rc_plug_services=""
# Define network fstypes. Below is the default. # Define network fstypes. Below is the default.
#RC_NET_FS_LIST="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
# RC_FORCE_AUTO tries its best to prevent user interaction during the boot and # rc_force_auto tries its best to prevent user interaction during the boot and
# shutdown process. For example, fsck will automatically be run or volumes # shutdown process. For example, fsck will automatically be run or volumes
# remounted to create proper directory trees. This feature can be dangerous # remounted to create proper directory trees. This feature can be dangerous
# and is meant ONLY for headless machines where getting a physical console # and is meant ONLY for headless machines where getting a physical console
# hooked up is a huge pita. # hooked up is a huge pita.
RC_FORCE_AUTO="no" rc_force_auto="NO"
# RC_LOGGER launches a logging daemon to log the entire rc process to # rc_logger launches a logging daemon to log the entire rc process to
# /var/log/rc.log # /var/log/rc.log
RC_LOGGER="no" rc_logger="NO"
############################################################################## ##############################################################################
# SERVICE CONFIGURATION VARIABLES # SERVICE CONFIGURATION VARIABLES
@ -75,11 +66,11 @@ RC_LOGGER="no"
#export SSD_NICELEVEL="-19" #export SSD_NICELEVEL="-19"
# Pass ulimit parameters # Pass ulimit parameters
#RC_ULIMIT="-u 30" #rc_ulimit="-u 30"
# It's possible to define extra dependencies for services like so # It's possible to define extra dependencies for services like so
#RC_CONFIG="/etc/foo" #rc_config="/etc/foo"
#RC_NEED="openvpn" #rc_need="openvpn"
#RC_USE="net.eth0" #rc_use="net.eth0"
#RC_AFTER="clock" #rc_after="clock"
#RC_BEFORE="local" #rc_before="local"

View File

@ -29,19 +29,24 @@ extra_commands="save"
description="Sets the local clock to UTC or Local Time." description="Sets the local clock to UTC or Local Time."
description_save="Saves the current time in the BIOS." 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() { depend() {
# BSD adjkerntz needs to be able to write to /etc # BSD adjkerntz needs to be able to write to /etc
if [ "${CLOCK}" = "UTC" -a -e /etc/wall_cmos_clock ] || if [ "${clock}" = "UTC" -a -e /etc/wall_cmos_clock ] ||
[ "${CLOCK}" != "UTC" -a ! -e /etc/wall_cmos_clock ] ; then [ "${clock}" != "UTC" -a ! -e /etc/wall_cmos_clock ]; then
need checkroot need checkroot
fi fi
} }
start() { start() {
local TBLURB="Local Time" ebegin "Starting the System Clock Adjuster [${utc}]"
[ "${CLOCK}" = "UTC" ] && TBLURB="UTC" if [ "${clock}" != "UTC" ]; then
ebegin "Starting the System Clock Adjuster [${TBLURB}]"
if [ "${CLOCK}" != "UTC" ] ; then
echo >/etc/wall_cmos_clock echo >/etc/wall_cmos_clock
start-stop-daemon --start --exec /sbin/adjkerntz -- -i start-stop-daemon --start --exec /sbin/adjkerntz -- -i
else else
@ -52,16 +57,16 @@ start() {
} }
save() { save() {
local TBLURB="Local Time" ebegin "Setting hardware clock using the system clock [${utc}]"
[ "${CLOCK}" = "UTC" ] && TBLURB="UTC"
ebegin "Setting hardware clock using the system clock" "[${TBLURB}]"
adjkerntz -a adjkerntz -a
eend $? eend $?
} }
stop() { stop() {
# Don't tweak the hardware clock on LiveCD halt. # 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" ebegin "Stopping the System Clock Adjuster"
if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz ; then if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz ; then

47
init.d.BSD/dumpon Executable file
View File

@ -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 $?
}

View File

@ -25,9 +25,9 @@
# This is based on /etc/rc.firewall and /etc/rc.firewall6 from FreeBSD # This is based on /etc/rc.firewall and /etc/rc.firewall6 from FreeBSD
IP_IN=${IP_IN-any} ipfw_ip_in=${ipfw_ip_in-any}
PORTS_IN=${PORTS_IN-auth ssh} ipfw_ports_in=${ipfw_ports_in-auth ssh}
PORTS_NOLOG=${PORTS_NOLOG-135-139,445 1026,1027 1433,1434} ipfw_ports_nolog=${ipfw_ports_nolog-135-139,445 1026,1027 1433,1434}
opts="panic showstatus" opts="panic showstatus"
@ -105,8 +105,8 @@ start() {
# Add permits for this workstations published services below # Add permits for this workstations published services below
# Only IPs and nets in firewall_allowservices is allowed in. # Only IPs and nets in firewall_allowservices is allowed in.
for i in ${IP_IN}; do for i in ${ipfw_ip_in}; do
for p in ${PORTS_IN}; do for p in ${ipfw_ports_in}; do
ipfw add pass tcp from ${i} to me ${p} ipfw add pass tcp from ${i} to me ${p}
done done
done done
@ -114,14 +114,14 @@ start() {
# Allow all connections from trusted IPs. # Allow all connections from trusted IPs.
# Playing with the content of firewall_trusted could seriously # Playing with the content of firewall_trusted could seriously
# degrade the level of protection provided by the firewall. # 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 ipfw add pass ip from ${i} to me
done done
ipfw add 65000 count ip from any to any ipfw add 65000 count ip from any to any
# Drop packets to ports where we don't want logging # 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 ipfw add deny { tcp or udp } from any to any ${p} in
done done
@ -138,7 +138,7 @@ start() {
ipfw add deny tcp from any 80,443 to any 1024-65535 in ipfw add deny tcp from any 80,443 to any 1024-65535 in
# Deny and (if wanted) log the rest unconditionally. # Deny and (if wanted) log the rest unconditionally.
if [ "${LOG_DENY}" = "yes" ]; then if yesno ${ipfw_log_deny:-no}; then
log="log" log="log"
sysctl net.inet.ip.fw.verbose=1 >/dev/null sysctl net.inet.ip.fw.verbose=1 >/dev/null
fi fi

View File

@ -23,14 +23,15 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE. # SUCH DAMAGE.
name=${SVCNAME##*.} mouse=${SVCNAME##*.}
if [ -n "${name}" -a "${name}" != "moused" ] ; then if [ -n "${name}" -a "${mouse}" != "moused" ] ; then
device=/dev/"${name}" moused_device=/dev/"${mouse}"
pidfile=/var/run/moused-"${name}".pid pidfile=/var/run/moused-"${mouse}".pid
else else
name=
pidfile=/var/run/moused.pid pidfile=/var/run/moused.pid
fi fi
name="Console Mouse Daemon"
[ -n "${moused_device}" ] && name="${name} (${moused_device})"
depend() { depend() {
need localmount need localmount
@ -38,45 +39,38 @@ depend() {
} }
start() { start() {
ebegin "Starting the Console Mouse Daemon" "${name}" ebegin "Starting ${name}"
if [ -z "${device}" ] ; then if [ -z "${moused_device}" ] ; then
local dev= local dev=
for dev in /dev/psm[0-9]* /dev/ums[0-9]* ; do for dev in /dev/psm[0-9]* /dev/ums[0-9]* ; do
[ -e "${dev}" ] || continue [ -e "${dev}" ] || continue
[ -e /var/run/moused-$(basename "${dev}").pid ] && continue [ -e /var/run/moused-$(basename "${dev}").pid ] && continue
device=${dev} moused_device=${dev}
eindent eindent
einfo "Using mouse on ${device}" einfo "Using mouse on ${moused_device}"
eoutdent eoutdent
break break
done done
fi fi
if [ -z "${device}" ] ; then if [ -z "${moused_device}" ] ; then
eend 1 "No mouse device found" eend 1 "No mouse device found"
return 1 return 1
fi fi
start-stop-daemon --start --exec /usr/sbin/moused \ start-stop-daemon --start --exec /usr/sbin/moused \
--pidfile "${pidfile}" \ --pidfile "${pidfile}" \
-- ${MOUSED_ARGS} -p "${device}" -I "${pidfile}" -- ${moused_args} -p "${moused_device}" -I "${pidfile}"
local retval=$? local retval=$?
[ -n "${MOUSE_CHAR_START}" ] && MOUSE_CHAR_START="-M ${MOUSE_CHAR_START}"
local ttyv= local ttyv=
for ttyv in /dev/ttyv*; do for ttyv in /dev/ttyv*; do
vidcontrol < "${ttyv}" ${MOUSE_CHAR_START} -m on vidcontrol < "${ttyv}" -m on
: $((retval+= $?)) : $((retval+= $?))
done done
eend ${retval} "Failed to start moused" 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 : # vim: set ts=4 :

View File

@ -25,7 +25,7 @@
# SUCH DAMAGE. # SUCH DAMAGE.
command=/usr/sbin/powerd command=/usr/sbin/powerd
command_args=${POWERD_ARGS} command_args=${powerd_args}
pidfile=/var/run/powerd.pid pidfile=/var/run/powerd.pid
name="Power Control Daemon" name="Power Control Daemon"
@ -36,10 +36,19 @@ depend() {
} }
start_pre() { start_pre() {
if [ -n "${BATTERY_MODE}" ]; then if [ -n "${powerd_battery_mode}" ]; then
command_args="${command_args} -b ${BATTERY_MODE}" command_args="${command_args} -b ${powerd_battery_mode}"
fi fi
if [ -n "${AC_MODE}" ]; then if [ -n "${powerd_ac_mode}" ]; then
command_args="${command_args} -a ${AC_MODE}" 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 fi
} }

View File

@ -25,14 +25,15 @@
# SUCH DAMAGE. # SUCH DAMAGE.
command=/usr/sbin/rarpd command=/usr/sbin/rarpd
command_args="-f ${RARPD_ARGS}" command_args="-f ${rarpd_args}"
pidfile=/var/run/rarpd.pid pidfile=/var/run/rarpd.pid
name="Reverse ARP Daemon" name="Reverse ARP Daemon"
required_files="/etc/ethers"
if [ -z "${RARPD_INTERFACE}" ]; then if [ -z "${rarpd_interface}" ]; then
command_args="${command_args} -a" command_args="${command_args} -a"
else else
command_args="${command_args} ${RARPD_INTERFACE}" command_args="${command_args} ${rarpd_interface}"
fi fi
command_background="YES" command_background="YES"
@ -40,9 +41,9 @@ depend() {
need localmount need localmount
after bootmisc after bootmisc
if [ -z "${RARPD_INTERFACE}" ]; then if [ -z "${rarpd_interface}" ]; then
need net need net
else else
net net."${RARPD_INTERFACE}" net net."${rarpd_interface}"
fi fi
} }

View File

@ -25,7 +25,8 @@
depend() { depend() {
need localmount net need localmount net
after $(ls -1 | grep -v local | xargs) after *
before local
} }
start() { start() {

View File

@ -25,7 +25,7 @@
# SUCH DAMAGE. # SUCH DAMAGE.
command=/usr/sbin/rpcbind command=/usr/sbin/rpcbind
command_args=${RPCBIND_ARGS} command_args=${rpcbind_args}
name="RPC program number mapper" name="RPC program number mapper"
depend() { depend() {

56
init.d.BSD/savecore Executable file
View File

@ -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 $?
}

View File

@ -28,30 +28,29 @@ depend() {
} }
start() { start() {
if [ -n "${MODE}" ]; then if [ -n "${allscreen_flags}" ]; then
ebegin "Setting mode to ${MODE} for all screens" ebegin "Setting mode to ${allscreen_flags} for all screens"
for v in /dev/ttyv*; do for v in /dev/ttyv*; do
[ -c "${v}" ] || continue vidcontrol ${allscreen_flags} <"${v}"
vidcontrol "${MODE}" <"${v}"
done done
eend $? eend $?
fi fi
if [ -n "${KEYMAP}" ]; then if [ -n "${keymap}" ]; then
ebegin "Setting keymap to ${KEYMAP}" ebegin "Setting keymap to ${keymap}"
kbdcontrol -l ${KEYMAP} </dev/console kbdcontrol -l ${keymap} </dev/console
eend $? eend $?
fi fi
if [ -n "${KEYRATE}" ]; then if [ -n "${keyrate}" ]; then
ebegin "Setting keyrate to ${KEYRATE}" ebegin "Setting keyrate to ${keyrate}"
kbdcontrol -r ${KEYRATE} </dev/console kbdcontrol -r ${keyrate} </dev/console
eend $? eend $?
fi fi
if [ -n "${KEYCHANGE}" ]; then if [ -n "${keychange}" ]; then
ebegin "Changing function keys" ebegin "Changing function keys"
eval set -- "${KEYCHANGE}" eval set -- "${keychange}"
eindent eindent
while [ $# -gt 0 ] ; do while [ $# -gt 0 ] ; do
veinfo "F$1 -> \`$2'" veinfo "F$1 -> \`$2'"
@ -62,14 +61,14 @@ start() {
eoutdent eoutdent
fi fi
if [ -n "${CURSOR}" ]; then if [ -n "${cursor}" ]; then
ebegin "Setting cursor" ebegin "Setting cursor"
vidcontrol -c ${CURSOR} vidcontrol -c ${cursor}
eend $? eend $?
fi fi
local v= f= local v= f=
for v in FONT8x16 FONT8x14 FONT8x8; do for v in font8x16 font8x14 font8x8; do
f=$(eval \$"${v}") f=$(eval \$"${v}")
if [ -n "${f}" ]; then if [ -n "${f}" ]; then
ebegin "Setting font ${f}" ebegin "Setting font ${f}"
@ -78,25 +77,24 @@ start() {
fi fi
done done
if [ -n "${BLANKTIME}" ]; then if [ -n "${blanktime}" ]; then
ebegin "Setting blanktime" ebegin "Setting blanktime"
vidcontrol -t ${BLANKTIME} vidcontrol -t ${blanktime}
eend $? eend $?
fi fi
if [ -n "${SAVER}" ]; then if [ -n "${saver}" ]; then
local i= local i=
for i in $(kldstat | sed -n -e 's/.* \(splash_.*\)/\1/p'); do for i in $(kldstat | sed -n -e 's/.* \(splash_.*\)/\1/p'); do
kldunload "${i}" kldunload "${i}"
done done
kldstat -v | grep -q _saver || kldload ${SAVER}_saver kldstat -v | grep -q _saver || kldload ${saver}_saver
fi fi
if [ -n "${KBDFLAGS}" ]; then if [ -n "${kbdflags}" ]; then
ebegin "Setting keyboard flags for all screens" ebegin "Setting keyboard flags for all screens"
for v in /dev/ttyv*; do for v in /dev/ttyv*; do
[ -c "${v}" ] || continue kbdcontrol ${kbdflags} <${v}
kbdcontrol ${KBDFLAGS} <"${v}"
done done
eend $? eend $?
fi fi

View File

@ -25,7 +25,7 @@
# SUCH DAMAGE. # SUCH DAMAGE.
command=/usr/sbin/syslogd command=/usr/sbin/syslogd
command_args=${SYSLOGD_ARGS} command_args=${syslogd_args}
pidfile=/var/run/syslog.pid pidfile=/var/run/syslog.pid
name="System Logger Daemon" name="System Logger Daemon"

108
init.d.Linux/procfs Normal file
View File

@ -0,0 +1,108 @@
#!/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="Mounts misc filesystems in /proc."
depend() {
need checkfs
}
start() {
# Make sure we insert usbcore if its a module
if [ -f /proc/modules -a ! -d /proc/bus/usb ]; then
modprobe -q usbcore
fi
[ -e /proc/filesystems ] || return 0
# Check what USB fs the kernel support. Currently
# 2.5+ kernels, and later 2.4 kernels have 'usbfs',
# while older kernels have 'usbdevfs'.
if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then
local usbfs=$(grep -Fow usbfs /proc/filesystems ||
grep -Fow usbdevfs /proc/filesystems)
if [ -n "${usbfs}" ] ; then
ebegin "Mounting USB device filesystem (${usbfs})"
local usbgid="$(getent group usb | \
sed -e 's/.*:.*:\(.*\):.*/\1/')"
mount -t ${usbfs} \
-o ${usbgid:+devmode=0664,devgid=${usbgid},}noexec,nosuid \
usbfs /proc/bus/usb
eend $?
fi
fi
# Setup Kernel Support for the NFS daemon status
if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd ; then
if grep -qs nfsd /proc/filesystems ; then
ebegin "Mounting nfsd filesystem"
mount -t nfsd -o nodev,noexec,nosuid \
nfsd /proc/fs/nfsd
eend $?
fi
fi
# Setup Kernel Support for miscellaneous Binary Formats
if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc ; then
if grep -qs binfmt_misc /proc/filesystems ; then
ebegin "Mounting misc binary format filesystem"
mount -t binfmt_misc -o nodev,noexec,nosuid \
binfmt_misc /proc/sys/fs/binfmt_misc
eend $?
fi
fi
# Setup Kernel Support for securityfs
if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security ; then
if grep -qs securityfs /proc/filesystems ; then
ebegin "Mounting security filesystem"
mount -t securityfs securityfs /sys/kernel/security \
-o nodev,noexec,nosuid
eend $?
fi
fi
# Setup Kernel Support for debugfs
if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug ; then
if grep -qs debugfs /proc/filesystems ; then
ebegin "Mounting debug filesystem"
mount -t debugfs debugfs /sys/kernel/debug \
-o nodev,noexec,nosuid
eend $?
fi
fi
# Setup Kernel Support for SELinux
if [ -d /selinux ] && ! mountinfo -q /selinux ; then
if grep -qs selinuxfs /proc/filesystems ; then
ebegin "Mounting SELinux filesystem"
mount -t selinuxfs selinuxfs /selinux
eend $?
fi
fi
return 0
}

5
init.d.misc/Makefile Normal file
View File

@ -0,0 +1,5 @@
DIR = /etc/init.d
BIN = $(CONTENTS)
TOPDIR = ..
include $(TOPDIR)/default.mk

116
init.d.misc/named Normal file
View File

@ -0,0 +1,116 @@
#!/sbin/runscript
# 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.
command=/usr/sbin/named
command_args=${named_args}
pidfile=/var/run/named/pid
name="Domain Name server"
extra_commands="reload"
namedb=/etc/namedb
named_uid=${named_uid:-bind}
depend() {
provide dns
need localmount
after bootmisc
}
start_pre() {
if [ -n "${named_chroot}" ]; then
# Create (or update) the chroot directory structure
if [ -r /etc/mtree/BIND.chroot.dist ]; then
mtree -deU -f /etc/mtree/BIND.chroot.dist -p "${named_chroot}"
else
ewarn "/etc/mtree/BIND.chroot.dist missing,"
ewarn "chroot directory structure not updated"
fi
if [ ! -d "${named_chroot}"/. ]; then
eerror "chroot directory ${named_chroot} missing"
exit 1
fi
# Create /etc/namedb symlink
if [ ! -L "${namedb}" ]; then
if [ -d "${namedb}" ]; then
ewarn "named chroot: ${namedb} is a directory!"
elif [ -e "${namedb}" ]; then
ewarn "named chroot: ${namedb} exists!"
else
ln -s "${named_chroot}${namedb}" "${namedb}"
fi
else
# Make sure it points to the right place.
ln -shf "${named_chroot}${namedb}" "${namedb}"
fi
case "${RC_UNAME}" in
*BSD|DragonFly)
# Mount a devfs in the chroot directory if needed
umount "${named_chroot}"/dev 2>/dev/null
mount -t devfs dev "${named_chroot}"/dev
devfs -m "${named_chroot}"/dev ruleset devfsrules_hide_all
devfs -m "${named_chroot}"/dev rule apply path null unhide
devfs -m "${named_chroot}"/dev rule apply path random unhide
;;
esac
# Copy local timezone information if it is not up to date.
if [ -r /etc/localtime ]; then
cmp -s /etc/localtime "${named_chroot}/etc/localtime" ||
cp -p /etc/localtime "${named_chroot}/etc/localtime"
fi
command_args="${command_args} -t ${named_chroot}"
ln -fs "${named_chroot}${pidfile}" "${pidfile}"
fi
if [ ! -s "${named_chroot}${namedb}/rndc.conf" ]; then
local confgen="${command%/named}/rndc-confgen -a -b256 -u ${named_uid} \
-c ${named_chrootdir}/etc/namedb/rndc.key"
if [ -s "${named_chroot}${namedb}/rndc.key" ]; then
local getuser="stat -f%Su"
[ "${RC_UNAME}" = "Linux" ] && getuser="stat -c%U"
case $(${getuser} "${named_chroot}${namedb}"/rndc.key) in
root|"${named_uid}") ;;
*) ${confgen} ;;
esac
else
${confgen}
fi
fi
}
reload() {
rndc reload
}
stop_post() {
if [ -n "${named_chroot}" -a -c "${named_chroot}"/dev/null ]; then
umount "${named_chroot}"/dev 2>/dev/null || true
fi
}

59
init.d.misc/ntpd Normal file
View File

@ -0,0 +1,59 @@
#!/sbin/runscript
# 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.
ntpd_config=${ntpd_config:-/etc/ntp.conf}
ntpd_drift=${ntpd_drift:-/var/db/ntpd.drift}
command=/usr/sbin/ntpd
pidfile=/var/run/ntpd.pid
command_args="${ntpd_args} -c ${ntpd_config} -f ${ntpd_drift} -p ${pidfile}"
name="Network Time Protocol Daemon"
depend() {
use dns
need localmount
after bootmisc ntp-client
}
start_pre() {
if [ ! -r "${ntpd_config}" ]; then
eerror "${ntpd_config} is not readable"
exit 1
fi
if [ -n "${ntpd_chroot}" ]; then
case "${RC_UNAME}" in
*BSD|DragonFly)
if [ ! -c "${ntpd_chroot}/dev/clockctl" ]; then
rm -f "${ntpd_chroot}/dev/clockctl"
(cd /dev; /bin/pax -rw -pe clockctl "${ntpd_chroot}/dev")
fi
;;
esac
ln -fs "${ntpd_chroot}${ntpd_drift}" "${ntpd_drift}"
command_args="${command_args} -u ntpd:ntpd -i ${ntpd_chroot}"
fi
}

View File

@ -36,7 +36,7 @@ cleanup_tmp_dir() {
mkdir -p "${dir}" mkdir -p "${dir}"
cd "${dir}" cd "${dir}"
if [ "${WIPE_TMP}" = "yes" ]; then if [ "${wipe_tmp}" = "yes" ]; then
ebegin "Wiping ${dir} directory" ebegin "Wiping ${dir} directory"
local startopts="-x . -depth" local startopts="-x . -depth"
[ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth" [ "${RC_UNAME}" = "Linux" ] && startopts=". -xdev -depth"
@ -116,7 +116,7 @@ start() {
# Clean up /tmp directories # Clean up /tmp directories
local tmp= local tmp=
for tmp in ${WIPE_TMP_DIRS-/tmp}; do for tmp in ${wipe_tmp_dirs-/tmp}; do
cleanup_tmp_dir "${tmp}" cleanup_tmp_dir "${tmp}"
done done
chmod +t /tmp /var/tmp chmod +t /tmp /var/tmp

View File

@ -63,7 +63,7 @@ do_checkfs() {
ewend 1 "Operational error, continuing" ewend 1 "Operational error, continuing"
retval=0 retval=0
else else
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then if yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then
eend 2 "Fsck could not correct all errors, rerunning" eend 2 "Fsck could not correct all errors, rerunning"
fsck ${opts} -y ${parts} fsck ${opts} -y ${parts}
retval=$? retval=$?
@ -87,7 +87,9 @@ start() {
stop() { stop() {
# fsck on shutdown if we need to # fsck on shutdown if we need to
[ "${FSCK_SHUTDOWN}" = "yes" -a ! -f /forcefsck ] && do_checkfs if yesno "${fsck_shutdown:-${FSCK_SHUTDOWN}}"; then
[ ! -f /forcefsck ] && do_checkfs
fi
return 0 return 0
} }

View File

@ -100,7 +100,7 @@ do_fsck() {
retval=0 retval=0
elif [ ${retval} -eq 2 -o ${retval} -eq 3 ] ; then elif [ ${retval} -eq 2 -o ${retval} -eq 3 ] ; then
ewend 1 "Filesystem repaired, but reboot needed!" ewend 1 "Filesystem repaired, but reboot needed!"
if [ "${RC_FORCE_AUTO}" != "yes" ] ; then if ! yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then
printf "\a"; sleep 1; printf "\a"; sleep 1 printf "\a"; sleep 1; printf "\a"; sleep 1
printf "\a"; sleep 1; printf "\a"; sleep 1 printf "\a"; sleep 1; printf "\a"; sleep 1
ewarn "Rebooting in 10 seconds ..." ewarn "Rebooting in 10 seconds ..."
@ -109,7 +109,7 @@ do_fsck() {
einfo "Rebooting" einfo "Rebooting"
reboot -f reboot -f
else else
if [ "${RC_FORCE_AUTO}" = "yes" ] ; then if yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then
eend 2 "Rerunning fsck in force mode" eend 2 "Rerunning fsck in force mode"
fsck ${opts} -y "${root}" fsck ${opts} -y "${root}"
retval=$? retval=$?
@ -128,7 +128,6 @@ do_fsck() {
reboot -f reboot -f
fi fi
fi fi
} }
start() { start() {

View File

@ -26,6 +26,7 @@
. /etc/init.d/functions.sh . /etc/init.d/functions.sh
. "${RC_LIBDIR}"/sh/rc-functions.sh . "${RC_LIBDIR}"/sh/rc-functions.sh
[ -r /etc/rc.conf ] && . /etc/rc.conf
# Support LiveCD foo # Support LiveCD foo
if [ -r /sbin/livecd-functions.sh ] ; then if [ -r /sbin/livecd-functions.sh ] ; then
@ -43,12 +44,12 @@ if [ -x /sbin/killall5 ] ; then
fi fi
# Flush all pending disk writes now # Flush all pending disk writes now
sync ; sync sync; sync
# If we are in a VPS, we don't need anything below here, because # If we are in a VPS, we don't need anything below here, because
# 1) we don't need (and by default can't) umount anything (VServer) or # 1) we don't need (and by default can't) umount anything (VServer) or
# 2) the host utils take care of all umounting stuff (OpenVZ) # 2) the host utils take care of all umounting stuff (OpenVZ)
if [ "${RC_SYS}" = "VPS" ] ; then if [ "${RC_SYS}" = "VPS" ]; then
if [ -e /etc/init.d/"$1".sh ] ; then if [ -e /etc/init.d/"$1".sh ] ; then
. /etc/init.d/"$1".sh . /etc/init.d/"$1".sh
else else
@ -93,7 +94,7 @@ if [ "${RC_UNAME}" = "Linux" ] ; then
. "${RC_LIBDIR}"/sh/rc-mount.sh . "${RC_LIBDIR}"/sh/rc-mount.sh
eindent eindent
fs= fs=
for x in ${RC_NET_FS_LIST} ; do for x in ${net_fs_list} ; do
fs="${fs}${fs:+|}${x}" fs="${fs}${fs:+|}${x}"
done done
[ -n "${fs}" ] && fs="^(${fs})$" [ -n "${fs}" ] && fs="^(${fs})$"

View File

@ -31,13 +31,9 @@ depend() {
} }
start() { start() {
if [ -f /etc/hostname ] ; then hostname=${hostname-${HOSTNAME-localhost}}
ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname" ebegin "Setting hostname to ${hostname}"
HOSTNAME=$(cat /etc/hostname) hostname "${hostname}"
fi
ebegin "Setting hostname to ${HOSTNAME}"
hostname "${HOSTNAME}"
eend $? "Failed to set the hostname" eend $? "Failed to set the hostname"
} }

View File

@ -25,8 +25,6 @@
# SUCH DAMAGE. # SUCH DAMAGE.
description="Mounts disks and swap according to /etc/fstab." description="Mounts disks and swap according to /etc/fstab."
[ -e /proc/filessystems ] && description="${description} Also mounts various filesystems in /proc."
[ -x /sbin/dumpon ] && description="${description} Also configures saving kernel dumps to swap."
depend() { depend() {
need checkfs need checkfs
@ -35,7 +33,7 @@ depend() {
start() { start() {
# Mount local filesystems in /etc/fstab. # Mount local filesystems in /etc/fstab.
local types="noproc" x= local types="noproc" x=
for x in ${RC_NET_FS_LIST} ; do for x in ${net_fs_list}; do
types="${types},${x}" types="${types},${x}"
done done
@ -43,122 +41,6 @@ start() {
mount -at "${types}" mount -at "${types}"
eend $? "Some local filesystem failed to mount" eend $? "Some local filesystem failed to mount"
if [ -x /sbin/savecore ] ; then
local dumpdir=${KERNEL_DUMP_DIR:-/var/crash}
if ! [ -d "${dumpdir}" ]; then
mkdir -p "${dumpdir}"
chmod 700 "${dumpdir}"
fi
if [ "${RC_UNAME}" = "FreeBSD" ] ; then
# Don't quote ${KERNEL_DUMP_DEVICE}, so that if it's unset,
# savecore will check on the partitions listed in fstab
# without errors in the output
savecore -C "${dumpdir}" ${KERNEL_DUMP_DEVICE} >/dev/null
else
ls "${dumpdir}"/bsd* > /dev/null 2>&1
fi
if [ $? = 0 ] ; then
local sopts="${dumpdir} ${KERNEL_DUMP_DEVICE}"
[ "${KERNEL_DUMP_COMPRESS}" = "yes" ] && sopts="-z ${sopts}"
ebegin "Saving kernel core dump in" "${dumpdir}"
savecore ${savecoreopts} >/dev/null
eend $?
fi
fi
# Sync bootlog now as /var should be mounted
if type bootlog >/dev/null 2>/dev/null ; then
bootlog sync 2>/dev/null
fi
# Make sure we insert usbcore if its a module
if [ -f /proc/modules -a ! -d /proc/bus/usb ] ; then
modprobe -q usbcore
fi
if [ -e /proc/filesystems ] ; then
# Check what USB fs the kernel support. Currently
# 2.5+ kernels, and later 2.4 kernels have 'usbfs',
# while older kernels have 'usbdevfs'.
if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ] ; then
local usbfs=$(grep -Fow usbfs /proc/filesystems ||
grep -Fow usbdevfs /proc/filesystems)
if [ -n "${usbfs}" ] ; then
ebegin "Mounting USB device filesystem (${usbfs})"
local usbgid="$(getent group usb | \
sed -e 's/.*:.*:\(.*\):.*/\1/')"
mount -t ${usbfs} \
-o ${usbgid:+devmode=0664,devgid=${usbgid},}noexec,nosuid \
usbfs /proc/bus/usb
eend $?
fi
fi
# Setup Kernel Support for the NFS daemon status
if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd ; then
if grep -qs nfsd /proc/filesystems ; then
ebegin "Mounting nfsd filesystem"
mount -t nfsd -o nodev,noexec,nosuid \
nfsd /proc/fs/nfsd
eend $?
fi
fi
# Setup Kernel Support for miscellaneous Binary Formats
if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc ; then
if grep -qs binfmt_misc /proc/filesystems ; then
ebegin "Mounting misc binary format filesystem"
mount -t binfmt_misc -o nodev,noexec,nosuid \
binfmt_misc /proc/sys/fs/binfmt_misc
eend $?
fi
fi
# Setup Kernel Support for securityfs
if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security ; then
if grep -qs securityfs /proc/filesystems ; then
ebegin "Mounting security filesystem"
mount -t securityfs securityfs /sys/kernel/security \
-o nodev,noexec,nosuid
eend $?
fi
fi
# Setup Kernel Support for debugfs
if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug ; then
if grep -qs debugfs /proc/filesystems ; then
ebegin "Mounting debug filesystem"
mount -t debugfs debugfs /sys/kernel/debug \
-o nodev,noexec,nosuid
eend $?
fi
fi
# Setup Kernel Support for SELinux
if [ -d /selinux ] && ! mountinfo -q /selinux ; then
if grep -qs selinuxfs /proc/filesystems ; then
ebegin "Mounting SELinux filesystem"
mount -t selinuxfs selinuxfs /selinux
eend $?
fi
fi
fi
# We do our swapping here instead of rc so we can get urandom started
# before us for people that like an encrypted swap.
ebegin "Activating (possible) swap"
swapon -a >/dev/null
eend 0 # If swapon has nothing todo it errors, so always return 0
# Setup any user requested dump device
if [ -x /sbin/dumpon -a -n "${KERNEL_DUMP_DEVICE}" ] ; then
ebegin "Activating kernel core dump device" "(${KERNEL_DUMP_DEVICE})"
dumpon "${KERNEL_DUMP_DEVICE}"
eend $?
fi
# Always return 0 - some local mounts may not be critical for boot # Always return 0 - some local mounts may not be critical for boot
return 0 return 0
} }
@ -170,12 +52,10 @@ stop() {
# We never unmount / or /dev or $RC_SVCDIR # We never unmount / or /dev or $RC_SVCDIR
local x= no_umounts="/|/dev|/dev/.*|${RC_SVCDIR}" local x= no_umounts="/|/dev|/dev/.*|${RC_SVCDIR}"
# NO_UMOUNTS is taken from /etc/conf.d/localmount # RC_NO_UMOUNTS is an env var that can be set by plugins
# RC_NO_UMOUNTS is taken from /etc/conf.d/rc and can also be
# set by plugins
OIFS=${IFS} SIFS=${IFS-y} OIFS=${IFS} SIFS=${IFS-y}
IFS=$IFS: IFS=$IFS:
for x in ${NO_UMOUNTS} ${RC_NO_UMOUNTS} ; do for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
no_umounts="${no_umounts}|${x}" no_umounts="${no_umounts}|${x}"
done done
if [ "${SIFS}" = "y" ] ; then if [ "${SIFS}" = "y" ] ; then
@ -184,13 +64,13 @@ stop() {
unset IFS unset IFS
fi fi
if [ "${RC_UNAME}" = "Linux" ] ; then if [ "${RC_UNAME}" = "Linux" ]; then
no_umounts="${no_umounts}|/proc|/proc/.*|/sys|/sys/.*" no_umounts="${no_umounts}|/proc|/proc/.*|/sys|/sys/.*"
fi fi
no_umounts="^(${no_umounts})$" no_umounts="^(${no_umounts})$"
# Flush all pending disk writes now # Flush all pending disk writes now
sync ; sync sync; sync
# Try to unmount all tmpfs filesystems not in use, else a deadlock may # Try to unmount all tmpfs filesystems not in use, else a deadlock may
# occure, bug #13599. # occure, bug #13599.
@ -198,22 +78,6 @@ stop() {
cd "${RC_SVCDIR}" cd "${RC_SVCDIR}"
umount -a -t tmpfs 2>/dev/null umount -a -t tmpfs 2>/dev/null
# As we're turning off swap below, we need to disable kernel dumps
[ -x /sbin/dumpon ] && dumpon off
local swap_list=
# Turn off swap
if [ -r /proc/swaps ] ;then
swap_list=$(sed -e '1d' /proc/swaps)
else
swap_list=$(swapctl -l 2>/dev/null | sed -e '1d')
fi
if [ -n "${swap_list}" ] ; then
ebegin "Deactivating swap"
swapoff -a >/dev/null
eend $?
fi
. "${RC_LIBDIR}"/sh/rc-mount.sh . "${RC_LIBDIR}"/sh/rc-mount.sh
# Umount loopback devices # Umount loopback devices
@ -228,7 +92,7 @@ stop() {
einfo "Unmounting filesystems" einfo "Unmounting filesystems"
eindent eindent
local fs= local fs=
for x in ${RC_NET_FS_LIST} ; do for x in ${net_fs_list}; do
fs="${fs}${fs:+|}${x}" fs="${fs}${fs:+|}${x}"
done done
[ -n "${fs}" ] && fs="^(${fs})$" [ -n "${fs}" ] && fs="^(${fs})$"

View File

@ -59,7 +59,7 @@ start() {
[ -x /etc/init.d/rpcbind ] && pmap="rpcbind" [ -x /etc/init.d/rpcbind ] && pmap="rpcbind"
local x= fs= local x= fs=
for x in ${RC_NET_FS_LIST}; do for x in ${net_fs_list}; do
case "${x}" in case "${x}" in
nfs|nfs4) nfs|nfs4)
# If the nfsmount script took care of the nfs filesystems, # If the nfsmount script took care of the nfs filesystems,
@ -89,7 +89,7 @@ stop() {
ebegin "Unmounting network filesystems" ebegin "Unmounting network filesystems"
. "${RC_LIBDIR}/sh/rc-mount.sh" . "${RC_LIBDIR}/sh/rc-mount.sh"
for x in ${RC_NET_FS_LIST} ; do for x in ${net_fs_list} ; do
fs="${fs}${fs:+,}${x}" fs="${fs}${fs:+,}${x}"
done done
if [ -n "${fs}" ]; then if [ -n "${fs}" ]; then
@ -98,7 +98,7 @@ stop() {
eindent eindent
fs= fs=
for x in ${RC_NET_FS_LIST}; do for x in ${net_fs_list}; do
fs="${fs}${fs:+|}${x}" fs="${fs}${fs:+|}${x}"
done done
[ -n "${fs}" ] && fs="^(${fs})$" [ -n "${fs}" ] && fs="^(${fs})$"

40
init.d/swap Normal file
View File

@ -0,0 +1,40 @@
#!/sbin/runscript
# 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.
depend() {
need localmount
}
start() {
ebegin "Activating swap"
swapon -a >/dev/null
eend 0 # If swapon has nothing todo it errors, so always return 0
}
stop() {
ebegin "Deactivating swap"
swapoff -a >/dev/null
eend 0
}

View File

@ -24,7 +24,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE. # SUCH DAMAGE.
URANDOM_SEED=${URANDOM_SEED:-/var/run/random-seed} urandom_seed=${urandom_seed:-${URANDOM_SEED:-/var/run/random-seed}}
description="Initializes the random number generator." description="Initializes the random number generator."
@ -41,22 +41,19 @@ save_seed() {
( # sub shell to prevent umask pollution ( # sub shell to prevent umask pollution
umask 077 umask 077
dd if=/dev/urandom of="${URANDOM_SEED}" count=${poolsize} 2>/dev/null dd if=/dev/urandom of="${urandom_seed}" count=${poolsize} 2>/dev/null
) )
} }
start() { start() {
[ -c /dev/urandom ] || return [ -c /dev/urandom ] || return
if [ -f "${URANDOM_SEED}" ] ; then if [ -f "${urandom_seed}" ] ; then
cat "${URANDOM_SEED}" > /dev/urandom ebegin "Initializing random number generator"
cat "${urandom_seed}" > /dev/urandom
eend $? "Error initializing random number generator"
fi fi
if ! rm -f "${URANDOM_SEED}" ; then rm -f "${urandom_seed}" && save_seed
ewarn "Skipping ${URANDOM_SEED} initialization (ro root?)" return 0
return 0
fi
ebegin "Initializing random number generator"
save_seed
eend $? "Error initializing random number generator"
} }
stop() { stop() {

View File

@ -1,4 +1,4 @@
BOOT = net.lo0 syscons BOOT = dumpon net.lo0 savecore syscons
DEFAULT = local.rc powerd syslogd DEFAULT = local.rc powerd syslogd
TOPDIR = .. TOPDIR = ..

View File

@ -1,4 +1,4 @@
BOOT = consolefont keymaps modules net.lo BOOT = consolefont keymaps modules net.lo procfs
DEFAULT = hdparm DEFAULT = hdparm
TOPDIR = .. TOPDIR = ..

View File

@ -1,4 +1,4 @@
BOOT = bootmisc checkroot checkfs clock hostname localmount rmnologin sysctl urandom BOOT = bootmisc checkroot checkfs clock hostname localmount rmnologin swap sysctl urandom
DEFAULT = local netmount DEFAULT = local netmount
LEVELDIR = $(DESTDIR)/etc/runlevels LEVELDIR = $(DESTDIR)/etc/runlevels

View File

@ -47,7 +47,7 @@ mount_svcdir() {
cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \ cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
"${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null "${RC_SVCDIR}"/nettree "${RC_LIBDIR}"/tmp 2>/dev/null
fi fi
try mdconfig -a -t malloc -s "${RC_SVCSIZE:-1024}"k -u 0 try mdconfig -a -t malloc -s "${rc_svcsize:-1024}"k -u 0
try newfs -b 4096 -i 1024 -n /dev/md0 try newfs -b 4096 -i 1024 -n /dev/md0
try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}" try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
if ${dotmp} ; then if ${dotmp} ; then
@ -60,6 +60,7 @@ mount_svcdir() {
. "${RC_LIBDIR}"/sh/init-functions.sh . "${RC_LIBDIR}"/sh/init-functions.sh
. "${RC_LIBDIR}"/sh/functions.sh . "${RC_LIBDIR}"/sh/functions.sh
[ -r /etc/rc.conf ] && . /etc/rc.conf
# Disable devd until we need it # Disable devd until we need it
[ "${RC_UNAME}" = "FreeBSD" ] && sysctl hw.bus.devctl_disable=1 >/dev/null [ "${RC_UNAME}" = "FreeBSD" ] && sysctl hw.bus.devctl_disable=1 >/dev/null

View File

@ -66,8 +66,8 @@ mount_svcdir() {
devtmp="/dev/ram1" devtmp="/dev/ram1"
fs="ext2" fs="ext2"
for x in ${devdir} ${devtmp}; do for x in ${devdir} ${devtmp}; do
try dd if=/dev/zero of="${x}" bs=1k count="${svcsize}" try dd if=/dev/zero of="${x}" bs=1k count="${rc_svcsize:-1024}"
try mkfs -t "${fs}" -i 1024 -vm0 "${x}" "${svcsize}" try mkfs -t "${fs}" -i 1024 -vm0 "${x}" "${rc_svcsize:-1024}"
done done
else else
echo echo
@ -99,12 +99,12 @@ mount_svcdir() {
fi fi
} }
_RC_GET_KV_CACHE="" _rc_get_kv_cache=""
get_KV() { get_KV() {
[ -z "${_RC_GET_KV_CACHE}" ] \ [ -z "${_rc_get_kv_cache}" ] \
&& _RC_GET_KV_CACHE="$(uname -r)" && _RC_GET_KV_CACHE="$(uname -r)"
echo "$(KV_to_int "${_RC_GET_KV_CACHE}")" echo "$(KV_to_int "${_rc_get_kv_cache}")"
return $? return $?
} }
@ -112,12 +112,13 @@ get_KV() {
. /etc/init.d/functions.sh . /etc/init.d/functions.sh
. "${RC_LIBDIR}"/sh/init-functions.sh . "${RC_LIBDIR}"/sh/init-functions.sh
. "${RC_LIBDIR}"/sh/rc-functions.sh . "${RC_LIBDIR}"/sh/rc-functions.sh
[ -r /etc/rc.conf ] && . /etc/rc.conf
# Set the console loglevel to 1 for a cleaner boot # Set the console loglevel to 1 for a cleaner boot
# the logger should anyhow dump the ring-0 buffer at start to the # the logger should anyhow dump the ring-0 buffer at start to the
# logs, and that with dmesg can be used to check for problems # logs, and that with dmesg can be used to check for problems
if [ -n "${RC_DMESG_LEVEL}" -a "${RC_SYS}" != "VPS" ]; then if [ -n "${dmesg_level}" -a "${RC_SYS}" != "VPS" ]; then
dmesg -n "${RC_DMESG_LEVEL}" dmesg -n "${dmesg_level}"
fi fi
check_statedir /proc check_statedir /proc
@ -192,14 +193,14 @@ fi
# - check boot parameters # - check boot parameters
# - make sure the required binaries exist # - make sure the required binaries exist
# - make sure the kernel has support # - make sure the kernel has support
if [ "${RC_DEVICES}" = "static" -o "${RC_SYS}" = "VPS" ]; then if [ "${rc_devices}" = "static" -o "${RC_SYS}" = "VPS" ]; then
ebegin "Using existing device nodes in /dev" ebegin "Using existing device nodes in /dev"
eend 0 eend 0
elif [ "${RC_UNAME}" = "GNU/kFreeBSD" ]; then elif [ "${RC_UNAME}" = "GNU/kFreeBSD" ]; then
ebegin "Using kFreeBSD devfs in /dev" ebegin "Using kFreeBSD devfs in /dev"
eend 0 eend 0
else else
case ${RC_DEVICES} in case ${rc_devices} in
devfs) managers="devfs udev mdev";; devfs) managers="devfs udev mdev";;
udev) managers="udev devfs mdev";; udev) managers="udev devfs mdev";;
mdev) managers="mdev udev devfs";; mdev) managers="mdev udev devfs";;
@ -235,7 +236,7 @@ for x in "devpts /dev/pts 0755 ,gid=5,mode=0620" "tmpfs /dev/shm 1777 ,nodev"; d
mountinfo -q "$2" && continue mountinfo -q "$2" && continue
if [ ! -d "$2" ] && \ if [ ! -d "$2" ] && \
[ "${devfs}" = "yes" -o "${udev}" = "yes" ]; then [ "${m}" = "devfs" -o "${m}" = "udev" ]; then
mkdir -m "$3" -p "$2" >/dev/null 2>/dev/null || \ mkdir -m "$3" -p "$2" >/dev/null 2>/dev/null || \
ewarn "Could not create $2!" ewarn "Could not create $2!"
fi fi

View File

@ -1,7 +1,7 @@
DIR = $(RC_LIB)/sh DIR = $(RC_LIB)/sh
CONF = functions.sh init-functions.sh init-common-post.sh \ INC = functions.sh init-functions.sh init-common-post.sh \
rc-functions.sh rc-mount.sh rc-functions.sh rc-mount.sh
BIN = gendepends.sh net.sh rc-mount.sh rc-help.sh runscript.sh BIN = gendepends.sh net.sh rc-mount.sh rc-help.sh runscript.sh
TOPDIR = .. TOPDIR = ..
include $(TOPDIR)/default.mk include $(TOPDIR)/default.mk

View File

@ -77,12 +77,12 @@ for SVCNAME in * ; do
depend depend
# Add any user defined depends # Add any user defined depends
config ${RC_CONFIG} config ${rc_config} ${RC_CONFIG}
need ${RC_NEED} need ${rc_need} ${RC_NEED}
use ${RC_USE} use ${rc_use} ${RC_USE}
before ${RC_BEFORE} before ${rc_before} ${RC_BEFORE}
after ${RC_AFTER} after ${rc_after} ${RC_AFTER}
provide ${RC_PROVIDE} provide ${rc_provide} ${RC_PROVIDE}
fi fi
) )
done done

View File

@ -63,9 +63,13 @@ check_statedir() {
#splash "critical" & #splash "critical" &
echo echo
eerror "To function properly, \"$1\" needs to exist." eerror "To function properly, \"$1\" needs to exist."
if yesno ${RC_FORCE_AUTO}; then if yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then
eerror "Attempting to create \"$1\" for you ..." eerror "Attempting to create \"$1\" for you ..."
mount -o remount,rw / if [ "${RC_UNAME}" = "Linux" ]; then
mount -o remount,rw /
else
mount -u -o rw /
fi
mkdir -p "$1" mkdir -p "$1"
fi fi
if [ ! -d "$1" ] ; then if [ ! -d "$1" ] ; then

View File

@ -45,6 +45,7 @@ stop_addon() {
( import_addon "$1-stop" ) ( import_addon "$1-stop" )
} }
net_fs_list="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
is_net_fs() { is_net_fs() {
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
@ -54,7 +55,7 @@ is_net_fs() {
# Fall back on fs types # Fall back on fs types
local t=$(mountinfo --fstype "$1") local t=$(mountinfo --fstype "$1")
for x in ${RC_NET_FS_LIST}; do for x in ${net_fs_list}; do
[ "${x}" = "${t}" ] && return 0 [ "${x}" = "${t}" ] && return 0
done done
return 1 return 1

View File

@ -146,7 +146,7 @@ if yesno ${BE_VERBOSE}; then
printf " printf "
${CYAN}Dependencies:${OFF} ${CYAN}Dependencies:${OFF}
This is the heart of the Gentoo RC-Scripts, as it determines the order This is the heart of the OpenRC, as it determines the order
in which services gets started, and also to some extend what services in which services gets started, and also to some extend what services
get started in the first place. get started in the first place.
@ -252,9 +252,7 @@ printf "
" "
fi fi
printf " /etc/conf.d/rc printf " /etc/conf.d/${SERVICE}
/etc/conf.d/rc.\${RC_SOFTLEVEL}
/etc/conf.d/${SERVICE}
/etc/conf.d/${SERVICE}.\${RC_SOFTLEVEL} /etc/conf.d/${SERVICE}.\${RC_SOFTLEVEL}
/etc/rc.conf /etc/rc.conf
\${RC_SOFTLEVEL} denotes the name of the runlevel" \${RC_SOFTLEVEL} denotes the name of the runlevel"
@ -263,8 +261,8 @@ if yesno ${BE_VERBOSE}; then
printf " printf "
You can add extra dependencies to ${SERVICE} by adding some variables to You can add extra dependencies to ${SERVICE} by adding some variables to
/etc/conf.d/${SERVICE} /etc/conf.d/${SERVICE}
RC_NEED=\"openvpn ntpd\" rc_need=\"openvpn ntpd\"
RC_USE=\"dns\" rc_use=\"dns\"
This makes ${SERVICE} need openvpn and ntpd, while it just uses dns. This makes ${SERVICE} need openvpn and ntpd, while it just uses dns.

View File

@ -59,18 +59,18 @@ describe() {
done done
} }
yesno ${RC_DEBUG} && set -x yesno ${rc_debug} && set -x
# If we're net.eth0 or openvpn.work then load net or openvpn config # If we're net.eth0 or openvpn.work then load net or openvpn config
rc_c=${SVCNAME%%.*} _c=${SVCNAME%%.*}
if [ -n "${rc_c}" -a "${rc_c}" != "${SVCNAME}" ]; then if [ -n "${_c}" -a "${_c}" != "${SVCNAME}" ]; then
if [ -e "/etc/conf.d/${rc_c}.${RC_SOFTLEVEL}" ]; then if [ -e "/etc/conf.d/${_c}.${RC_SOFTLEVEL}" ]; then
. "/etc/conf.d/${rc_c}.${RC_SOFTLEVEL}" . "/etc/conf.d/${_c}.${RC_SOFTLEVEL}"
elif [ -e "/etc/conf.d/${rc_c}" ]; then elif [ -e "/etc/conf.d/${_c}" ]; then
. "/etc/conf.d/${rc_c}" . "/etc/conf.d/${_c}"
fi fi
fi fi
unset rc_c unset _c
# Overlay with our specific config # Overlay with our specific config
if [ -e "/etc/conf.d/${SVCNAME}.${RC_SOFTLEVEL}" ]; then if [ -e "/etc/conf.d/${SVCNAME}.${RC_SOFTLEVEL}" ]; then
@ -83,7 +83,7 @@ fi
[ -e /etc/rc.conf ] && . /etc/rc.conf [ -e /etc/rc.conf ] && . /etc/rc.conf
# Apply any ulimit defined # Apply any ulimit defined
[ -n "${RC_ULIMIT}" ] && ulimit ${RC_ULIMIT} [ -n "${rc_ulimit:-${RC_ULIMIT}}" ] && ulimit ${rc_ulimit:-${RC_ULIMIT}}
# Load our script # Load our script
. $1 . $1
@ -128,10 +128,10 @@ fi
while [ -n "$1" ]; do while [ -n "$1" ]; do
# See if we have the required function and run it # See if we have the required function and run it
for rc_x in describe start stop ${extra_commands:-${opts}}; do for _cmd in describe start stop ${extra_commands:-${opts}}; do
if [ "${rc_x}" = "$1" ]; then if [ "${_cmd}" = "$1" ]; then
if type "$1" >/dev/null 2>&1; then if type "$1" >/dev/null 2>&1; then
unset rc_x unset _cmd
if type "$1"_pre >/dev/null 2>&1; then if type "$1"_pre >/dev/null 2>&1; then
"$1"_pre || exit $? "$1"_pre || exit $?
fi fi
@ -142,7 +142,7 @@ while [ -n "$1" ]; do
shift shift
continue 2 continue 2
else else
if [ "${rc_x}" = "start" -o "${rc_x}" = "stop" ]; then if [ "${_cmd}" = "start" -o "${_cmd}" = "stop" ]; then
exit 0 exit 0
else else
eerror "${SVCNAME}: function \`$1' defined but does not exist" eerror "${SVCNAME}: function \`$1' defined but does not exist"

View File

@ -205,7 +205,7 @@ int fstabinfo (int argc, char **argv)
} }
/* No point in outputting if quiet */ /* No point in outputting if quiet */
if (rc_env_bool ("RC_QUIET")) if (rc_yesno (getenv ("RC_QUIET")))
continue; continue;
switch (output) { switch (output) {

View File

@ -32,33 +32,28 @@
#include "librc.h" #include "librc.h"
bool rc_env_bool (const char *var) bool rc_yesno (const char *value)
{ {
char *v; if (! value) {
errno = EINVAL;
if (! var)
return (false);
if (! (v = getenv (var))) {
errno = ENOENT;
return (false); return (false);
} }
if (strcasecmp (v, "true") == 0 || if (strcasecmp (value, "yes") == 0 ||
strcasecmp (v, "y") == 0 || strcasecmp (value, "y") == 0 ||
strcasecmp (v, "yes") == 0 || strcasecmp (value, "true") == 0 ||
strcasecmp (v, "1") == 0) strcasecmp (value, "1") == 0)
return (true); return (true);
if (strcasecmp (v, "false") != 0 && if (strcasecmp (value, "no") != 0 &&
strcasecmp (v, "n") != 0 && strcasecmp (value, "n") != 0 &&
strcasecmp (v, "no") != 0 && strcasecmp (value, "false") != 0 &&
strcasecmp (v, "0") != 0) strcasecmp (value, "0") != 0)
errno = EINVAL; errno = EINVAL;
return (false); return (false);
} }
librc_hidden_def(rc_env_bool) librc_hidden_def(rc_yesno)
char *rc_strcatpaths (const char *path1, const char *paths, ...) char *rc_strcatpaths (const char *path1, const char *paths, ...)
{ {

View File

@ -81,7 +81,6 @@ librc_hidden_proto(rc_deptree_load)
librc_hidden_proto(rc_deptree_order) librc_hidden_proto(rc_deptree_order)
librc_hidden_proto(rc_deptree_update) librc_hidden_proto(rc_deptree_update)
librc_hidden_proto(rc_deptree_update_needed) librc_hidden_proto(rc_deptree_update_needed)
librc_hidden_proto(rc_env_bool)
librc_hidden_proto(rc_find_pids) librc_hidden_proto(rc_find_pids)
librc_hidden_proto(rc_runlevel_exists) librc_hidden_proto(rc_runlevel_exists)
librc_hidden_proto(rc_runlevel_get) librc_hidden_proto(rc_runlevel_get)
@ -123,5 +122,6 @@ librc_hidden_proto(rc_strlist_delete)
librc_hidden_proto(rc_strlist_free) librc_hidden_proto(rc_strlist_free)
librc_hidden_proto(rc_strlist_join) librc_hidden_proto(rc_strlist_join)
librc_hidden_proto(rc_strlist_reverse) librc_hidden_proto(rc_strlist_reverse)
librc_hidden_proto(rc_yesno)
#endif #endif

View File

@ -365,6 +365,7 @@ int mountinfo (int argc, char **argv)
char *n; char *n;
int opt; int opt;
int result; int result;
bool quiet;
#define DO_REG(_var) \ #define DO_REG(_var) \
if (_var) free (_var); \ if (_var) free (_var); \
@ -442,12 +443,13 @@ int mountinfo (int argc, char **argv)
rc_strlist_reverse (nodes); rc_strlist_reverse (nodes);
result = EXIT_FAILURE; result = EXIT_FAILURE;
quiet = rc_yesno (getenv ("RC_QUIET"));
STRLIST_FOREACH (nodes, n, i) { STRLIST_FOREACH (nodes, n, i) {
if (point_regex && regexec (point_regex, n, 0, NULL, 0) != 0) if (point_regex && regexec (point_regex, n, 0, NULL, 0) != 0)
continue; continue;
if (skip_point_regex && regexec (skip_point_regex, n, 0, NULL, 0) == 0) if (skip_point_regex && regexec (skip_point_regex, n, 0, NULL, 0) == 0)
continue; continue;
if (! rc_env_bool ("RC_QUIET")) if (! quiet)
printf ("%s\n", n); printf ("%s\n", n);
result = EXIT_SUCCESS; result = EXIT_SUCCESS;
} }

View File

@ -150,7 +150,7 @@ void rc_logger_open (const char *level)
if (! isatty (STDOUT_FILENO)) if (! isatty (STDOUT_FILENO))
return; return;
if (! rc_env_bool ("RC_LOGGER")) if (! rc_conf_yesno ("rc_logger"))
return; return;
if (pipe (signal_pipe) == -1) if (pipe (signal_pipe) == -1)

View File

@ -38,6 +38,7 @@
#endif #endif
#include <sys/utsname.h> #include <sys/utsname.h>
#include <ctype.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -50,10 +51,49 @@
#define PROFILE_ENV "/etc/profile.env" #define PROFILE_ENV "/etc/profile.env"
#define SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist" #define SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist"
#define USR_WHITELIST "/etc/conf.d/env_whitelist" #define USR_WHITELIST "/etc/conf.d/env_whitelist"
#define RC_CONFIG "/etc/conf.d/rc" #define RC_CONF "/etc/rc.conf"
#define RC_CONF_OLD "/etc/conf.d/rc"
#define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin" #define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
static char **rc_conf = NULL;
static void _free_rc_conf (void)
{
rc_strlist_free (rc_conf);
}
bool rc_conf_yesno (const char *setting)
{
if (! rc_conf) {
char *line;
int i;
rc_conf = rc_config_load (RC_CONF);
atexit (_free_rc_conf);
/* Support old configs */
if (exists (RC_CONF_OLD)) {
char **old = rc_config_load (RC_CONF_OLD);
rc_strlist_join (&rc_conf, old);
rc_strlist_free (old);
}
/* Convert old uppercase to lowercase */
STRLIST_FOREACH (rc_conf, line, i) {
char *p = line;
while (p && *p && *p != '=') {
if (isupper (*p))
*p = tolower (*p);
p++;
}
}
}
return (rc_yesno (rc_config_value (rc_conf, setting)));
}
char **env_filter (void) char **env_filter (void)
{ {
char **env = NULL; char **env = NULL;
@ -64,10 +104,10 @@ char **env_filter (void)
bool got_path = false; bool got_path = false;
char *env_var; char *env_var;
int env_len; int env_len;
char *p;
char *token; char *token;
char *sep; char *sep;
char *e; char *e;
char *p;
int pplen = strlen (PATH_PREFIX); int pplen = strlen (PATH_PREFIX);
whitelist = rc_config_list (SYS_WHITELIST); whitelist = rc_config_list (SYS_WHITELIST);
@ -195,45 +235,14 @@ char **env_config (void)
char **env = NULL; char **env = NULL;
char *line; char *line;
int i; int i;
char *p;
char **config;
char *e;
#ifdef __linux__ #ifdef __linux__
char sys[6]; char sys[6];
#endif #endif
struct utsname uts; struct utsname uts;
bool has_net_fs_list = false;
FILE *fp; FILE *fp;
char buffer[PATH_MAX]; char buffer[PATH_MAX];
char *runlevel = rc_runlevel_get (); char *runlevel = rc_runlevel_get ();
/* Don't trust environ for softlevel yet */
snprintf (buffer, PATH_MAX, "%s.%s", RC_CONFIG, runlevel);
if (exists (buffer))
config = rc_config_load (buffer);
else
config = rc_config_load (RC_CONFIG);
STRLIST_FOREACH (config, line, i) {
p = strchr (line, '=');
if (! p)
continue;
*p = 0;
e = getenv (line);
if (! e) {
*p = '=';
rc_strlist_add (&env, line);
} else {
int len = strlen (line) + strlen (e) + 2;
char *new = xmalloc (sizeof (char) * len);
snprintf (new, len, "%s=%s", line, e);
rc_strlist_add (&env, new);
free (new);
}
}
rc_strlist_free (config);
/* One char less to drop the trailing / */ /* One char less to drop the trailing / */
i = strlen ("RC_LIBDIR=") + strlen (RC_LIBDIR) + 1; i = strlen ("RC_LIBDIR=") + strlen (RC_LIBDIR) + 1;
line = xmalloc (sizeof (char) * i); line = xmalloc (sizeof (char) * i);
@ -304,21 +313,6 @@ char **env_config (void)
#endif #endif
/* Only add a NET_FS list if not defined */
STRLIST_FOREACH (env, line, i)
if (strncmp (line, "RC_NET_FS_LIST=", strlen ("RC_NET_FS_LIST=")) == 0) {
has_net_fs_list = true;
break;
}
if (! has_net_fs_list) {
i = strlen ("RC_NET_FS_LIST=") + strlen (RC_NET_FS_LIST_DEFAULT) + 1;
line = xmalloc (sizeof (char) * i);
snprintf (line, i, "RC_NET_FS_LIST=%s", RC_NET_FS_LIST_DEFAULT);
rc_strlist_add (&env, line);
free (line);
}
/* Some scripts may need to take a different code path if Linux/FreeBSD, etc /* Some scripts may need to take a different code path if Linux/FreeBSD, etc
To save on calling uname, we store it in an environment variable */ To save on calling uname, we store it in an environment variable */
if (uname (&uts) == 0) { if (uname (&uts) == 0) {

View File

@ -64,9 +64,6 @@
/* Max buffer to read a line from a file */ /* Max buffer to read a line from a file */
#define RC_LINEBUFFER 4096 #define RC_LINEBUFFER 4096
/* Good defaults just incase user has none set */
#define RC_NET_FS_LIST_DEFAULT "afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"
#define ERRX fprintf (stderr, "out of memory\n"); exit (1) #define ERRX fprintf (stderr, "out of memory\n"); exit (1)
static inline void *xmalloc (size_t size) static inline void *xmalloc (size_t size)
@ -113,6 +110,7 @@ static inline bool exists (const char *pathname)
return (stat (pathname, &buf) == 0); return (stat (pathname, &buf) == 0);
} }
bool rc_conf_yesno (const char *var);
char **env_filter (void); char **env_filter (void);
char **env_config (void); char **env_config (void);

View File

@ -82,7 +82,7 @@ static void print_service (char *service)
} else } else
snprintf (status, sizeof (status), " stopped "); snprintf (status, sizeof (status), " stopped ");
if (isatty (fileno (stdout)) && ! rc_env_bool ("RC_NOCOLOR")) if (isatty (fileno (stdout)) && ! rc_yesno (getenv ("RC_NOCOLOR")))
printf ("\n"); printf ("\n");
ebracket (cols, color, status); ebracket (cols, color, status);
} }

View File

@ -185,7 +185,7 @@ int rc_update (int argc, char **argv)
} }
} }
verbose = rc_env_bool ("RC_VERBOSE"); verbose = rc_yesno (getenv ("RC_VERBOSE"));
if ((action & DOSHOW && action != DOSHOW) || if ((action & DOSHOW && action != DOSHOW) ||
(action & DOADD && action != DOADD) || (action & DOADD && action != DOADD) ||

View File

@ -492,6 +492,8 @@ static char read_key (bool block)
static bool want_interactive (void) static bool want_interactive (void)
{ {
char c; char c;
static bool gotinteractive;
static bool interactive;
if (PREVLEVEL && if (PREVLEVEL &&
strcmp (PREVLEVEL, "N") != 0 && strcmp (PREVLEVEL, "N") != 0 &&
@ -499,7 +501,11 @@ static bool want_interactive (void)
strcmp (PREVLEVEL, "1") != 0) strcmp (PREVLEVEL, "1") != 0)
return (false); return (false);
if (! rc_env_bool ("RC_INTERACTIVE")) if (! gotinteractive) {
gotinteractive = true;
interactive = rc_conf_yesno ("rc_interactive");
}
if (! interactive)
return (false); return (false);
c = read_key (false); c = read_key (false);
@ -793,6 +799,7 @@ int main (int argc, char **argv)
int opt; int opt;
DIR *dp; DIR *dp;
struct dirent *d; struct dirent *d;
bool parallel;
atexit (cleanup); atexit (cleanup);
if (argv[0]) if (argv[0])
@ -982,7 +989,7 @@ int main (int argc, char **argv)
ecolor (ECOLOR_GOOD), ecolor (ECOLOR_BRACKET), ecolor (ECOLOR_GOOD), ecolor (ECOLOR_BRACKET),
ecolor (ECOLOR_NORMAL)); ecolor (ECOLOR_NORMAL));
if (rc_env_bool ("RC_INTERACTIVE")) if (rc_conf_yesno ("rc_interactive"))
printf ("Press %sI%s to enter interactive boot mode\n\n", printf ("Press %sI%s to enter interactive boot mode\n\n",
ecolor (ECOLOR_GOOD), ecolor (ECOLOR_NORMAL)); ecolor (ECOLOR_GOOD), ecolor (ECOLOR_NORMAL));
@ -1156,7 +1163,7 @@ int main (int argc, char **argv)
if (newlevel && strcmp (newlevel, bootlevel) == 0 && if (newlevel && strcmp (newlevel, bootlevel) == 0 &&
(strcmp (runlevel, RC_LEVEL_SINGLE) == 0 || (strcmp (runlevel, RC_LEVEL_SINGLE) == 0 ||
strcmp (runlevel, RC_LEVEL_SYSINIT) == 0) && strcmp (runlevel, RC_LEVEL_SYSINIT) == 0) &&
rc_env_bool ("RC_COLDPLUG")) rc_conf_yesno ("rc_coldplug"))
{ {
#if defined(__DragonFly__) || defined(__FreeBSD__) #if defined(__DragonFly__) || defined(__FreeBSD__)
/* The net interfaces are easy - they're all in net /dev/net :) */ /* The net interfaces are easy - they're all in net /dev/net :) */
@ -1263,6 +1270,8 @@ int main (int argc, char **argv)
if (going_down) if (going_down)
rc_runlevel_set (newlevel); rc_runlevel_set (newlevel);
parallel = rc_conf_yesno ("rc_parallel");
/* Now stop the services that shouldn't be running */ /* Now stop the services that shouldn't be running */
STRLIST_FOREACH (stop_services, service, i) { STRLIST_FOREACH (stop_services, service, i) {
bool found = false; bool found = false;
@ -1278,7 +1287,7 @@ int main (int argc, char **argv)
/* We always stop the service when in these runlevels */ /* We always stop the service when in these runlevels */
if (going_down) { if (going_down) {
pid_t pid = rc_service_stop (service); pid_t pid = rc_service_stop (service);
if (pid > 0 && ! rc_env_bool ("RC_PARALLEL")) if (pid > 0 && ! parallel)
rc_waitpid (pid); rc_waitpid (pid);
continue; continue;
} }
@ -1348,7 +1357,7 @@ int main (int argc, char **argv)
if ((pid = rc_service_stop (service)) > 0) { if ((pid = rc_service_stop (service)) > 0) {
add_pid (pid); add_pid (pid);
if (! rc_env_bool ("RC_PARALLEL")) { if (! parallel) {
rc_waitpid (pid); rc_waitpid (pid);
remove_pid (pid); remove_pid (pid);
} }
@ -1448,7 +1457,7 @@ interactive_option:
if ((pid = rc_service_start (service)) > 0) { if ((pid = rc_service_start (service)) > 0) {
add_pid (pid); add_pid (pid);
if (! rc_env_bool ("RC_PARALLEL")) { if (! parallel) {
rc_waitpid (pid); rc_waitpid (pid);
remove_pid (pid); remove_pid (pid);
} }

View File

@ -353,12 +353,12 @@ char **rc_config_load (const char *file);
/*! Return the value of the entry from a key=value list. */ /*! Return the value of the entry from a key=value list. */
char *rc_config_value (char **list, const char *entry); char *rc_config_value (char **list, const char *entry);
/*! Check if an environment variable is a boolean and return it's value. /*! Check if a variable is a boolean and return it's value.
* If variable is not a boolean then we set errno to be ENOENT when it does * If variable is not a boolean then we set errno to be ENOENT when it does
* not exist or EINVAL if it's not a boolean. * not exist or EINVAL if it's not a boolean.
* @param variable to check * @param variable to check
* @return true if it matches true, yes or 1, false if otherwise. */ * @return true if it matches true, yes or 1, false if otherwise. */
bool rc_env_bool (const char *variable); bool rc_yesno (const char *variable);
/*! @name String List functions /*! @name String List functions
* Handy functions for dealing with string arrays of char **. * Handy functions for dealing with string arrays of char **.

View File

@ -9,7 +9,6 @@ global:
rc_deptree_order; rc_deptree_order;
rc_deptree_update; rc_deptree_update;
rc_deptree_update_needed; rc_deptree_update_needed;
rc_env_bool;
rc_environ_fd; rc_environ_fd;
rc_find_pids; rc_find_pids;
rc_runlevel_exists; rc_runlevel_exists;
@ -52,6 +51,7 @@ global:
rc_strlist_free; rc_strlist_free;
rc_strlist_join; rc_strlist_join;
rc_strlist_reverse; rc_strlist_reverse;
rc_yesno;
local: local:
*; *;

View File

@ -590,7 +590,7 @@ static void svc_start (bool deps)
state = rc_service_state (service); state = rc_service_state (service);
if (rc_env_bool ("IN_HOTPLUG") || in_background) { if (rc_yesno (getenv ("IN_HOTPLUG")) || in_background) {
if (! state & RC_SERVICE_INACTIVE && if (! state & RC_SERVICE_INACTIVE &&
! state & RC_SERVICE_STOPPED) ! state & RC_SERVICE_STOPPED)
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@ -615,7 +615,7 @@ static void svc_start (bool deps)
hook_out = RC_HOOK_SERVICE_START_OUT; hook_out = RC_HOOK_SERVICE_START_OUT;
rc_plugin_run (RC_HOOK_SERVICE_START_IN, applet); rc_plugin_run (RC_HOOK_SERVICE_START_IN, applet);
if (rc_env_bool ("RC_DEPEND_STRICT")) if (rc_conf_yesno ("rc_depend_strict"))
depoptions |= RC_DEP_STRICT; depoptions |= RC_DEP_STRICT;
if (rc_runlevel_starting ()) if (rc_runlevel_starting ())
@ -651,7 +651,7 @@ static void svc_start (bool deps)
STRLIST_FOREACH (use_services, svc, i) STRLIST_FOREACH (use_services, svc, i)
if (rc_service_state (svc) & RC_SERVICE_STOPPED) { if (rc_service_state (svc) & RC_SERVICE_STOPPED) {
pid_t pid = rc_service_start (svc); pid_t pid = rc_service_start (svc);
if (! rc_env_bool ("RC_PARALLEL")) if (! rc_conf_yesno ("rc_parallel"))
rc_waitpid (pid); rc_waitpid (pid);
} }
} }
@ -805,7 +805,7 @@ static void svc_stop (bool deps)
state & RC_SERVICE_FAILED) state & RC_SERVICE_FAILED)
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
if (rc_env_bool ("IN_HOTPLUG") || in_background) if (rc_yesno (getenv ("IN_HOTPLUG")) || in_background)
if (! (state & RC_SERVICE_STARTED) && if (! (state & RC_SERVICE_STARTED) &&
! (state & RC_SERVICE_INACTIVE)) ! (state & RC_SERVICE_INACTIVE))
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
@ -833,7 +833,7 @@ static void svc_stop (bool deps)
char *svc; char *svc;
int i; int i;
if (rc_env_bool ("RC_DEPEND_STRICT")) if (rc_conf_yesno ("RC_DEPEND_STRICT"))
depoptions |= RC_DEP_STRICT; depoptions |= RC_DEP_STRICT;
if (rc_runlevel_stopping ()) if (rc_runlevel_stopping ())
@ -859,7 +859,7 @@ static void svc_stop (bool deps)
svcs & RC_SERVICE_INACTIVE) svcs & RC_SERVICE_INACTIVE)
{ {
pid_t pid = rc_service_stop (svc); pid_t pid = rc_service_stop (svc);
if (! rc_env_bool ("RC_PARALLEL")) if (! rc_conf_yesno ("rc_parallel"))
rc_waitpid (pid); rc_waitpid (pid);
rc_strlist_add (&tmplist, svc); rc_strlist_add (&tmplist, svc);
} }
@ -1087,7 +1087,7 @@ int runscript (int argc, char **argv)
setenv ("RC_RUNSCRIPT_PID", pid, 1); setenv ("RC_RUNSCRIPT_PID", pid, 1);
/* eprefix is kinda klunky, but it works for our purposes */ /* eprefix is kinda klunky, but it works for our purposes */
if (rc_env_bool ("RC_PARALLEL")) { if (rc_conf_yesno ("rc_parallel")) {
int l = 0; int l = 0;
int ll; int ll;
@ -1137,13 +1137,13 @@ int runscript (int argc, char **argv)
/* Save the IN_BACKGROUND env flag so it's ONLY passed to the service /* Save the IN_BACKGROUND env flag so it's ONLY passed to the service
that is being called and not any dependents */ that is being called and not any dependents */
if (getenv ("IN_BACKGROUND")) { if (getenv ("IN_BACKGROUND")) {
in_background = rc_env_bool ("IN_BACKGROUND");
ibsave = xstrdup (getenv ("IN_BACKGROUND")); ibsave = xstrdup (getenv ("IN_BACKGROUND"));
in_background = rc_yesno (ibsave);
unsetenv ("IN_BACKGROUND"); unsetenv ("IN_BACKGROUND");
} }
if (rc_env_bool ("IN_HOTPLUG")) { if (rc_yesno (getenv ("IN_HOTPLUG"))) {
if (! rc_env_bool ("RC_HOTPLUG") || ! rc_service_plugable (applet)) if (! rc_conf_yesno ("rc_hotplug") || ! rc_service_plugable (applet))
eerrorx ("%s: not allowed to be hotplugged", applet); eerrorx ("%s: not allowed to be hotplugged", applet);
} }
@ -1197,7 +1197,7 @@ int runscript (int argc, char **argv)
const char *t[] = { optarg, NULL }; const char *t[] = { optarg, NULL };
const char *s[] = { applet, NULL }; const char *s[] = { applet, NULL };
if (rc_env_bool ("RC_DEPEND_STRICT")) if (rc_conf_yesno ("rc_depend_strict"))
depoptions |= RC_DEP_STRICT; depoptions |= RC_DEP_STRICT;
if (! deptree && ((deptree = _rc_deptree_load ()) == NULL)) if (! deptree && ((deptree = _rc_deptree_load ()) == NULL))

View File

@ -708,8 +708,8 @@ int start_stop_daemon (int argc, char **argv)
case_RC_COMMON_GETOPT case_RC_COMMON_GETOPT
} }
quiet = rc_env_bool ("RC_QUIET"); quiet = rc_yesno (getenv ("RC_QUIET"));
verbose = rc_env_bool ("RC_VERBOSE"); verbose = rc_yesno (getenv ("RC_VERBOSE"));
/* Allow start-stop-daemon --signal HUP --exec /usr/sbin/dnsmasq /* Allow start-stop-daemon --signal HUP --exec /usr/sbin/dnsmasq
* instead of forcing --stop --oknodo as well */ * instead of forcing --stop --oknodo as well */