diff options
author | ncopa <ncopa@f176ef85-8d20-0410-844a-e957b5a1c371> | 2007-07-06 23:13:34 +0000 |
---|---|---|
committer | ncopa <ncopa@f176ef85-8d20-0410-844a-e957b5a1c371> | 2007-07-06 23:13:34 +0000 |
commit | da93a2f8449f4795acc3a1f1a849d11b88f789b8 (patch) | |
tree | 4515ab0420f330da6e2772be94ea9b21edaa0dd5 /init.d | |
parent | 596f854acc15d129dfa3874d9e188fde8244a8fa (diff) | |
download | alpine-baselayout-da93a2f8449f4795acc3a1f1a849d11b88f789b8.tar.bz2 alpine-baselayout-da93a2f8449f4795acc3a1f1a849d11b88f789b8.tar.xz |
version 1.5.0
renamed mountall to localmount
added checkfs
init.d/networking is more quiet
Diffstat (limited to 'init.d')
-rw-r--r-- | init.d/Makefile | 4 | ||||
-rwxr-xr-x | init.d/checkfs | 56 | ||||
-rwxr-xr-x | init.d/localmount | 80 | ||||
-rw-r--r-- | init.d/mountall | 13 | ||||
-rwxr-xr-x | init.d/networking | 6 | ||||
-rw-r--r-- | init.d/udhcpc | 50 |
6 files changed, 141 insertions, 68 deletions
diff --git a/init.d/Makefile b/init.d/Makefile index 53f35d5..83050fa 100644 --- a/init.d/Makefile +++ b/init.d/Makefile @@ -1,5 +1,6 @@ SCRIPTS = alpinecfg.sh \ bootmisc.sh \ + checkfs \ checkroot.sh \ coldplug \ cron \ @@ -8,9 +9,9 @@ SCRIPTS = alpinecfg.sh \ hwdrivers \ inetd \ localinit \ + localmount \ mdev \ modutils \ - mountall \ networking \ procps \ rcK \ @@ -21,7 +22,6 @@ SCRIPTS = alpinecfg.sh \ swap\ syslog \ tuntap \ - udhcpc \ vlan \ watchdog diff --git a/init.d/checkfs b/init.d/checkfs new file mode 100755 index 0000000..5beff0a --- /dev/null +++ b/init.d/checkfs @@ -0,0 +1,56 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +get_bootparam() { + # todo + return 1 +} + +start() { + local rc=0 mode="-p" opts="-A -C0 -R -T" parts= + + ebegin "Checking all filesystems" + + if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then + ewarn "A full fsck has been forced" + mode="-f -n" + fi + + fsck ${opts} ${mode} ${parts} + rc=$? + + if [ ${rc} -eq 0 ] ; then + eend 0 + elif [ ${rc} -eq 1 ] ; then + ewend 1 "Filesystem errors corrected." + rc=0 + elif [ ${rc} -eq 2 ] ; then + ewend 1 "System should be rebooted" + elif [ ${rc} -eq 8 ] ; then + ewend 1 "Operational error, continuing" + rc=0 + else + if [ "${RC_FORCE_AUTO}" = "yes" ] ; then + eend 2 "Fsck could not correct all errors, rerunning" + fsck ${opts} -y ${parts} + retval=$? + eend ${retval} + fi + + if [ ${retval} -gt 3 ] ; then + eend 2 "Fsck could not correct all errors, manual repair needed" +# exec rc-abort || exit 1 + fi + fi + + [ ${rc} = 0 -a -e /forcefsck ] && rm /forcefsck + + return ${rc} +} + +stop() { + return 0 +} + +# vim: set ts=4 : diff --git a/init.d/localmount b/init.d/localmount new file mode 100755 index 0000000..93dc4d8 --- /dev/null +++ b/init.d/localmount @@ -0,0 +1,80 @@ +#!/sbin/runscript + +: ${NET_FS_LIST:="afs cifs coda davfs fuse gfs ncpfs nfs nfs4 ocfs2 shfs smbfs"} +: ${NO_UNMOUNT:="/dev/shm /dev/pts /dev /sys /proc /"} + +start() { + local types="noprocfs" i= + for i in ${NET_FS_LIST}; do + types="$types,$i" + done + + ebegin "Mounting local file systems" + mount -at "$types" + eend $? "Some local filesystems failed to mount" + + if [ ! -d /proc/bus/usb ]; then + modprobe usbcore &>/dev/null + fi + + if [ -e /proc/filesystems ] ; then + if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ] ; then + local usbfs=$(grep -ow usbfs /proc/filesystems) + + if [ -n "${usbfs}" ] ; then + ebegin "Mounting USB device filesystem" + local gid=$(getent group usb | cut -d: -f3) + mount -t ${usbfs} \ + -o ${gid:+devmode=0664,devgid=${gid},}noexec,nosuid \ + usbfs /proc/bus/usb + eend $? + fi + fi + + if [ -d /proc/fs/nfsd ] ; then + if grep -qs nfsd /proc/filesystems ; then + ebegin "Mounting nfsd filesystem" + mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd + eend $? + fi + fi + fi +} + +reverse_mounts() { + local rev= + while read line ; do + rev="$line\n$rev" + done < /proc/mounts +} + +unmountable() { + local i= + for i in $NO_UNMOUNT ; do + [ "$i" = "$1" ] && return 1 + done + for i in $NET_FS_LIST ; do + [ "$i" = "$2" ] && return 1 + done + return 0 +} + +stop() { + local rev= dev= mnt= rc=0 fs= + ebegin "Unmounting filesystems" + sync ; sync + + while read line ; do + rev="$line\n$rev" + done < /proc/mounts + + echo -e "$rev" | grep -v '^$' | while read dev mnt fs ; do + if unmountable $mnt $fs ; then + umount -r "$mnt" + rc=$(($rc + $?)) + fi + done + + eend $rc +} + diff --git a/init.d/mountall b/init.d/mountall deleted file mode 100644 index d574eb2..0000000 --- a/init.d/mountall +++ /dev/null @@ -1,13 +0,0 @@ -#!/sbin/runscript - -start() { - ebegin "Mounting local filesystems" - mount -a -t nonfs,nonfs4,nosmbfs,nocifs,noncp,noncpfs,nocoda,noocfs2,nogfsi 2>&1 >/tmp/mountdebug - eend $? -} - -stop() { - ebegin "Unmounting local filesystems" - umount -a - eend $? -} diff --git a/init.d/networking b/init.d/networking index b23a0bc..11cb8e7 100755 --- a/init.d/networking +++ b/init.d/networking @@ -5,19 +5,19 @@ start() { ebegin "Configuring network interfaces" - ifup -a + ifup -a >/dev/null 2>&1 eend $? } stop() { ebegin "Deconfiguring network interfaces" - ifdown -a + ifdown -a >/dev/null 2>&1 eend $? } restart() { ebegin "Reconfiguring network interfaces" - ifdown -a && ifup -a + ifdown -a >/dev/null 2>&1 && ifup -a >/dev/null 2>&1 eend $? } diff --git a/init.d/udhcpc b/init.d/udhcpc deleted file mode 100644 index 5b1f4e9..0000000 --- a/init.d/udhcpc +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# /etc/init.d/udhcpc: start or stop udhcpc client - -set -e - -PATH=/bin:/usr/bin:/sbin:/usr/sbin -DAEMON=/sbin/udhcpc - -test -x $DAEMON || exit 0 - -case "$1" in - start) - echo -n "Starting DHCP client: udhcpc" - start-stop-daemon --start --quiet --exec $DAEMON \ - -- --script=/etc/udhcpc.script || echo -n " already running" - echo "." - ;; - - restart) - /etc/init.d/udhcpc stop - /etc/init.d/udhcpc start - ;; - - reload) - ;; - - force-reload) - ;; - - stop) - echo -n "Stopping DHCP client: udhcpc" - start-stop-daemon --stop --quiet --exec $DAEMON || echo -n " not running" - echo "." - ;; - - renew) - start-stop-daemon --signal USR1 --stop --quiet --exec $DAEMON || echo -n " not running" - ;; - - release) - start-stop-daemon --signal USR2 --stop --quiet --exec $DAEMON || echo -n " not running" - ;; - - *) - echo "Usage: /etc/init.d/udhcpc {start|stop|restart|reload|force-reload}" - exit 1 - ;; -esac - -exit 0 |