aboutsummaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/bootmisc20
-rwxr-xr-xinit.d/checkfs14
-rwxr-xr-xinit.d/checkroot17
-rwxr-xr-xinit.d/halt.sh2
-rwxr-xr-xinit.d/hostname8
-rwxr-xr-xinit.d/local11
-rwxr-xr-xinit.d/localmount11
-rwxr-xr-xinit.d/netmount41
-rw-r--r--init.d/swap9
-rwxr-xr-xinit.d/urandom20
10 files changed, 85 insertions, 68 deletions
diff --git a/init.d/bootmisc b/init.d/bootmisc
index f067dc7b..43550dd0 100755
--- a/init.d/bootmisc
+++ b/init.d/bootmisc
@@ -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 :
diff --git a/init.d/checkfs b/init.d/checkfs
index 49af243c..5e34e518 100755
--- a/init.d/checkfs
+++ b/init.d/checkfs
@@ -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 :
diff --git a/init.d/checkroot b/init.d/checkroot
index 86052931..8e4bf645 100755
--- a/init.d/checkroot
+++ b/init.d/checkroot
@@ -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 :
diff --git a/init.d/halt.sh b/init.d/halt.sh
index c56d8502..c760af70 100755
--- a/init.d/halt.sh
+++ b/init.d/halt.sh
@@ -97,5 +97,3 @@ fi
# Always exit 0 here
exit 0
-
-# vim: set ts=4 :
diff --git a/init.d/hostname b/init.d/hostname
index c5538c52..448f0b00 100755
--- a/init.d/hostname
+++ b/init.d/hostname
@@ -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 :
diff --git a/init.d/local b/init.d/local
index b706be65..bf8692a5 100755
--- a/init.d/local
+++ b/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 :
diff --git a/init.d/localmount b/init.d/localmount
index 27117150..86533992 100755
--- a/init.d/localmount
+++ b/init.d/localmount
@@ -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 :
diff --git a/init.d/netmount b/init.d/netmount
index 4d84f45b..cc886c69 100755
--- a/init.d/netmount
+++ b/init.d/netmount
@@ -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 :
diff --git a/init.d/swap b/init.d/swap
index f624e376..aefe7170 100644
--- a/init.d/swap
+++ b/init.d/swap
@@ -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
diff --git a/init.d/urandom b/init.d/urandom
index 9e2632fd..f6585deb 100755
--- a/init.d/urandom
+++ b/init.d/urandom
@@ -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 :