summaryrefslogtreecommitdiff
path: root/init.d.Linux
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-11 12:13:46 +0000
committerRoy Marples <roy@marples.name>2008-01-11 12:13:46 +0000
commit3bf49a9bd19d5bbcf6976dd42b4f87f1b173e287 (patch)
tree8b4d6121f0d4b921566eeec2844c9bf76131de78 /init.d.Linux
parent1f4422c72f968405a0b8bf56d4f9c3b619b1b80d (diff)
downloadopenrc-3bf49a9bd19d5bbcf6976dd42b4f87f1b173e287.tar.gz
openrc-3bf49a9bd19d5bbcf6976dd42b4f87f1b173e287.tar.bz2
openrc-3bf49a9bd19d5bbcf6976dd42b4f87f1b173e287.tar.xz
Adopt a more C style for scripts and remove vim settings.
Diffstat (limited to 'init.d.Linux')
-rwxr-xr-xinit.d.Linux/clock23
-rwxr-xr-xinit.d.Linux/consolefont12
-rwxr-xr-xinit.d.Linux/keymaps11
-rwxr-xr-xinit.d.Linux/modules13
-rwxr-xr-xinit.d.Linux/numlock14
-rw-r--r--init.d.Linux/procfs8
-rw-r--r--init.d.Linux/sysctl8
7 files changed, 51 insertions, 38 deletions
diff --git a/init.d.Linux/clock b/init.d.Linux/clock
index 0d590a9..5ac6592 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 abf5022..d65a4fd 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 ee4fd26..5456b98 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 a488985..ef67147 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 2defe69..8ad4a66 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 eccb2ef..fecaa42 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 a445835..495f8ae 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 :