Adopt a more C style for scripts and remove vim settings.
This commit is contained in:
		| @@ -5,12 +5,14 @@ | ||||
| extra_commands="reset" | ||||
| hostid_file=${hostid_file:-/etc/hostid} | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need checkroot | ||||
| 	before devd net | ||||
| } | ||||
|  | ||||
| _set() { | ||||
| _set() | ||||
| { | ||||
| 	local id=0 | ||||
|  | ||||
| 	if [ -n "$1" ]; then | ||||
| @@ -33,7 +35,8 @@ _set() { | ||||
| # First we check to see if there is a system UUID | ||||
| # If so then we use that and erase the hostid file, | ||||
| # otherwise we generate a random UUID. | ||||
| reset() { | ||||
| reset() | ||||
| { | ||||
| 	local uuid=$(kenv smbios.system.uuid 2>/dev/null) | ||||
| 	local x="[0-9a-f]" | ||||
| 	local y="${x}${x}${x}${x}" | ||||
| @@ -68,6 +71,7 @@ start() | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	_set | ||||
| } | ||||
|   | ||||
| @@ -4,29 +4,34 @@ | ||||
|  | ||||
| extra_commands="restore" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount  | ||||
| } | ||||
|  | ||||
| restore() { | ||||
| restore() | ||||
| { | ||||
| 	local mixer= retval=0 | ||||
| 	ebegin "Restoring mixer settings" | ||||
| 	eindent | ||||
| 	for mixer in /dev/mixer*; do | ||||
| 		if [ -r "/var/db/${mixer#/dev/}-state" ]; then | ||||
| 			vebegin "${mixer}" | ||||
| 			mixer -f "${mixer}" $(cat "/var/db/${mixer#/dev/}-state") >/dev/null | ||||
| 			mixer -f "${mixer}" \ | ||||
| 			$(cat "/var/db/${mixer#/dev/}-state") >/dev/null | ||||
| 			veend $? | ||||
| 			: $((retval += $?)) | ||||
| 		fi | ||||
| 	done | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	restore | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	local mixer= retval=0 | ||||
| 	ebegin "Saving mixer settings" | ||||
| 	eindent | ||||
|   | ||||
| @@ -12,12 +12,14 @@ fi | ||||
| name="Console Mouse Daemon" | ||||
| [ -n "${moused_device}" ] && name="${name} (${moused_device})" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	after bootmisc | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	ebegin "Starting ${name}"  | ||||
|  | ||||
| 	if [ -z "${moused_device}" ]; then | ||||
| @@ -57,5 +59,3 @@ start() { | ||||
| 	 | ||||
| 	eend ${retval} "Failed to start moused" | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,11 +4,13 @@ | ||||
|  | ||||
| required_files="/etc/newsyslog.conf" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	ebegin "Creating and/or trimming log files" | ||||
| 	newsyslog ${newsyslog_args} | ||||
| 	eend $? | ||||
|   | ||||
| @@ -7,13 +7,15 @@ command_args=${powerd_args} | ||||
| pidfile=/var/run/powerd.pid | ||||
| name="Power Control Daemon" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	use logger | ||||
| 	after bootmisc | ||||
| } | ||||
|  | ||||
| start_pre() { | ||||
| start_pre() | ||||
| { | ||||
| 	if [ -n "${powerd_battery_mode}" ]; then | ||||
| 		command_args="${command_args} -b ${powerd_battery_mode}" | ||||
| 	fi | ||||
|   | ||||
| @@ -15,7 +15,8 @@ else | ||||
| fi | ||||
| command_background="YES" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	after bootmisc | ||||
|  | ||||
|   | ||||
| @@ -2,13 +2,15 @@ | ||||
| # Copyright 2007-2008 Roy Marples | ||||
| # All rights reserved | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount net | ||||
| 	after * | ||||
| 	before local | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	ebegin "Starting local rc services" | ||||
| 	local svc= enabled= retval=0 service= | ||||
| 	for svc in $(rcorder /etc/rc.d/* /usr/local/etc/rc.d/* 2>/dev/null); do | ||||
| @@ -37,7 +39,8 @@ start() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	ebegin "Stopping local rc services" | ||||
| 	local svc= retval=0 | ||||
| 	for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do | ||||
|   | ||||
| @@ -6,14 +6,16 @@ command=/usr/sbin/rpcbind | ||||
| command_args=${rpcbind_args} | ||||
| name="RPC program number mapper" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	provide rpc | ||||
| 	need localmount | ||||
| 	use net logger dns | ||||
| 	before inetd xinetd ntpd ntp-client | ||||
| } | ||||
|  | ||||
| stop_post() { | ||||
| stop_post() | ||||
| { | ||||
| 	# rpcbind returns too fast, so sleep for a second | ||||
| 	sleep 1 | ||||
| } | ||||
|   | ||||
| @@ -4,12 +4,14 @@ | ||||
|  | ||||
| description="Saves a kernel dump." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need checkfs | ||||
| 	before swap | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	local dump_dir=${dump_dir:-/var/crash} | ||||
| 	if ! [ -d "${dump_dir}" ]; then | ||||
| 		mkdir -p "${dump_dir}" | ||||
|   | ||||
| @@ -2,12 +2,14 @@ | ||||
| # Copyright 2007-2008 Roy Marples | ||||
| # All rights reserved | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	use hostname | ||||
| 	before bootmisc logger | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	[ -e /etc/sysctl.conf ] || return 0 | ||||
| 	 | ||||
| 	ebegin "Configuring kernel parameters" | ||||
|   | ||||
| @@ -7,7 +7,8 @@ command_args=${syslogd_args} | ||||
| pidfile=/var/run/syslog.pid | ||||
| name="System Logger Daemon" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	provide logger | ||||
| 	use net | ||||
| 	need localmount | ||||
|   | ||||
| @@ -21,7 +21,8 @@ else | ||||
| 	utc_cmd="--localtime" | ||||
| fi | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	if yesno ${clock_adjfile}; then | ||||
| 		use checkroot | ||||
| 	else | ||||
| @@ -29,7 +30,8 @@ depend() { | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| setupopts() { | ||||
| setupopts() | ||||
| { | ||||
| 	case "${RC_SYS}" in | ||||
| 		UML|VPS|XENU) | ||||
| 			utc="${RC_SYS}" | ||||
| @@ -55,7 +57,8 @@ setupopts() { | ||||
| } | ||||
|  | ||||
| # hwclock doesn't always return non zero on error | ||||
| _hwclock() { | ||||
| _hwclock() | ||||
| { | ||||
| 	local err="$(hwclock "$@" 2>&1 >/dev/null)" | ||||
|  | ||||
| 	[ -z "${err}" ] && return 0 | ||||
| @@ -63,7 +66,8 @@ _hwclock() { | ||||
| 	return 1 | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	local retval=0 errstr="" | ||||
| 	setupopts | ||||
|  | ||||
| @@ -97,7 +101,8 @@ start() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	# Don't tweak the hardware clock on LiveCD halt. | ||||
| 	[ -n "${CDBOOT}" ] && return 0 | ||||
| 	yesno ${clock_systohc} || return 0 | ||||
| @@ -122,14 +127,14 @@ stop() { | ||||
| 	eend ${retval} "Failed to sync clocks"  | ||||
| } | ||||
|  | ||||
| save() { | ||||
| save() | ||||
| { | ||||
| 	clock_systohc="yes" | ||||
| 	stop | ||||
| } | ||||
|  | ||||
| show() { | ||||
| show() | ||||
| { | ||||
| 	setupopts | ||||
| 	hwclock --show "${utc_cmd}" ${clock_args}  | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,13 +4,15 @@ | ||||
|  | ||||
| description="Sets a font for the consoles." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| 	need keymaps    # sets up terminal encoding scheme | ||||
| 	after hotplug | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	# Forget about any font until we are successful | ||||
| 	rm -rf "${RC_LIBDIR}"/console | ||||
|  | ||||
| @@ -66,7 +68,9 @@ start() { | ||||
| 	if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then | ||||
| 		mkdir -p "${RC_LIBDIR}"/console | ||||
|  | ||||
| 		for font in /usr/share/consolefonts/"${consolefont}".*; do :; done | ||||
| 		for font in /usr/share/consolefonts/"${consolefont}".*; do | ||||
| 			: | ||||
| 	     	done | ||||
| 		cp "${font}" "${RC_LIBDIR}"/console | ||||
| 		echo "${font##*/}" > "${RC_LIBDIR}"/console/font | ||||
| 		if yesno ${unicode:-${UNICODE}}; then | ||||
| @@ -78,5 +82,3 @@ start() { | ||||
|  | ||||
| 	return ${retval} | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -12,11 +12,13 @@ windowskeys=${windowskeys:-${SET_WINDOWSKEYS}} | ||||
| fix_euro=${fix_euro:-${FIX_EURO}} | ||||
| dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}} | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	case "${RC_SYS}" in | ||||
| 		UML|VPS|XENU) | ||||
| 			ewarn "Not loading keymaps for ${RC_SYS} systems" | ||||
| @@ -64,7 +66,8 @@ start() { | ||||
| 	# See utf-8(7) for more information. | ||||
| 	local termencoding= termmsg= | ||||
| 	if yesno ${unicode}; then | ||||
| 		dumpkeys ${dumpkeys_charset:+-c} ${dumpkeys_charset} | loadkeys --unicode | ||||
| 		dumpkeys ${dumpkeys_charset:+-c} \ | ||||
| 			${dumpkeys_charset} | loadkeys --unicode | ||||
| 		termencoding="%G" | ||||
| 		termmsg="UTF-8" | ||||
| 	else | ||||
| @@ -80,5 +83,3 @@ start() { | ||||
| 	done | ||||
| 	eend 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,12 +4,14 @@ | ||||
|  | ||||
| description="Loads a user defined list of kernel modules." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need checkroot | ||||
| 	use isapnp | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	# Should not fail if kernel do not have module | ||||
| 	# support compiled in ... | ||||
| 	[ ! -f /proc/modules -o "${RC_SYS}" = "VPS" ] && return 0 | ||||
| @@ -22,7 +24,10 @@ start() { | ||||
| 	local KV_MICRO=${x%%-*} | ||||
|  | ||||
| 	local list= x= args= cnt=0 | ||||
| 	for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR}; do | ||||
| 	for x in "${KV}" \ | ||||
| 		${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \ | ||||
| 		${KV_MAJOR}.${KV_MINOR} \ | ||||
| 	; do | ||||
| 		eval list=\$modules_$(shell_var "${x}") | ||||
| 		[ -n "${list}" ] && break | ||||
| 	done | ||||
| @@ -43,5 +48,3 @@ start() { | ||||
| 	# Above test clobbers the return | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -6,11 +6,13 @@ description="Turns numlock on for the consoles." | ||||
|  | ||||
| ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12} | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| } | ||||
|  | ||||
| _setleds() { | ||||
| _setleds() | ||||
| { | ||||
| 	[ -z "$1" ] && return 1 | ||||
|  | ||||
| 	local dev=/dev/tty t= i=1 retval=0 | ||||
| @@ -24,16 +26,16 @@ _setleds() { | ||||
| 	return ${retval} | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	ebegin "Enabling numlock on ttys" | ||||
| 	_setleds + | ||||
| 	eend $? "Failed to enable numlock" | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	ebegin "Disabling numlock on ttys" | ||||
| 	_setleds - | ||||
| 	eend $? "Failed to disable numlock" | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,11 +4,13 @@ | ||||
|  | ||||
| description="Mounts misc filesystems in /proc." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need checkfs | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	# Make sure we insert usbcore if its a module | ||||
| 	if [ -f /proc/modules -a ! -d /proc/bus/usb ]; then | ||||
| 		modprobe -q usbcore | ||||
| @@ -84,5 +86,3 @@ start() { | ||||
|  | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -2,17 +2,17 @@ | ||||
| # Copyright 2007-2008 Roy Marples | ||||
| # All rights reserved | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	use hostname | ||||
| 	before bootmisc logger | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	[ "${RC_SYS}" = "VPS" ] && return 0 | ||||
| 	[ -e /etc/sysctl.conf ] || return 0 | ||||
| 	ebegin "Configuring kernel parameters" | ||||
| 	sysctl -p /etc/sysctl.conf >/dev/null | ||||
| 	eend $? | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -2,14 +2,16 @@ | ||||
| # Copyright 2007-2008 Roy Marples | ||||
| # All rights reserved | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	use hostname | ||||
| 	need localmount | ||||
| 	before logger | ||||
| 	after clock sysctl | ||||
| } | ||||
|  | ||||
| cleanup_tmp_dir() { | ||||
| cleanup_tmp_dir() | ||||
| { | ||||
| 	local dir=$1 | ||||
|  | ||||
| 	mkdir -p "${dir}" | ||||
| @@ -48,7 +50,8 @@ cleanup_tmp_dir() { | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	if ! mkdir /.test.$$ 2>/dev/null; then | ||||
| 		ewarn "Skipping /var and /tmp initialization (ro root?)" | ||||
| 		return 0 | ||||
| @@ -73,12 +76,14 @@ start() { | ||||
|  | ||||
| 	ebegin "Cleaning /var/run" | ||||
| 	for x in $(find /var/run ! -type d ! -name utmp ! -name innd.pid \ | ||||
| 		! -name random-seed ! -name ld-elf.so.hints ! -name ld.so.hints); do | ||||
| 		   ! -name random-seed ! -name ld-elf.so.hints \ | ||||
| 		   ! -name ld.so.hints); do | ||||
| 		[ ! -f "${x}" ] && continue | ||||
| 		# Do not remove pidfiles of already running daemons | ||||
| 		case "${x}" in | ||||
| 			*.pid) | ||||
| 				start-stop-daemon --test --quiet --stop --pidfile "${x}" | ||||
| 				start-stop-daemon --test --quiet --stop \ | ||||
| 				--pidfile "${x}" | ||||
| 				[ $? -eq 0 ] && continue | ||||
| 				;; | ||||
| 		esac | ||||
| @@ -110,7 +115,8 @@ start() { | ||||
| 	rm -f /etc/nologin | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	# Write a halt record if we're shutting down | ||||
| 	case "${RC_SOFTLEVEL}" in | ||||
| 		reboot|shutdown) [ "${RC_UNAME}" = "Linux" ] && halt -w;; | ||||
| @@ -118,5 +124,3 @@ stop() { | ||||
|  | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -5,13 +5,15 @@ | ||||
| description="Check filesystems according to /etc/fstab for errors and \ | ||||
| optionally repair them." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need checkroot | ||||
| 	after modules | ||||
| 	keywords notimeout | ||||
| } | ||||
|  | ||||
| do_checkfs() { | ||||
| do_checkfs() | ||||
| { | ||||
| 	local retval=0 mode="-p" opts= parts= | ||||
|  | ||||
| 	ebegin "Checking all filesystems" | ||||
| @@ -56,16 +58,16 @@ do_checkfs() { | ||||
| 	return ${retval} | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	do_checkfs | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	# fsck on shutdown if we need to | ||||
| 	if yesno "${fsck_shutdown:-${FSCK_SHUTDOWN}}"; then | ||||
| 		do_checkfs | ||||
| 	fi | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -5,11 +5,13 @@ | ||||
| description="Check the root filesystem according to /etc/fstab for errors \ | ||||
| and optionally repair them." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	keywords notimeout | ||||
| } | ||||
|  | ||||
| do_mtab() { | ||||
| do_mtab() | ||||
| { | ||||
| 	# Don't create mtab if /etc is readonly | ||||
| 	if ! echo 2>/dev/null >/etc/mtab; then | ||||
| 		ewarn "Skipping /etc/mtab initialization (ro root)" | ||||
| @@ -28,12 +30,14 @@ do_mtab() { | ||||
| 	eend 0 | ||||
| } | ||||
|  | ||||
| root_rw() { | ||||
| root_rw() | ||||
| { | ||||
| 	echo 2>/dev/null >/.test.$$ || return 1 | ||||
| 	rm -f /.test.$$ | ||||
| } | ||||
|  | ||||
| do_fsck() { | ||||
| do_fsck() | ||||
| { | ||||
| 	local retval=0 opts= root= | ||||
| 	case "${RC_UNAME}" in | ||||
| 		FreeBSD) opts="-F";; | ||||
| @@ -104,7 +108,8 @@ do_fsck() { | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	do_fsck || return 1 | ||||
|  | ||||
| 	if ! root_rw; then | ||||
| @@ -123,5 +128,3 @@ start() { | ||||
| 	# We got here, so return 0 | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -97,5 +97,3 @@ fi | ||||
|  | ||||
| # Always exit 0 here | ||||
| exit 0 | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,15 +4,15 @@ | ||||
|  | ||||
| description="Sets the hostname of the machine." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need checkroot | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	hostname=${hostname-${HOSTNAME-localhost}} | ||||
| 	ebegin "Setting hostname to ${hostname}" | ||||
| 	hostname "${hostname}" | ||||
| 	eend $? "Failed to set the hostname" | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
							
								
								
									
										11
									
								
								init.d/local
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								init.d/local
									
									
									
									
									
								
							| @@ -4,12 +4,14 @@ | ||||
|  | ||||
| description="Executes user commands in /etc/conf.d/local" | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	after * | ||||
| 	keywords notimeout | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	ebegin "Starting local" | ||||
|  | ||||
| 	if type local_start >/dev/null 2>&1; then | ||||
| @@ -24,7 +26,8 @@ start() { | ||||
| 	eend $? "Failed to start local" | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	ebegin "Stopping local" | ||||
|  | ||||
| 	if type local_start >/dev/null 2>&1; then | ||||
| @@ -38,5 +41,3 @@ stop() { | ||||
|  | ||||
| 	eend $? $"Failed to stop local" | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,11 +4,13 @@ | ||||
|  | ||||
| description="Mounts disks and swap according to /etc/fstab." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need checkfs | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	# Mount local filesystems in /etc/fstab. | ||||
| 	local types="noproc" x= | ||||
| 	for x in ${net_fs_list}; do | ||||
| @@ -23,7 +25,8 @@ start() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	# Don't unmount anything for VPS systems | ||||
| 	[ "${RC_SYS}" = "VPS" ] && return 0 | ||||
|  | ||||
| @@ -80,5 +83,3 @@ stop() { | ||||
|  | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,7 +4,8 @@ | ||||
|  | ||||
| description="Mounts network shares according to /etc/fstab." | ||||
|  | ||||
| need_portmap() { | ||||
| need_portmap() | ||||
| { | ||||
| 	local opts= | ||||
| 	local IFS=" | ||||
| " | ||||
| @@ -18,9 +19,10 @@ need_portmap() { | ||||
| 	return 1 | ||||
| } | ||||
|  | ||||
| depend() { | ||||
| 	# Only have portmap as a dependency if there is a nfs mount in fstab that | ||||
| 	# is set to mount at boot | ||||
| depend() | ||||
| { | ||||
| 	# Only have portmap as a dependency if there is a nfs mount in fstab | ||||
| 	# that is set to mount at boot | ||||
| 	local pmap="" | ||||
| 	if need_portmap; then | ||||
| 		pmap="${pmap} rpc.statd" | ||||
| @@ -34,7 +36,8 @@ depend() { | ||||
| 	use afc-client amd autofs dns nfs nfsmount portmap rpcbind rpc.statd | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| {	 | ||||
| 	local myneed= myuse= pmap="portmap" nfsmounts= | ||||
| 	[ -x /etc/init.d/rpcbind ] && pmap="rpcbind" | ||||
|  | ||||
| @@ -42,17 +45,18 @@ start() { | ||||
| 	for x in ${net_fs_list}; do | ||||
| 		case "${x}" in | ||||
| 			nfs|nfs4) | ||||
|     			# If the nfsmount script took care of the nfs filesystems, | ||||
| 	    		# then there's no point in trying them twice | ||||
| 				service_started nfsmount && continue | ||||
|     			# If the nfsmount script took care of the nfs | ||||
| 			# filesystems, then there's no point in trying | ||||
| 			# them twice | ||||
| 			service_started nfsmount && continue | ||||
|  | ||||
|         		# Only try to mount NFS filesystems if portmap was started. | ||||
| 		        # This is to fix "hang" problems for new users who do not | ||||
| 				# add portmap to the default runlevel. | ||||
| 				if need_portmap && ! service_started "${pmap}"; then | ||||
| 					continue | ||||
| 				fi | ||||
| 				;; | ||||
|         		# Only try to mount NFS filesystems if portmap was | ||||
| 			# started. This is to fix "hang" problems for new | ||||
| 		        # users who do not add portmap to the default runlevel. | ||||
| 			if need_portmap && ! service_started "${pmap}"; then | ||||
| 				continue | ||||
| 			fi | ||||
| 			;; | ||||
| 		esac | ||||
| 		fs="${fs}${fs:+,}${x}" | ||||
| 	done | ||||
| @@ -63,7 +67,8 @@ start() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	local x= fs= | ||||
|  | ||||
| 	ebegin "Unmounting network filesystems" | ||||
| @@ -73,7 +78,7 @@ stop() { | ||||
| 		fs="${fs}${fs:+,}${x}" | ||||
| 	done | ||||
| 	if [ -n "${fs}" ]; then | ||||
| 		umount -at ${fs} ||	eerror "Failed to simply unmount filesystems" | ||||
| 		umount -at ${fs} || eerror "Failed to simply unmount filesystems" | ||||
| 	fi | ||||
|  | ||||
| 	eindent | ||||
| @@ -88,5 +93,3 @@ stop() { | ||||
| 	eoutdent | ||||
| 	eend ${retval} "Failed to unmount network filesystems" | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -2,17 +2,20 @@ | ||||
| # Copyright 2007-2008 Roy Marples | ||||
| # All rights reserved | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	ebegin "Activating swap" | ||||
| 	swapon -a >/dev/null | ||||
| 	eend 0 # If swapon has nothing todo it errors, so always return 0 | ||||
| }	 | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	ebegin "Deactivating swap" | ||||
| 	swapoff -a >/dev/null | ||||
| 	eend 0  | ||||
|   | ||||
| @@ -6,24 +6,27 @@ urandom_seed=${urandom_seed:-${URANDOM_SEED:-/var/run/random-seed}} | ||||
|  | ||||
| description="Initializes the random number generator." | ||||
|  | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	need localmount | ||||
| } | ||||
|  | ||||
| save_seed() { | ||||
| 	local poolsize=1 | ||||
| save_seed() | ||||
| { | ||||
| 	local psz=1 | ||||
|  | ||||
| 	if [ -e /proc/sys/kernel/random/poolsize ]; then | ||||
| 		poolsize=$(($(cat /proc/sys/kernel/random/poolsize) / 4096)) | ||||
| 		psz=$(($(cat /proc/sys/kernel/random/poolsize) / 4096)) | ||||
| 	fi | ||||
|  | ||||
| 	(	# sub shell to prevent umask pollution | ||||
| 		umask 077 | ||||
| 		dd if=/dev/urandom of="${urandom_seed}" count=${poolsize} 2>/dev/null | ||||
| 		dd if=/dev/urandom of="${urandom_seed}" count=${psz} 2>/dev/null | ||||
| 	) | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	[ -c /dev/urandom ] || return | ||||
| 	if [ -f "${urandom_seed}" ]; then | ||||
| 		ebegin "Initializing random number generator" | ||||
| @@ -34,10 +37,9 @@ start() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	ebegin "Saving random seed" | ||||
| 	save_seed | ||||
| 	eend $? "Failed to save random seed" | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -4,7 +4,8 @@ | ||||
|  | ||||
| # void single_user() | ||||
| #  Drop to a shell, remount / ro, and then reboot | ||||
| single_user() { | ||||
| single_user() | ||||
| { | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| @@ -14,7 +15,8 @@ single_user() { | ||||
| # be fairly small and we unmount them after the boot level is done anyway | ||||
| # NOTE we don't set a size for Linux either | ||||
| # FreeBSD-7 supports tmpfs now :) | ||||
| mount_svcdir() { | ||||
| mount_svcdir() | ||||
| { | ||||
| 	local dotmp=false release=false | ||||
| 	if [ -e "${RC_SVCDIR}"/deptree ]; then | ||||
| 		dotmp=true | ||||
| @@ -47,5 +49,3 @@ mount_svcdir() { | ||||
| [ "${RC_UNAME}" = "FreeBSD" ] && sysctl hw.bus.devctl_disable=1 >/dev/null | ||||
|  | ||||
| . "${RC_LIBDIR}"/sh/init-common-post.sh | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -1,28 +1,7 @@ | ||||
| #!/bin/sh | ||||
| # Copyright 2007 Roy Marples | ||||
| # Copyright 2007-2008 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. | ||||
|  | ||||
| # Try and set a font and as early as we can | ||||
| if [ -e /etc/runlevels/"${RC_DEFAULTLEVEL}"/consolefont \ | ||||
| 	 -o -e /etc/runlevels/"${RC_BOOTLEVEL}"/consolefont ]; then | ||||
|   | ||||
| @@ -4,12 +4,14 @@ | ||||
| # All rights reserved | ||||
|  | ||||
| # udev needs these functions still :/ | ||||
| try() { | ||||
| try() | ||||
| { | ||||
| 	"$@" | ||||
| } | ||||
|  | ||||
| _rc_get_kv_cache= | ||||
| get_KV() { | ||||
| get_KV() | ||||
| { | ||||
| 	[ -z "${_rc_get_kv_cache}" ] \ | ||||
| 		&& _rc_get_kv_cache="$(uname -r)" | ||||
|  | ||||
| @@ -18,7 +20,8 @@ get_KV() { | ||||
| 	return $? | ||||
| } | ||||
|  | ||||
| KV_to_int() { | ||||
| KV_to_int() | ||||
| { | ||||
| 	[ -z $1 ] && return 1 | ||||
|  | ||||
| 	local x=${1%%-*} | ||||
| @@ -36,7 +39,8 @@ KV_to_int() { | ||||
| 	echo "${KV_int}" | ||||
| } | ||||
|  | ||||
| single_user() { | ||||
| single_user() | ||||
| { | ||||
| 	if [ "${RC_SYS}" = "VPS" ]; then | ||||
| 		einfo "Halting" | ||||
| 		halt -f | ||||
| @@ -58,7 +62,8 @@ single_user() { | ||||
| # which allows us to run depscan.sh | ||||
| # The tricky part is finding something our kernel supports | ||||
| # tmpfs and ramfs are easy, so force one or the other | ||||
| mount_svcdir() { | ||||
| mount_svcdir() | ||||
| { | ||||
| 	local fs= fsopts="-o rw,noexec,nodev,nosuid" devdir="none" devtmp="none" x= | ||||
| 	local svcsize=${svcsize:-1024} | ||||
|  | ||||
| @@ -257,5 +262,3 @@ if [ -f /sbin/livecd-functions.sh -a -n "${CDBOOT}" ]; then | ||||
| fi | ||||
|  | ||||
| . "${RC_LIBDIR}"/sh/init-common-post.sh | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -6,13 +6,15 @@ | ||||
|  | ||||
| RC_GOT_FUNCTIONS="yes" | ||||
|  | ||||
| eindent() { | ||||
| eindent() | ||||
| { | ||||
| 	EINFO_INDENT=$((${EINFO_INDENT:-0} + 2)) | ||||
| 	[ "${EINFO_INDENT}" -gt 40 ] && EINFO_INDENT=40 | ||||
| 	export EINFO_INDENT | ||||
| } | ||||
|  | ||||
| eoutdent() { | ||||
| eoutdent() | ||||
| { | ||||
| 	EINFO_INDENT=$((${EINFO_INDENT:-0} - 2)) | ||||
| 	[ "${EINFO_INDENT}" -lt 0 ] && EINFO_INDENT=0 | ||||
| 	return 0 | ||||
| @@ -36,7 +38,8 @@ yesno() | ||||
| 	esac | ||||
| } | ||||
|  | ||||
| _sanitize_path() { | ||||
| _sanitize_path() | ||||
| { | ||||
| 	local IFS=":" p= path= | ||||
| 	for p in ${PATH}; do | ||||
| 		case "${p}" in | ||||
| @@ -81,5 +84,3 @@ else | ||||
| 		export EINFO_LASTCMD=${_e}; return \$_r; }" | ||||
| 	done | ||||
| fi | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -49,11 +49,15 @@ for _dir in /etc/init.d /usr/local/etc/init.d; do | ||||
|  | ||||
| 		_rc_c=${SVCNAME%%.*} | ||||
| 		if [ -n "${_rc_c}" -a "${_rc_c}" != "${SVCNAME}" ]; then | ||||
| 			[ -e "${_dir}/../conf.d/${_rc_c}" ] && . "${_dir}/../conf.d/${_rc_c}" | ||||
| 			if [ -e "${_dir}/../conf.d/${_rc_c}" ]; then | ||||
| 				. "${_dir}/../conf.d/${_rc_c}" | ||||
| 			fi | ||||
| 		fi | ||||
| 		unset _rc_c | ||||
|  | ||||
| 		[ -e "${_dir}/../conf.d/${SVCNAME}" ] && . "${_dir}/../conf.d/${SVCNAME}" | ||||
| 		if [ -e "${_dir}/../conf.d/${SVCNAME}" ]; then | ||||
| 			. "${_dir}/../conf.d/${SVCNAME}" | ||||
| 		fi | ||||
|  | ||||
| 		[ -e /etc/rc.conf ] && . /etc/rc.conf | ||||
|  | ||||
| @@ -71,5 +75,3 @@ for _dir in /etc/init.d /usr/local/etc/init.d; do | ||||
| 		) | ||||
| 	done | ||||
| done | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -23,5 +23,3 @@ echo "sysinit" > "${RC_SVCDIR}/softlevel" | ||||
| [ -e /dev/.rcsysinit ] && rm -f /dev/.rcsysinit | ||||
|  | ||||
| exit 0 | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
							
								
								
									
										38
									
								
								sh/net.sh
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								sh/net.sh
									
									
									
									
									
								
							| @@ -13,7 +13,8 @@ description="Configures network interfaces." | ||||
| # Handy var so we don't have to embed new lines everywhere for array splitting | ||||
| __IFS=" | ||||
| " | ||||
| depend() { | ||||
| depend() | ||||
| { | ||||
| 	local IFACE=${SVCNAME#*.} | ||||
| 	local IFVAR=$(shell_var "${IFACE}") | ||||
|  | ||||
| @@ -43,7 +44,8 @@ depend() { | ||||
| } | ||||
|  | ||||
| # Support bash arrays - sigh | ||||
| _get_array() { | ||||
| _get_array() | ||||
| { | ||||
| 	local _a= | ||||
| 	if [ -n "${BASH}" ]; then | ||||
| 		case "$(declare -p "$1" 2>/dev/null)" in | ||||
| @@ -64,7 +66,8 @@ _get_array() { | ||||
| } | ||||
|  | ||||
| # Flatten bash arrays to simple strings | ||||
| _flatten_array() { | ||||
| _flatten_array() | ||||
| { | ||||
| 	if [ -n "${BASH}" ]; then | ||||
| 		case "$(declare -p "$1" 2>/dev/null)" in | ||||
| 			"declare -a "*) | ||||
| @@ -83,7 +86,8 @@ _flatten_array() { | ||||
| 	[ -n "${_a}" ] | ||||
| } | ||||
|  | ||||
| _wait_for_carrier() { | ||||
| _wait_for_carrier() | ||||
| { | ||||
| 	local timeout= efunc=einfon | ||||
|  | ||||
| 	_has_carrier  && return 0 | ||||
| @@ -112,7 +116,8 @@ _wait_for_carrier() { | ||||
| 	return 1 | ||||
| } | ||||
|  | ||||
| _netmask2cidr() { | ||||
| _netmask2cidr() | ||||
| { | ||||
| 	# Some shells cannot handle hex arithmetic, so we massage it slightly | ||||
| 	# Buggy shells include FreeBSD sh, dash and busybox. | ||||
| 	# bash and NetBSD sh don't need this. | ||||
| @@ -140,7 +145,8 @@ _netmask2cidr() { | ||||
| 	echo "${len}" | ||||
| } | ||||
|  | ||||
| _configure_variables() { | ||||
| _configure_variables() | ||||
| { | ||||
| 	local var= v= t= | ||||
|  | ||||
| 	for var in ${_config_vars}; do | ||||
| @@ -155,12 +161,14 @@ _configure_variables() { | ||||
| 	done | ||||
| } | ||||
|  | ||||
| _show_address() { | ||||
| _show_address() | ||||
| { | ||||
| 	einfo "received address $(_get_inet_address "${IFACE}")" | ||||
| } | ||||
|  | ||||
| # Basically sorts our modules into order and saves the list | ||||
| _gen_module_list() { | ||||
| _gen_module_list() | ||||
| { | ||||
| 	local x= f= force=$1 | ||||
| 	if ! ${force} && [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ]; then | ||||
| 		local update=false | ||||
| @@ -269,7 +277,8 @@ _gen_module_list() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| _load_modules() { | ||||
| _load_modules() | ||||
| { | ||||
| 	local starting=$1 mymods= | ||||
|  | ||||
| 	# Ensure our list is up to date | ||||
| @@ -380,7 +389,8 @@ _load_modules() { | ||||
| 	veinfo "Loaded modules: ${MODULES}" | ||||
| } | ||||
|  | ||||
| _load_config() { | ||||
| _load_config() | ||||
| { | ||||
| 	local config="$(_get_array "config_${IFVAR}")" | ||||
| 	local fallback="$(_get_array fallback_${IFVAR})" | ||||
|  | ||||
| @@ -437,7 +447,8 @@ _load_config() { | ||||
| 	config_index=-1 | ||||
| } | ||||
|  | ||||
| start() { | ||||
| start() | ||||
| { | ||||
| 	local IFACE=${SVCNAME#*.} oneworked=false module= | ||||
| 	local IFVAR=$(shell_var "${IFACE}") cmd= our_metric= | ||||
| 	local metric=0 | ||||
| @@ -612,7 +623,8 @@ ${routes}" | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| stop() { | ||||
| stop() | ||||
| { | ||||
| 	local IFACE=${SVCNAME#*.} module= | ||||
| 	local IFVAR=$(shell_var "${IFACE}") opts= | ||||
|  | ||||
| @@ -677,5 +689,3 @@ stop() { | ||||
|  | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 sw=4 : | ||||
|   | ||||
| @@ -2,11 +2,13 @@ | ||||
| # Copyright 2007-2008 Roy Marples | ||||
| # All rights reserved | ||||
|  | ||||
| has_addon() { | ||||
| has_addon() | ||||
| { | ||||
| 	[ -e "${RC_LIBDIR}/addons/$1.sh" ] || [ -e /lib/rcscripts/addons/"$1".sh ] | ||||
| } | ||||
|  | ||||
| import_addon() { | ||||
| import_addon() | ||||
| { | ||||
| 	if [ -e "${RC_LIBDIR}/addons/$1.sh" ]; then | ||||
| 		. "${RC_LIBDIR}/addons/$1.sh" | ||||
| 	elif [ -e /lib/rcscripts/addons/"$1".sh ]; then | ||||
| @@ -16,16 +18,19 @@ import_addon() { | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| start_addon() { | ||||
| start_addon() | ||||
| { | ||||
| 	( import_addon "$1-start" ) | ||||
| } | ||||
|  | ||||
| stop_addon() { | ||||
| stop_addon() | ||||
| { | ||||
| 	( 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 | ||||
|  | ||||
| 	# Check OS specific flags to see if we're local or net mounted | ||||
| @@ -40,12 +45,14 @@ is_net_fs() { | ||||
| 	return 1 | ||||
| } | ||||
|  | ||||
| is_union_fs() { | ||||
| is_union_fs() | ||||
| { | ||||
| 	[ ! -x /sbin/unionctl ] && return 1 | ||||
| 	unionctl "$1" --list >/dev/null 2>&1 | ||||
| } | ||||
|  | ||||
| get_bootparam() { | ||||
| get_bootparam() | ||||
| { | ||||
| 	local match="$1" | ||||
| 	[ -z "${match}" -o ! -r /proc/cmdline ] && return 1 | ||||
|  | ||||
| @@ -71,5 +78,3 @@ case "${PATH}" in | ||||
| 	/lib/rc/sbin|/lib/rc/sbin:*);; | ||||
| 	*) export PATH="/lib/rc/sbin:${PATH}";; | ||||
| esac | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -5,7 +5,8 @@ | ||||
| # mountinfo is a C program to actually find our mounts on our supported OS's | ||||
| # We rely on fuser being preset, so if it's not then we don't unmount anything. | ||||
| # This isn't a real issue for the BSD's, but it is for Linux. | ||||
| do_unmount() { | ||||
| do_unmount() | ||||
| { | ||||
| 	type fuser >/dev/null 2>&1 || return 0 | ||||
|  | ||||
| 	local cmd="$1" retval=0 retry= | ||||
| @@ -73,5 +74,3 @@ do_unmount() { | ||||
| 	done | ||||
| 	return ${retval} | ||||
| } | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
| @@ -19,7 +19,8 @@ if [ -z "$1" -o -z "$2" ]; then | ||||
| fi | ||||
|  | ||||
| # Descript the init script to the user | ||||
| describe() { | ||||
| describe() | ||||
| { | ||||
| 	if [ -n "${description}" ]; then | ||||
| 		einfo "${description}" | ||||
| 	else | ||||
| @@ -135,10 +136,11 @@ while [ -n "$1" ]; do | ||||
| 		${extra_started_commands}; do | ||||
| 		if [ "${_cmd}" = "$1" ]; then | ||||
| 			if type "$1" >/dev/null 2>&1; then | ||||
| 				# If we're in the background, we may wish to fake some | ||||
| 				# commands. We do this so we can "start" ourselves from | ||||
| 				# inactive which then triggers other services to start | ||||
| 				# which depend on us. A good example of this is openvpn. | ||||
| 				# If we're in the background, we may wish to | ||||
| 				# fake some commands. We do this so we can | ||||
| 				# "start" ourselves from inactive which then | ||||
| 				# triggers other services to start which depend | ||||
| 				# on us. A good example of this is openvpn. | ||||
| 				if yesno ${IN_BACKGROUND}; then | ||||
| 					for _cmd in ${in_background_fake}; do | ||||
| 						if [ "${_cmd}" = "$1" ]; then | ||||
| @@ -147,8 +149,8 @@ while [ -n "$1" ]; do | ||||
| 						fi | ||||
| 					done | ||||
| 				fi | ||||
| 				# Check to see if we need to be started before we can run | ||||
| 				# this command | ||||
| 				# Check to see if we need to be started before | ||||
| 				# we can run this command | ||||
| 				for _cmd in ${extra_started_commands}; do | ||||
| 					if [ "${_cmd}" = "$1" ]; then | ||||
| 						if ! service_started "${SVCNAME}"; then | ||||
| @@ -180,5 +182,3 @@ while [ -n "$1" ]; do | ||||
| 	eerror "${SVCNAME}: unknown function \`$1'" | ||||
| 	exit 1 | ||||
| done | ||||
|  | ||||
| # vim: set ts=4 : | ||||
|   | ||||
		Reference in New Issue
	
	Block a user