aboutsummaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/bootmisc15
-rwxr-xr-xinit.d/checkfs15
-rwxr-xr-xinit.d/checkroot27
-rwxr-xr-xinit.d/halt.sh17
-rwxr-xr-xinit.d/hostname1
-rwxr-xr-xinit.d/local18
-rwxr-xr-xinit.d/localmount1
-rwxr-xr-xinit.d/netmount12
-rwxr-xr-xinit.d/rmnologin40
-rwxr-xr-xinit.d/urandom3
10 files changed, 33 insertions, 116 deletions
diff --git a/init.d/bootmisc b/init.d/bootmisc
index 5aa5f200..72254f11 100755
--- a/init.d/bootmisc
+++ b/init.d/bootmisc
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
@@ -70,13 +69,6 @@ cleanup_tmp_dir() {
}
start() {
- # Put a nologin file in /etc to prevent people from logging
- # in before system startup is complete.
- if yesno ${delay_login:-${DELAYLOGIN}}; then
- echo "System bootup in progress - please wait" > /etc/nologin
- cp /etc/nologin /etc/nologin.boot
- fi
-
if ! mkdir /.test.$$ 2>/dev/null; then
ewarn "Skipping /var and /tmp initialization (ro root?)"
return 0
@@ -94,8 +86,8 @@ start() {
done
ebegin "Creating user login records"
- printf "" >/var/run/utmp
- [ -e /var/log/wtmp ] || printf "" >/var/log/wtmp
+ cp /dev/null /var/run/utmp
+ [ -e /var/log/wtmp ] || cp /dev/null /var/log/wtmp
chmod 0644 /var/run/utmp /var/log/wtmp
eend 0
@@ -134,9 +126,6 @@ start() {
dmesg > /var/log/dmesg
chmod 640 /var/log/dmesg
fi
-
- # Check for /etc/resolv.conf, and create if missing
- [ -e /etc/resolv.conf ] || printf "" >/etc/resolv.conf
}
stop() {
diff --git a/init.d/checkfs b/init.d/checkfs
index c29c519a..8e8c6ffc 100755
--- a/init.d/checkfs
+++ b/init.d/checkfs
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
@@ -37,17 +36,15 @@ do_checkfs() {
local retval=0 mode="-p" opts= parts=
ebegin "Checking all filesystems"
-
- if [ -e /forcefsck ] || get_bootparam "forcefsck"; then
- ewarn "A full fsck has been forced"
- mode="-f -n"
- fi
if [ "${RC_UNAME}" = "Linux" ]; then
opts="-A -C0 -R -T"
else
parts="$(fstabinfo --passno ">1")"
- [ -z "${parts}" ] && return 0
+ if [ -z "${parts}" ]; then
+ eend 0
+ return 0
+ fi
fi
fsck ${opts} ${mode} ${parts}
@@ -77,8 +74,6 @@ do_checkfs() {
fi
fi
- [ ${retval} = 0 -a -e /forcefsck ] && rm /forcefsck
-
return ${retval}
}
@@ -89,7 +84,7 @@ start() {
stop() {
# fsck on shutdown if we need to
if yesno "${fsck_shutdown:-${FSCK_SHUTDOWN}}"; then
- [ ! -f /forcefsck ] && do_checkfs
+ do_checkfs
fi
return 0
}
diff --git a/init.d/checkroot b/init.d/checkroot
index acfb914a..ef491847 100755
--- a/init.d/checkroot
+++ b/init.d/checkroot
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
@@ -33,8 +32,8 @@ depend() {
do_mtab() {
# Don't create mtab if /etc is readonly
- if ! printf "" 2>/dev/null >/etc/mtab; then
- ewarn "Skipping /etc/mtab initialization (ro root?)"
+ if ! cp /dev/null >/etc/mtab 2>/dev/null; then
+ ewarn "Skipping /etc/mtab initialization (ro root)"
return 0
fi
ebegin "Updating /etc/mtab"
@@ -75,23 +74,15 @@ do_fsck() {
root=$(fstabinfo --blockdevice /)
[ ! -e "${root}" -a -e /dev/root ] && root=/dev/root
- if [ -e /forcefsck ] || get_bootparam "forcefsck"; then
- ebegin "Checking root filesystem (full fsck forced)"
- fsck ${opts} -f -n "${root}"
- # /forcefsck isn't deleted because checkfs needs it.
- # it'll be deleted in that script.
+ # Obey the fs_passno setting for / (see fstab(5))
+ local pass=$(fstabinfo --passno /)
+ if [ ${pass:-0} != "0" ]; then
+ ebegin "Checking root filesystem"
+ fsck ${opts} -p "${root}"
retval=$?
else
- # Obey the fs_passno setting for / (see fstab(5))
- local pass=$(fstabinfo --passno /)
- if [ ${pass:-0} != "0" ]; then
- ebegin "Checking root filesystem"
- fsck ${opts} -p "${root}"
- retval=$?
- else
- ebegin "Skipping root filesystem check" "(fstab's passno == 0)"
- retval=0
- fi
+ ebegin "Skipping root filesystem check (fstab's passno == 0)"
+ retval=0
fi
if [ ${retval} -eq 0 ]; then
diff --git a/init.d/halt.sh b/init.d/halt.sh
index aa73a6d0..a439b834 100755
--- a/init.d/halt.sh
+++ b/init.d/halt.sh
@@ -1,5 +1,4 @@
#!/bin/sh
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
@@ -109,22 +108,6 @@ if [ "${RC_UNAME}" = "Linux" ]; then
unmounted=$?
fi
-# This UPS code should be moved to out of here and to an addon
-if [ -f /etc/killpower ]; then
- UPS_CTL=/sbin/upsdrvctl
- UPS_POWERDOWN="${UPS_CTL} shutdown"
-elif [ -f /etc/apcupsd/powerfail ]; then
- UPS_CTL=/etc/apcupsd/apccontrol
- UPS_POWERDOWN="${UPS_CTL} killpower"
-fi
-if [ -x "${UPS_CTL}" ]; then
- ewarn "Signalling ups driver(s) to kill the load!"
- ${UPS_POWERDOWN}
- ewarn "Halt system and wait for the UPS to kill our power"
- halt -id
- sleep 60
-fi
-
if [ ${unmounted} -ne 0 ]; then
[ -x /sbin/sulogin ] && sulogin -t 10 /dev/console
exit 1
diff --git a/init.d/hostname b/init.d/hostname
index 688c0421..d371abef 100755
--- a/init.d/hostname
+++ b/init.d/hostname
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
diff --git a/init.d/local b/init.d/local
index d1c30d40..0873ac8e 100755
--- a/init.d/local
+++ b/init.d/local
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
@@ -24,8 +23,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
-description="Executes user command in /etc/conf.d/local.start when starting \
-and /etc/conf.d/local.stop when stopping."
+description="Executes user commands in /etc/conf.d/local"
depend() {
after *
@@ -35,8 +33,11 @@ depend() {
start() {
ebegin "Starting local"
- # Add any misc programs that should be started
- # to /etc/conf.d/local.start
+ if type local_start >/dev/null 2>&1; then
+ local_start
+ fi
+
+ # Support old configs
if [ -e /etc/conf.d/local.start ]; then
. /etc/conf.d/local.start
fi
@@ -47,8 +48,11 @@ start() {
stop() {
ebegin "Stopping local"
- # Add any misc programs that should be stopped
- # to /etc/conf.d/local.stop
+ if type local_start >/dev/null 2>&1; then
+ local_stop
+ fi
+
+ # Support old configs
if [ -e /etc/conf.d/local.stop ]; then
. /etc/conf.d/local.stop
fi
diff --git a/init.d/localmount b/init.d/localmount
index d05822ec..e60ad019 100755
--- a/init.d/localmount
+++ b/init.d/localmount
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
diff --git a/init.d/netmount b/init.d/netmount
index df6e0c99..e2a3d44d 100755
--- a/init.d/netmount
+++ b/init.d/netmount
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
@@ -27,11 +26,12 @@
description="Mounts network shares according to /etc/fstab."
need_portmap() {
- local mnt opts ret IFS="
+ local opts=
+ local IFS="
"
- set -- $(fstabinfo --fstype nfs,nfs4)
- for mnt; do
- case ,$(fstabinfo --options "${mnt}"), in
+ set -- $(fstabinfo --options --fstype nfs,nfs4)
+ for opts; do
+ case ,${opts}, in
*,noauto,*|*,nolock,*);;
*) return 0;;
esac
@@ -79,7 +79,7 @@ start() {
ebegin "Mounting network filesystems"
mount -at ${fs}
- ewend $? "Could not mount all network filesystems!"
+ ewend $? "Could not mount all network filesystems"
return 0
}
diff --git a/init.d/rmnologin b/init.d/rmnologin
deleted file mode 100755
index 925ddcaf..00000000
--- a/init.d/rmnologin
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/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="Removes a file which blocks logins until this service has run."
-
-depend() {
- need localmount
- after bootmisc net
-}
-
-start() {
- if [ -f /etc/nologin.boot ]; then
- rm -f /etc/nologin /etc/nologin.boot
- fi
-}
-
-# vim: set ts=4 :
diff --git a/init.d/urandom b/init.d/urandom
index 5d3a8404..dccdf304 100755
--- a/init.d/urandom
+++ b/init.d/urandom
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# Copyright 1999-2007 Gentoo Foundation
# Copyright 2007 Roy Marples
# All rights reserved
@@ -58,8 +57,6 @@ start() {
stop() {
ebegin "Saving random seed"
- # Carry a random seed from shut-down to start-up;
- # see documentation in linux/drivers/char/random.c
save_seed
eend $? "Failed to save random seed"
}