summaryrefslogtreecommitdiffstats
path: root/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'init.d')
-rw-r--r--init.d/Makefile40
-rwxr-xr-xinit.d/alpinecfg.sh44
-rwxr-xr-xinit.d/bootmisc.sh7
-rwxr-xr-xinit.d/bridge38
-rwxr-xr-xinit.d/checkroot.sh46
-rwxr-xr-xinit.d/coldplug66
-rwxr-xr-xinit.d/cron13
-rwxr-xr-xinit.d/hostname9
-rwxr-xr-xinit.d/hwclock9
-rwxr-xr-xinit.d/hwdrivers48
-rwxr-xr-xinit.d/inetd13
-rwxr-xr-xinit.d/localinit31
-rwxr-xr-xinit.d/mdev37
-rwxr-xr-xinit.d/modutils21
-rw-r--r--init.d/mountall8
-rwxr-xr-xinit.d/networking23
-rwxr-xr-xinit.d/procps10
-rwxr-xr-xinit.d/rcK10
-rwxr-xr-xinit.d/rcL16
-rwxr-xr-xinit.d/rcS59
-rwxr-xr-xinit.d/runtimes109
-rwxr-xr-xinit.d/syslog13
-rwxr-xr-xinit.d/tuntap46
-rwxr-xr-xinit.d/udev32
-rwxr-xr-xinit.d/udevqueue11
-rw-r--r--init.d/udhcpc50
-rwxr-xr-xinit.d/watchdog14
27 files changed, 823 insertions, 0 deletions
diff --git a/init.d/Makefile b/init.d/Makefile
new file mode 100644
index 0000000..954d2b0
--- /dev/null
+++ b/init.d/Makefile
@@ -0,0 +1,40 @@
+SCRIPTS = alpinecfg.sh \
+ bootmisc.sh \
+ bridge \
+ checkroot.sh \
+ coldplug \
+ cron \
+ hostname \
+ hwclock \
+ hwdrivers \
+ inetd \
+ localinit \
+ mdev \
+ modutils \
+ mountall \
+ networking \
+ procps \
+ rcK \
+ rcL \
+ rcS \
+ runtimes \
+ syslog \
+ tuntap \
+ udev \
+ udhcpc \
+ watchdog
+
+all:
+
+install: $(SCRIPTS)
+ install -m 0755 -d $(DESTDIR)/etc
+ install -m 0755 -d $(DESTDIR)/etc/init.d
+
+ for i in $(SCRIPTS) ; do \
+ install -m 755 -D $$i $(DESTDIR)/etc/init.d/$$i ;\
+ done
+
+clean:
+ rm -f *~
+
+.PHONY: all clean
diff --git a/init.d/alpinecfg.sh b/init.d/alpinecfg.sh
new file mode 100755
index 0000000..180b6e8
--- /dev/null
+++ b/init.d/alpinecfg.sh
@@ -0,0 +1,44 @@
+#!/bin/busybox sh
+
+# the purpose of this script is to find and import the alpine config.
+# load it or set default values.
+
+#depracated
+echo "remeber to remove this $0 file..."
+exit
+
+get_boot_var () {
+ # Look for CFG_MEDIA in cmdline
+ for i in `cat /proc/cmdline` ; do
+# if echo $i | grep $ > /dev/null ; then
+# echo $i | sed 's/'$1'=//'
+# fi
+ case $i in
+ $1=*) echo $i | sed 's|'$1'=||' ;;
+ esac
+ done
+}
+
+
+import_config() {
+ if mount $1 ; then
+ echo "Using Alpine config from $1"
+ cp $1/$2 /etc/alpine.conf
+ sleep 1
+ umount $1
+ fi
+}
+
+CFG="alpine.conf"
+CFG_MEDIA=`get_boot_var cfg_media`
+#if [ -z "$CFG_MEDIA" ] ; then
+ # cfg_media was not set in cmdline. We use the defaults...
+ echo "looking for alpine.conf on default locations"
+ for i in /media/* ; do
+ import_config $i $CFG
+ done
+#else
+ # Only import for specified location
+# import_config "/media/$CFG_MEDIA" $CFG
+#fi
+
diff --git a/init.d/bootmisc.sh b/init.d/bootmisc.sh
new file mode 100755
index 0000000..846f236
--- /dev/null
+++ b/init.d/bootmisc.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+#
+# Save kernel messages in /var/log/dmesg
+#
+dmesg -s 65536 > /var/log/dmesg
+
diff --git a/init.d/bridge b/init.d/bridge
new file mode 100755
index 0000000..bfbf057
--- /dev/null
+++ b/init.d/bridge
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+
+BRCTL=`which brctl 2>/dev/null`
+
+start() {
+ # abort if brctl does not exist
+ for brspec in $BRIDGES; do
+ retcode=0
+ br=`echo $brspec | cut -d= -f1`
+ ebegin "Setting up bridge $br"
+ if [ -z "$BRCTL" ] ; then
+ eerror "Need bridge-utils to be able to set up $br"
+ retcode=1
+ else
+ brctl addbr $br || retcode=1
+ bridge_ifs=`echo "$BRIDGES" | sed 's/.*=//; s/\+/ /g'`
+ for iface in $bridge_ifs ; do
+ # set if in promisc mode
+ ifconfig $iface 0.0.0.0 promisc up || retcode=1
+ brctl addif $br $iface || retcode=1
+ done
+ fi
+ eend $retcode
+ done
+
+}
+
+stop() {
+ which brctl > /dev/null 2>&1 || return 1
+ for brspec in $BRIDGES; do
+ br=`echo $brspec | cut -d= -f1`
+ ebegin "Shutting down bridge $br"
+ brctl delbr $br
+ eend $?
+ done
+
+
+}
diff --git a/init.d/checkroot.sh b/init.d/checkroot.sh
new file mode 100755
index 0000000..94fc7ff
--- /dev/null
+++ b/init.d/checkroot.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+rootmode=rw
+rootopts=rw
+rootcheck=yes
+udevfs=
+
+# read the fstab
+sed 's/#.*//' /etc/fstab | while read fs mnt type opts dump pass junk
+do
+ [ "$type" = udevfs ] && udefs="$fs"
+ [ "$mnt" != / ] && continue
+ rootopts="$opts"
+ [ "$pass" = 0 -o "$pass" = "" ] && rootcheck=no
+ case "$opts" in
+ ro|ro,*|*,ro|*,ro,*)
+ rootmode=ro
+ ;;
+ esac
+done
+
+if [ "$rootcheck" = yes ] ; then
+ if grep "^$fs" /proc/mounts ; then
+ echo "$fs is mounted. Something is wrong. Please fix and reboot."
+ echo "sorry newbies..."
+ echo
+ echo "CONTROL-D will exit from this shell and reboot the system."
+ echo
+ /sbin/sulogin $CONSOLE
+ reboot -f
+ elif ! fsck -C "$fs" ; then
+ echo "fsck failed. Please repair manually and reboot. Please note"
+ echo "that the root file system is currently mounted read-only. To"
+ echo "remount it read-write:"
+ echo
+ echo " # mount -n -o remount,rw /"
+ echo
+ echo "CONTROL-D will exit from this shell and REBOOT the system."
+ echo
+ /sbin/sulogin $CONSOLE
+ reboot -f
+ fi
+fi
+
+mount -o remount,$rootmode /
+
diff --git a/init.d/coldplug b/init.d/coldplug
new file mode 100755
index 0000000..a39f39f
--- /dev/null
+++ b/init.d/coldplug
@@ -0,0 +1,66 @@
+#!/sbin/runscript
+
+trigger_uevents() {
+ local i
+ for i in /sys/bus/*/devices/*/uevent\
+ /sys/class/*/*/uevent\
+ /sys/block/*/uevent\
+ /sys/block/*/*/uevent ; do
+ case "$i" in
+ */device/uevent)
+ continue
+ ;;
+ */class/mem/*|*/class/tty/*)
+ echo add > "$i"
+ ;;
+ */block/md*|*/block/dm-*)
+ last="$last $i"
+ ;;
+ */*)
+ default="$default $i"
+ ;;
+ esac
+ done
+ for i in $default $last ; do
+ echo add > "$i"
+ done
+}
+
+# coldplug devices
+start() {
+ unset NOCOLDPLUG
+ # check for boot option "nocoldplug"
+ for i in `cat /proc/cmdline`; do
+ [ "$i" = "nocoldplug" ] && NOCOLDPLUG=true
+ done
+
+ if [ "$NOCOLDPLUG" ]; then
+ ebegin "Skipping coldplugging"
+ eend 0
+ return
+ fi
+
+# for rc in /etc/hotplug/*.rc ; do
+# name=`basename $rc .rc`
+# ebegin "Coldplugging $name devices"
+# $rc start 2>/tmp/coldplug.err
+# eend 0
+# done
+ ebegin "Coldplugging devices"
+# while [ -d /dev/.udev/queue ] ; do
+# sleep 1
+# echo -n "."
+# done
+# trigger_uevents
+# sleep 1
+# while [ -d /dev/.udev/queue ] ; do
+# sleep 1
+# echo -n "."
+# done
+ find /sys -name modalias | while read a ; do
+ modprobe `cat $a` 2>/dev/null || echo $a >> /tmp/failed
+ done
+ eend 0
+}
+
+
diff --git a/init.d/cron b/init.d/cron
new file mode 100755
index 0000000..280035e
--- /dev/null
+++ b/init.d/cron
@@ -0,0 +1,13 @@
+#!/sbin/runscript
+
+start() {
+ ebegin "Starting cron"
+ crond $CRON_OPTS
+ eend $?
+}
+
+stop () {
+ ebegin "Stopping cron"
+ killall crond
+ eend $?
+}
diff --git a/init.d/hostname b/init.d/hostname
new file mode 100755
index 0000000..5ce489c
--- /dev/null
+++ b/init.d/hostname
@@ -0,0 +1,9 @@
+#!/sbin/runscript
+
+start() {
+ if [ -f /etc/hostname ] ; then
+ ebegin "Setting hostname"
+ hostname -F /etc/hostname
+ eend $?
+ fi
+}
diff --git a/init.d/hwclock b/init.d/hwclock
new file mode 100755
index 0000000..c488c43
--- /dev/null
+++ b/init.d/hwclock
@@ -0,0 +1,9 @@
+#!/sbin/runscript
+
+start() {
+ ebegin "Setting system time from hardware clock"
+ modprobe rtc 2>/dev/null
+ #set the system time from hardware clock
+ /sbin/hwclock -s -u
+ eend $?
+}
diff --git a/init.d/hwdrivers b/init.d/hwdrivers
new file mode 100755
index 0000000..de0e34a
--- /dev/null
+++ b/init.d/hwdrivers
@@ -0,0 +1,48 @@
+#!/sbin/runscript
+
+SEC=`date +%s`
+
+# echo a . every second
+timer_dots() {
+ local newsec=`date +%s`
+ if [ "$SEC" != "$newsec" ] ; then
+ echo -n '.'
+ SEC=$newsec
+ fi
+}
+
+# Load hardware drivers
+start() {
+ # check for boot option "nocoldplug"
+ for i in `cat /proc/cmdline`; do
+ case $i in
+ modules=*)
+ MODULES="`echo ${i#modules=} | tr ',' ' '`";;
+ noautodetect)
+ AUTODETECT=no;;
+ esac
+
+ done
+
+ if [ "$MODULES" ] || [ "$AUTODETECT" != no ] ; then
+ ebegin "Loading hardware drivers"
+ else
+ ebegin "Skipping hardware drivers"
+ eend
+ return
+ fi
+
+ [ "$MODULES" ] && modprobe $MODULES 2> /dev/null
+ timer_dots
+
+ if [ "$AUTODETECT" != no ] ; then
+ find /sys -name modalias | while read a ; do
+ modprobe `cat $a` 2>/dev/null || \
+ echo $a >> /tmp/hwdrivers.failed
+ timer_dots
+ done
+ fi
+ eend 0
+}
+
+
diff --git a/init.d/inetd b/init.d/inetd
new file mode 100755
index 0000000..eb2439f
--- /dev/null
+++ b/init.d/inetd
@@ -0,0 +1,13 @@
+#!/sbin/runscript
+
+start() {
+ ebegin "Starting inetd"
+ inetd $INETD_OPTS
+ eend $?
+}
+
+stop () {
+ ebegin "Stopping inetd"
+ killall inetd
+ eend $?
+}
diff --git a/init.d/localinit b/init.d/localinit
new file mode 100755
index 0000000..030a0fc
--- /dev/null
+++ b/init.d/localinit
@@ -0,0 +1,31 @@
+#!/sbin/runscript
+
+mount_once() {
+ if mount | grep $1 >/dev/null 2>&1 ; then
+ NOUMOUNT=$1
+ else
+ mount $1 >/dev/null 2>&1
+ fi
+}
+
+umount_once() {
+ [ "$NOUMOUNT" != "$1" ] && umount "$1" 2>/dev/null
+}
+
+start() {
+ for media in $MOUNTS ; do
+ m="/media/$media"
+ mount_once $m
+ if [ -e $m/localinit ] ; then
+ ebegin "Running localinit from $media"
+ $m/localinit
+ retcode=$?
+ umount_once $m
+ eend $retcode
+ exit
+ fi
+ sleep 1
+ umount_once $m
+ done
+}
+
diff --git a/init.d/mdev b/init.d/mdev
new file mode 100755
index 0000000..c474175
--- /dev/null
+++ b/init.d/mdev
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+
+start() {
+ # check if udev is specified on cmd line
+ for i in `cat /proc/cmdline`; do
+ [ "$i" = "udev" ] && return 0
+ done
+
+ ebegin "Starting mdev"
+ mkdir -p /dev
+
+ # start mdev
+ mount /dev
+ mknod -m 666 /dev/null c 1 3
+
+ # use mdev for hotplug
+ echo "/sbin/mdev" > /proc/sys/kernel/hotplug
+
+ # create devices
+ mdev -s
+ RC=$?
+
+ # create pts file system
+ [ -d /dev/pts ] || mkdir -m 755 /dev/pts
+ [ -c /dev/ptmx ] || mknod -m 666 /dev/ptmx c 5 2
+ mount /dev/pts
+ [ -d /dev/shm ] || mkdir /dev/shm
+ mount /dev/shm
+ eend $RC
+}
+
+stop() {
+ ebegin "Stopping mdev"
+ echo "" > /proc/sys/kernel/hotplug
+ umount /dev/pts && umount /dev/shm && umount /dev
+ eend
+}
diff --git a/init.d/modutils b/init.d/modutils
new file mode 100755
index 0000000..0a6c8c5
--- /dev/null
+++ b/init.d/modutils
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+
+PATH="/sbin:/bin:/usr/bin:/usr/bin"
+
+start() {
+#[ -e /sbin/depmod ] || exit 0
+#echo -n "Calculating module dependencies... "
+#depmod -a > /dev/null
+#echo "done."
+
+ if [ -f /etc/modules ] ; then
+ sed 's/\#.*//g' < /etc/modules |
+ while read module args
+ do
+ ebegin "Loading $module"
+ modprobe -q $module $args
+ eend $?
+ done
+ fi
+}
+
diff --git a/init.d/mountall b/init.d/mountall
new file mode 100644
index 0000000..8d0f306
--- /dev/null
+++ b/init.d/mountall
@@ -0,0 +1,8 @@
+#!/sbin/runscript
+
+start() {
+ ebegin "Mounting local filesystems"
+ mount -a -t nonfs,nonfs4,nosmbfs,nocifs,noncp,noncpfs,nocoda,noocfs2,nogfs 2>&1 >/tmp/mountdebug
+ eend $?
+}
+
diff --git a/init.d/networking b/init.d/networking
new file mode 100755
index 0000000..b23a0bc
--- /dev/null
+++ b/init.d/networking
@@ -0,0 +1,23 @@
+#!/sbin/runscript
+
+# note that the spoofprotect, syncoockies and ip_forward options are set in
+# /etc/sysctl.conf
+
+start() {
+ ebegin "Configuring network interfaces"
+ ifup -a
+ eend $?
+}
+
+stop() {
+ ebegin "Deconfiguring network interfaces"
+ ifdown -a
+ eend $?
+}
+
+restart() {
+ ebegin "Reconfiguring network interfaces"
+ ifdown -a && ifup -a
+ eend $?
+}
+
diff --git a/init.d/procps b/init.d/procps
new file mode 100755
index 0000000..0a8bd8f
--- /dev/null
+++ b/init.d/procps
@@ -0,0 +1,10 @@
+#!/sbin/runscript
+
+start() {
+ if [ -r /etc/sysctl.conf ] ; then
+ ebegin "Setting kernel variables"
+ /sbin/sysctl -p /etc/sysctl.conf >/dev/null
+ eend $?
+ fi
+}
+
diff --git a/init.d/rcK b/init.d/rcK
new file mode 100755
index 0000000..5a22f41
--- /dev/null
+++ b/init.d/rcK
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
+
+echo ""
+for i in `for j in /etc/rcK.d/K* ; do echo $j ; done | sort -r` ; do
+ [ -f $i ] && $i stop
+done
+exit 0
+
diff --git a/init.d/rcL b/init.d/rcL
new file mode 100755
index 0000000..7c6b3f7
--- /dev/null
+++ b/init.d/rcL
@@ -0,0 +1,16 @@
+#!/bin/busybox sh
+
+export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
+
+for i in `seq 0 9` ; do
+ # first stopp all the K?? scripts in this level
+ for j in /etc/rcL.d/K$i[0-9]* ; do
+ [ -f $j ] && $j stop
+ done
+ # start all S?? scripts in this level
+ for j in /etc/rcL.d/S$i[0-9]* ; do
+ [ -f $j ] && $j start
+ done
+done
+exit 0
+
diff --git a/init.d/rcS b/init.d/rcS
new file mode 100755
index 0000000..017d105
--- /dev/null
+++ b/init.d/rcS
@@ -0,0 +1,59 @@
+#!/bin/busybox sh
+
+# we need the proc to be able to install busybox
+/bin/busybox mkdir -p /proc /usr/sbin /sys
+/bin/busybox mount -t proc proc /proc
+/bin/busybox mount -t sysfs none /sys
+
+# install busybox links
+/bin/busybox --install -s
+
+[ -f /etc/alpine-release ] && read RELEASE BUILD < /etc/alpine-release
+echo "Starting $RELEASE"
+
+export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
+
+# use dash if it exists
+[ -x /bin/dash ] && ln -sf /bin/dash /bin/sh
+
+# define some default variables
+export DEFAULT_CFG_MOUNTS="/media/cdrom /media/floppy /media/usb"
+export DEFAULT_ALPINE_CONF="/alpine.conf"
+export DEFAULT_ALPINE_PACKAGES="/packages.conf"
+export DEFAULT_PKG_PATH="cdrom://apks"
+
+# start an rc script. Look if there are a no<service> in /proc/cmdline
+start_script() {
+ local n
+ if [ -f $1 ] ; then
+ for n in `cat /proc/cmdline`; do
+ [ "$n" = "s" ] && SINGLEMODE=yes
+ case $1 in
+ S??no$n) return 1;;
+ esac
+ done
+ case $1 in
+ *.sh) . $1 start;;
+ *) $1 start;;
+ esac
+ fi
+}
+
+# hide kernel messages
+dmesg -n 1
+
+for i in `cat /proc/cmdline` ;do
+ case $i in
+ 1|s|single)
+ echo "Entering single mode. Type 'exit' to continue booting."
+ sh
+ ;;
+ esac
+done
+
+# Run all /etc/rcS.d scripts
+for j in /etc/rcS.d/S* ; do
+ start_script $j
+done
+exit 0
+
diff --git a/init.d/runtimes b/init.d/runtimes
new file mode 100755
index 0000000..41d0a0e
--- /dev/null
+++ b/init.d/runtimes
@@ -0,0 +1,109 @@
+#!/sbin/runscript
+
+# The purpose of this script is to load the Alpine runtime modules and the
+# local config that belongs to.
+
+SFIC=`which sfic 2>/dev/null`
+COMMITED_TDB=/var/lib/apk/commited.tdb
+
+# search for a kernel argument
+get_karg () {
+ for i in `cat /proc/cmdline` ; do
+ case $i in
+ $1=*) echo $i | sed 's|'$1'=||' ;;
+ esac
+ done
+}
+
+get_pkg_list() {
+ # we skip lines that start with '#'
+ grep -v '^#' $1 | while read pkg ; do
+ for i in $pkg ; do
+ echo -n "$pkg "
+ done
+ done
+}
+
+# load packages from mounted media
+load_pkgs_and_config() {
+ # params:
+ # $1 = path to mounted media
+ # $2 =
+ local apk_list mnt ovl allpkgs pkg
+ mnt=$1
+ apk_list="$mnt/packages.list"
+ if [ -f "$apk_list" ] ; then
+ echo "
+ Loading packages from $apk_list:"
+ apk_fetch -u -q
+ for pkg in `get_pkg_list $apk_list` ; do
+ apk_add -q $pkg
+ echo " $pkg"
+ done
+ fi
+ cd /
+ # look for apk overlays.
+ for ovl in $mnt/*.apkovl.tar.gz ; do
+ if [ -f $ovl ] ; then
+ # remember to remove leading /
+ ovllist=`tar -C / -zvxf $ovl | sed 's:^/::'`
+ if [ "$ovllist" ] ; then
+ echo " Reading overlay: $ovl"
+ lbu update $ovllist 2>/dev/null
+ fi
+ fi
+ done
+}
+
+mount_once() {
+ if grep $1 < /proc/mounts >/dev/null 2>&1 ; then
+ NOUMOUNT=$1
+ else
+ mount $1 >/dev/null 2>&1
+ fi
+}
+
+umount_once() {
+ [ "$NOUMOUNT" != "$1" ] && umount "$1" 2>/dev/null
+}
+
+start() {
+ ebegin "Searching for local configurations"
+ # just in case...
+ modprobe usb-storage 2>/dev/null
+ modprobe sd_mod 2>/dev/null
+ modprobe floppy 2>/dev/null
+ modprobe cdrom 2>/dev/null
+
+ # if pkg_path is not specified as kernel arg, look for the packages
+ # on mounted cdrom
+ APK_PATH=`get_karg pkg_path`
+
+ # read configs if available
+ [ -f /etc/apk.conf ] && . /etc/apk.conf
+
+ [ -z "$APK_PATH" ] && APK_PATH="cdrom://apks"
+ export APK_PATH
+
+ # APK_CFG_MOUNTS
+ # if set, will only try to mount those, other wise try everything
+ # in /media/*
+ if [ "$APK_CFG_MOUNTS" ] ; then
+ mounts="$APK_CFG_MOUNTS"
+ else
+ mounts="*"
+ fi
+
+ cd /media
+ for m in $mounts ; do
+ mount_once /media/$m
+ load_pkgs_and_config /media/$m
+ sleep 1
+ umount_once /media/$m
+ done
+ eend
+
+ # if there are no /etc/apk.conf, create one
+ [ -f /etc/apk.conf ] || echo "APK_PATH=$APK_PATH" > /etc/apk.conf
+}
+
diff --git a/init.d/syslog b/init.d/syslog
new file mode 100755
index 0000000..f60a981
--- /dev/null
+++ b/init.d/syslog
@@ -0,0 +1,13 @@
+#!/sbin/runscript
+
+start() {
+ ebegin "Starting system logging"
+ syslogd && klogd
+ eend $?
+}
+
+stop () {
+ ebegin "Stopping system logging"
+ killall klogd && killall syslogd
+ eend $?
+}
diff --git a/init.d/tuntap b/init.d/tuntap
new file mode 100755
index 0000000..667acb9
--- /dev/null
+++ b/init.d/tuntap
@@ -0,0 +1,46 @@
+#!/sbin/runscript
+
+OPENVPN=`which openvpn 2>/dev/null`
+TUNCTL=`which tunctl 2>/dev/null`
+
+if [ -x "$OPENVPN" ] ; then
+ CREATETAP="$OPENVPN --mktun --dev"
+else
+ CREATETAP="$TUNCTL -t"
+fi
+
+
+start() {
+ # verify tun/tap support in kernel
+ if ! [ -e /dev/net/tun ] ; then
+ modprobe tun 2>&1 >/dev/null && sleep 1
+ if ! [ -e /dev/net/tun ] ; then
+ eerror "Tun/Tap support is not present in kernel"
+ return 1
+ fi
+ fi
+
+ # verify if openvpn is present
+ if [ -x "$OPENVPN" ] ; then
+ MKTUNTAP="$OPENVPN --mktun --dev"
+ elif [ -x "$TUNCTL" ] ; then
+ MKTUNTAP="$TUNCTL -t"
+ else
+ eerror "Needs openvpn or tunctl to create Tun/Tap devices"
+ return 1
+ fi
+
+ # create devices
+ for iface in $DEVICES ; do
+ ebegin "Creating Tun/Tap interface $iface"
+ $MKTUNTAP $iface >/dev/null
+ eend $?
+ done
+}
+
+stop() {
+ ebegin "Destroying Tun/Tap interfaces"
+ rmmod tun 2>/dev/null
+ eend $?
+}
+
diff --git a/init.d/udev b/init.d/udev
new file mode 100755
index 0000000..0aa1287
--- /dev/null
+++ b/init.d/udev
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+
+start() {
+ ebegin "Starting udev"
+ #init sysfs
+ mkdir -p /dev
+
+ # use udevsend for hotplug
+ #echo /sbin/udevsend > /proc/sys/kernel/hotplug
+ echo "" > /proc/sys/kernel/hotplug
+
+ # start udev
+ mount /dev
+ start-stop-daemon --start --quiet --exec /sbin/udevd -- --daemon
+ udevstart 2>/dev/tty10
+ RC=$?
+
+ # create pts file system
+ [ -d /dev/pts ] || mkdir -m 755 /dev/pts
+ [ -c /dev/ptmx ] || mknod -m 666 /dev/ptmx c 5 2
+
+ mount /dev/pts
+ eend $RC
+}
+
+stop() {
+ ebegin "Stopping udev"
+ start-stop-daemon --stop --quiet --exec /sbin/udevd
+ RC=$?
+ umount /dev/pts && umount /dev
+ eend $RC
+}
diff --git a/init.d/udevqueue b/init.d/udevqueue
new file mode 100755
index 0000000..4bf6d93
--- /dev/null
+++ b/init.d/udevqueue
@@ -0,0 +1,11 @@
+#!/sbin/runscript
+
+start() {
+ ebegin "Waiting on udev queue"
+ while [ -d /dev/.udev/queue ] ; do
+ sleep 1
+ echo -n "."
+ done
+ eend 0
+}
+
diff --git a/init.d/udhcpc b/init.d/udhcpc
new file mode 100644
index 0000000..5b1f4e9
--- /dev/null
+++ b/init.d/udhcpc
@@ -0,0 +1,50 @@
+#!/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
diff --git a/init.d/watchdog b/init.d/watchdog
new file mode 100755
index 0000000..b4b3ae7
--- /dev/null
+++ b/init.d/watchdog
@@ -0,0 +1,14 @@
+#!/sbin/runscript
+
+start() {
+ [ "$WATCHDOG_DEV" ] || die "WATCHDOG_DEV is not set"
+ ebegin "Starting $SVCNAME"
+ $SVCNAME $WATCHDOG_OPTS $WATCHDOG_DEV
+ eend $?
+}
+
+stop () {
+ ebegin "Stopping $SVCNAME"
+ killall $SVCNAME
+ eend $?
+}