From 3bf49a9bd19d5bbcf6976dd42b4f87f1b173e287 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 11 Jan 2008 12:13:46 +0000 Subject: Adopt a more C style for scripts and remove vim settings. --- init.d.Linux/clock | 23 ++++++++++++++--------- init.d.Linux/consolefont | 12 +++++++----- init.d.Linux/keymaps | 11 ++++++----- init.d.Linux/modules | 13 ++++++++----- init.d.Linux/numlock | 14 ++++++++------ init.d.Linux/procfs | 8 ++++---- init.d.Linux/sysctl | 8 ++++---- 7 files changed, 51 insertions(+), 38 deletions(-) (limited to 'init.d.Linux') diff --git a/init.d.Linux/clock b/init.d.Linux/clock index 0d590a9e..5ac65925 100755 --- a/init.d.Linux/clock +++ b/init.d.Linux/clock @@ -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 : diff --git a/init.d.Linux/consolefont b/init.d.Linux/consolefont index abf50223..d65a4fd4 100755 --- a/init.d.Linux/consolefont +++ b/init.d.Linux/consolefont @@ -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 : diff --git a/init.d.Linux/keymaps b/init.d.Linux/keymaps index ee4fd263..5456b982 100755 --- a/init.d.Linux/keymaps +++ b/init.d.Linux/keymaps @@ -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 : diff --git a/init.d.Linux/modules b/init.d.Linux/modules index a4889858..ef671475 100755 --- a/init.d.Linux/modules +++ b/init.d.Linux/modules @@ -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 : diff --git a/init.d.Linux/numlock b/init.d.Linux/numlock index 2defe69c..8ad4a66a 100755 --- a/init.d.Linux/numlock +++ b/init.d.Linux/numlock @@ -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 : diff --git a/init.d.Linux/procfs b/init.d.Linux/procfs index eccb2ef5..fecaa425 100644 --- a/init.d.Linux/procfs +++ b/init.d.Linux/procfs @@ -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 : diff --git a/init.d.Linux/sysctl b/init.d.Linux/sysctl index a445835a..495f8ae5 100644 --- a/init.d.Linux/sysctl +++ b/init.d.Linux/sysctl @@ -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 : -- cgit v1.2.3