diff options
Diffstat (limited to 'projectroot/etc/init.d')
60 files changed, 2913 insertions, 0 deletions
diff --git a/projectroot/etc/init.d/NetworkManager b/projectroot/etc/init.d/NetworkManager new file mode 100644 index 000000000..50a5467ad --- /dev/null +++ b/projectroot/etc/init.d/NetworkManager @@ -0,0 +1,84 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: NetworkManager +# Required-Start: $remote_fs dbus hal +# Required-Stop: $remote_fs dbus hal +# Should-Start: $syslog +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: network connection manager +# Description: Daemon for automatically switching network +# connections to the best available connection. +### END INIT INFO + +set -e + +prefix=/usr +exec_prefix=/usr +sbindir=${exec_prefix}/sbin +localstatedir=/var + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="network connection manager" +NAME="NetworkManager" + +DAEMON=${sbindir}/$NAME + +PIDDIR=${localstatedir}/run +PIDFILE=$PIDDIR/$NAME.pid +CONFFILE=$PIDDIR/$NAME.conf +STATEFILE=$PIDDIR/$NAME.state + +DAEMON_OPTS="--config=$CONFFILE --state-file=$STATEFILE" + +USER=root + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +test -f /etc/default/NetworkManager && . /etc/default/NetworkManager + +# +# Function that starts the daemon/service. +# +d_start() { + /lib/init/nm-unmanage.sh + + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --oknodo --user $USER --exec $DAEMON -- $DAEMON_OPTS --pid-file $PIDFILE + +} + +# +# Function that stops the daemon/service. +# +d_stop() { + start-stop-daemon --stop --retry 5 --quiet --pidfile $PIDFILE \ + --oknodo --user $USER --exec $DAEMON + +} + + +case "$1" in + start) + echo "Starting $DESC" "$NAME" + d_start + ;; + stop) + echo "Stopping $DESC" "$NAME" + d_stop + ;; + restart|force-reload) + echo "Restarting $DESC" "$NAME" + d_stop + d_start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/acpid b/projectroot/etc/init.d/acpid new file mode 100644 index 000000000..81e97631b --- /dev/null +++ b/projectroot/etc/init.d/acpid @@ -0,0 +1,41 @@ +#!/bin/sh + +DAEMON=/usr/sbin/acpid +PIDFILE=/var/run/acpid.pid + +case $1 in +start) + echo "starting acpid" + + # don't use acpid if proc/acpi is not there. + if [ ! -e /proc/acpi/event ]; then + echo "failed" + echo "error: proc/acpi/event not here" + exit 1 + fi + + # Start the acpid daemon to continually + # watch for, and act on, acpievents + echo -n "Starting acpid..." + start-stop-daemon --start --oknodo \ + --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS + + if [ "$?" = "0" ]; then + echo "done" + exit 0 + else + echo "failed" + exit 1 + fi + + ;; +stop) + echo "Stopping acpid" + start-stop-daemon --stop --oknodo --quiet \ + --pidfile $PIDFILE --exec $DAEMON + ;; +*) + echo "usage: $0 [start|stop]" + ;; +esac + diff --git a/projectroot/etc/init.d/alsa-utils b/projectroot/etc/init.d/alsa-utils new file mode 100644 index 000000000..cacd5fa81 --- /dev/null +++ b/projectroot/etc/init.d/alsa-utils @@ -0,0 +1,30 @@ +#!/bin/sh +# +# /etc/init.d/alsa-utils +# + +case "$1" in + + start|restart|force-reload) + if [ ! -d /dev/snd ]; then + echo "sound not supported, skipping mixer state" + exit 0 + fi + echo -n "restoring mixer state..." + if [ -f /etc/asound.state ]; then + /usr/sbin/alsactl restore -f /etc/asound.state + echo "done" + else + echo "no /etc/asound.state, aborting" + fi + ;; + stop) + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/apache2 b/projectroot/etc/init.d/apache2 new file mode 100644 index 000000000..a8cf04f7e --- /dev/null +++ b/projectroot/etc/init.d/apache2 @@ -0,0 +1,44 @@ +#!/bin/sh +# +# /etc/init.d/apache2 +# +NAME=apache2 + +# +# This is an workaround, if the path targets into a ramfs +# +mkdir -p @LOGPATH@ + +case "$1" in + start) + echo -n "Starting $NAME: " + if /usr/sbin/apache2 -f @APACHECONFIG@ -k start; then + echo "Done" + else + echo "Failed" + fi + ;; + + stop) + echo -n "Stopping $NAME: " + if /usr/sbin/apache2 -f @APACHECONFIG@ -k stop; then + echo "Done" + else + echo "Failed" + fi + ;; + + restart) + echo -n "Restarting $NAME: " + if /usr/sbin/apache2 -f @APACHECONFIG@ -k restart; then + echo "Done" + else + echo "Failed" + fi + ;; + + *) + echo "Usage: /etc/init.d/$NAME {start|stop|restart}" + exit 1 + ;; +esac diff --git a/projectroot/etc/init.d/atd b/projectroot/etc/init.d/atd new file mode 100644 index 000000000..7253f646c --- /dev/null +++ b/projectroot/etc/init.d/atd @@ -0,0 +1,37 @@ +#!/bin/sh + +# +# atd +# +PATH=/usr/bin:/usr/sbin:/bin:/sbin + +PREFIX="atd: " +ATD="/usr/sbin/atd" +PIDFILE=/var/run/atd.pid + +case $1 in + start) + echo "${PREFIX}starting" + + if start-stop-daemon -S -q -o -x ${ATD} -p ${PIDFILE}; then + echo "${PREFIX}done" + else + echo "${PREFIX}error, could not start server" + fi + ;; + + stop) + echo "${PREFIX}stoppping" + + if start-stop-daemon -K -q -o -x ${ATD} -p ${PIDFILE}; then + echo "${PREFIX}done" + else + echo "${PREFIX}error, could not stop server" + fi + ;; + + *) + echo "${PREFIX}usage: ${0} [start|stop]" + exit 1 + ;; +esac diff --git a/projectroot/etc/init.d/avahi-daemon b/projectroot/etc/init.d/avahi-daemon new file mode 100644 index 000000000..27c22cc52 --- /dev/null +++ b/projectroot/etc/init.d/avahi-daemon @@ -0,0 +1,101 @@ +#!/bin/sh +# +# This is a avahi-daemon init.d script which is called by init(1) with [start|stop] as argument +# Mi 22. Jul 21:46:28 CEST 2009 + +#set -e +PATH=/sbin:/bin:/usr/bin +BINARY=/usr/sbin/avahi-daemon +OPTIONS="-D" + +test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 0; } +test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon + +start_proc(){ +$BINARY -c && return 0 +$BINARY $OPTIONS +case $? in + 0) + echo " [+] (avahi-daemon)" + ;; + *) + echo " [!] (avahi-daemon)" + ;; +esac +} + +stop_proc(){ +if $BINARY -c ; then + $BINARY -k + case $? in + 0) + echo " [-] (avahi-daemon)" + ;; + *) + echo " [!] (avahi-daemon)" + ;; + esac +fi +} + +refresh_proc(){ +if $BINARY -c ; then + $BINARY -r + case $? in + 0) + echo " [*] (avahi-daemon)" + ;; + *) + echo " [!] (avahi-daemon)" + ;; + esac +fi +} + +check_proc(){ +$BINARY -c +case $? in + 0) + echo " [+] (avahi-daemon)" + ;; + *) + echo " [-] (avahi-daemon)" + ;; +esac +} + + + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart|force-reload) + stop_proc + sleep 2 + start_proc + ;; + reload) + refresh_proc + ;; + status) + check_proc + ;; + *) + echo "Usage: $0 {start|stop|status|reload|restart|force-reload}" + echo "" + echo "Status Flags:" + echo "[+] -> started" + echo "[-] -> not started" + echo "[*] -> reloaded" + echo "[!] -> error - please debug without -D option" + echo "" + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/boa b/projectroot/etc/init.d/boa new file mode 100644 index 000000000..53c28d715 --- /dev/null +++ b/projectroot/etc/init.d/boa @@ -0,0 +1,23 @@ +#!/bin/sh + +# See how we were called. +case "$1" in + start) + echo -n "Starting boa: " + /usr/sbin/boa + echo + ;; + stop) + echo -n "Shutting down boa: " + killall boa + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit 0 diff --git a/projectroot/etc/init.d/chrony b/projectroot/etc/init.d/chrony new file mode 100644 index 000000000..e7e937ae3 --- /dev/null +++ b/projectroot/etc/init.d/chrony @@ -0,0 +1,167 @@ +#!/bin/sh +# +# This is a chrony init.d script which ist called by init(1) +# with [start|stop] as argument. This version does not +# need an additional start-stop daemon. +# +# Last change: Bjørn Bürger <b.buerger@pengutronix.de> +# Date: Tue Mar 6 16:00:30 UTC 2007 + +PATH=/sbin:/bin:/usr/bin:/usr/sbin +BINARY="/usr/sbin/chronyd" +CONFIG="/etc/chrony/chrony.conf" +PREFIX="chrony: " +# This system doesn´t have full rtc ioctl support for +# chrony statistic functions +RTC_IOCTL="incomplete" + +# some chronyc commands need prior autentication: extract keys from config +KEY=$(awk '$1 ~ /^commandkey$/ { print $2; exit}' /etc/chrony/chrony.conf) +PASSWORD=`awk '$1 ~ /^'$KEY'$/ {print $2; exit}' /etc/chrony/chrony.keys` + +# convenience functions +message(){ + echo "${PREFIX}$*" >&2 +} + +message_n(){ + echo -n "${PREFIX}$*" >&2 +} + +bailout(){ + echo "${PREFIX}ERROR --- $*" >&2 + exit 1 +} + +usage(){ + echo "Usage: $0 {start|stop|restart|force-reload|online|offline|set-rtc|status|statistics}" +} + +killproc() { + killall $1 +} + +# main functions +start_proc() { + message_n "Reading system time from RealTimeClock ..." + /sbin/hwclock --hctosys || message_n " ### FAILED ### " + message "DONE" + message_n "Starting NTP server: chronyd ..." + [ -e "$CONFIG" ] || bailout "Configfile $CONFIG not found, PANIC!" + $BINARY -f $CONFIG + message "DONE" +} + +stop_proc() { + message_n "Stopping NTP server: chronyd ..." + killproc chronyd + message "DONE" + message_n "Writing system time to RealTimeClock ..." + /sbin/hwclock --systohc || message_n " ### FAILED ### " + message "DONE" +} + +set_online(){ + message_n "Setting NTP server ONLINE ... " + /bin/pidof chronyd > /dev/null || bailout " chronyd is not running " + /usr/bin/chronyc <<-EOF + password $PASSWORD + online + burst 5/10 + quit + EOF + message "DONE" + exit 0 +} + +set_offline(){ + message_n "Setting NTP server OFFLINE ... " + /bin/pidof chronyd > /dev/null || bailout " chronyd is not running " + /usr/bin/chronyc <<-EOF + password $PASSWORD + offline + EOF + message "DONE" + exit 0 +} + +set_rtc(){ + /bin/pidof chronyd > /dev/null || bailout " chronyd is not running " + if [ "$RTC_IOCTL" == "incomplete" ] ; then + # We are running on a system with limited rtc support, + # so we cannot let the ntp client do the job. + stop_proc + sleep 1 + start_proc + exit 0 + else + # This requires enhanced rtc support + message_n "Setting NTP time to RTC ... " + cat <<-EOF | /usr/bin/chronyc + password $PASSWORD + trimrtc + writertc + dump + EOF + message "DONE" + exit 0 + fi +} + +status(){ + /bin/pidof chronyd > /dev/null || bailout " chronyd is not running " + cat <<-EOF | /usr/bin/chronyc + password $PASSWORD + tracking + sources + EOF +} + +statistics(){ + /bin/pidof chronyd > /dev/null || bailout " chronyd is not running " + cat <<-EOF | /usr/bin/chronyc + password $PASSWORD + sourcestats + EOF +} + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart|force-reload) + message "Restarting NTP server: chronyd ... " + stop_proc + sleep 1 + start_proc + ;; + reload) + message "Reload is not supported" + exit 1 + ;; + online) + set_online + ;; + offline) + set_offline + ;; + set-rtc) + set_rtc + ;; + status) + status + ;; + statistics) + statistics + ;; + *) + usage + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/connman b/projectroot/etc/init.d/connman new file mode 100644 index 000000000..043f6891c --- /dev/null +++ b/projectroot/etc/init.d/connman @@ -0,0 +1,37 @@ +#!/bin/sh + +DAEMON=/usr/sbin/connmand +DESC="Connection Manager" + +set -e + +do_start() { + start-stop-daemon --start --oknodo --exec $DAEMON -- $DAEMON_OPTS +} + +do_stop() { + start-stop-daemon --stop --oknodo --quiet --exec $DAEMON +} + +case "$1" in + start) + echo "Starting $DESC" + do_start || echo "failed" + ;; + stop) + echo "Stopping $DESC" + do_stop || echo "failed" + ;; + restart|force-reload) + echo "Restarting $DESC" + do_stop + sleep 1 + do_start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/crond b/projectroot/etc/init.d/crond new file mode 100644 index 000000000..02cabb385 --- /dev/null +++ b/projectroot/etc/init.d/crond @@ -0,0 +1,13 @@ +#!/bin/sh +# +# crond +# +case $1 in + + start) + echo "crond starting" + /usr/sbin/crond + ;; + +esac + diff --git a/projectroot/etc/init.d/cvs b/projectroot/etc/init.d/cvs new file mode 100644 index 000000000..b6d9150ac --- /dev/null +++ b/projectroot/etc/init.d/cvs @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "FIXME: please implement $0" + diff --git a/projectroot/etc/init.d/dbus b/projectroot/etc/init.d/dbus new file mode 100644 index 000000000..8af60f1b7 --- /dev/null +++ b/projectroot/etc/init.d/dbus @@ -0,0 +1,84 @@ +#! /bin/sh +# -*- coding: utf-8 -*- +# Modified Debian init.d script for D-Bus on Pengutronix OSELAS Embedded Linux +# Copyright © 2003 Colin Walters <walters@debian.org> +# Copyright © 2005 Sjoerd Simons <sjoerd@debian.org> +# Adapted to OSELAS/PTXdist 2006 Roland Hostettler <r.hostettler@gmx.ch> + +set -e + +DAEMON=/usr/bin/dbus-daemon +NAME=dbus +DAEMONUSER=messagebus +PIDDIR=/var/run/dbus +PIDFILE=$PIDDIR/pid +DESC="system message bus" +EVENTDIR=/etc/dbus-1/event.d + +test -x $DAEMON || exit 0 + +PARAMS="" + +start_it_up() +{ + if [ ! -d $PIDDIR ]; then + mkdir -p $PIDDIR + chown $DAEMONUSER $PIDDIR + chgrp $DAEMONUSER $PIDDIR + fi + if [ -e $PIDFILE ]; then + PIDDIR=/proc/`cat $PIDFILE` + if [ -d ${PIDDIR} -a "`readlink -f ${PIDDIR}/exe`" = "${DAEMON}" ]; then + echo "$DESC already started; not starting." + else + echo "Removing stale PID file $PIDFILE." + rm -f $PIDFILE + fi + fi + echo -n "Starting $DESC:" "$NAME" + $DAEMON --system $PARAMS + echo "." + if [ -d $EVENTDIR ]; then + run-parts -a start $EVENTDIR || true + fi +} + +shut_it_down() +{ + echo -n "Stopping $DESC:" "$NAME" + kill `cat $PIDFILE` + echo "." + rm -f $PIDFILE +} + +reload_it() +{ + echo -n "Reloading $DESC config" + dbus-send --print-reply --system --type=method_call \ + --dest=org.freedesktop.DBus \ + / org.freedesktop.DBus.ReloadConfig > /dev/null + # hopefully this is enough time for dbus to reload it's config file. + echo "." +} + +case "$1" in +start) + start_it_up + ;; +stop) + shut_it_down + ;; + reload|force-reload) + reload_it + ;; +restart) + shut_it_down + start_it_up + ;; +*) + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/dibbler-client b/projectroot/etc/init.d/dibbler-client new file mode 100644 index 000000000..11d2b17d4 --- /dev/null +++ b/projectroot/etc/init.d/dibbler-client @@ -0,0 +1,50 @@ +#! /bin/sh +# +# Starts/stops dibbler-client +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/dibbler-client +NAME=dibbler-client +DESC="DHCPv6 client" +DAEMON_OPTS=run + +test -x $DAEMON || exit 0 + +# Include dibbler defaults if available +if [ -f /etc/default/dibbler ] ; then + . /etc/default/dibbler +fi + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + $DAEMON start 2>&1 > /dev/null + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + ($DAEMON stop 2>&1 > /dev/null; true) + echo "$NAME." + ;; + status) + echo "Status $DESC: $NAME" + $DAEMON status + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + ($DAEMON stop 2>&1 > /dev/null; true) + sleep 1 + $DAEMON start 2>&1 > /dev/null + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/dibbler-relay b/projectroot/etc/init.d/dibbler-relay new file mode 100644 index 000000000..292535834 --- /dev/null +++ b/projectroot/etc/init.d/dibbler-relay @@ -0,0 +1,50 @@ +#! /bin/sh +# +# Starts/stops dibbler-relay +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/dibbler-relay +NAME=dibbler-relay +DESC="DHCPv6 relay" +DAEMON_OPTS=run + +test -x $DAEMON || exit 0 + +# Include dibbler defaults if available +if [ -f /etc/default/dibbler ] ; then + . /etc/default/dibbler +fi + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + $DAEMON start 2>&1 > /dev/null + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + ($DAEMON stop 2>&1 > /dev/null; true) + echo "$NAME." + ;; + status) + echo "Status $DESC: $NAME" + $DAEMON status + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + ($DAEMON stop 2>&1 > /dev/null; true) + sleep 1 + $DAEMON start 2>&1 > /dev/null + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/dibbler-server b/projectroot/etc/init.d/dibbler-server new file mode 100644 index 000000000..d03c0c021 --- /dev/null +++ b/projectroot/etc/init.d/dibbler-server @@ -0,0 +1,50 @@ +#! /bin/sh +# +# Starts/stops dibbler-client +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/dibbler-server +NAME=dibbler-server +DESC="DHCPv6 server" +DAEMON_OPTS=run + +test -x $DAEMON || exit 0 + +# Include dibbler defaults if available +if [ -f /etc/default/dibbler ] ; then + . /etc/default/dibbler +fi + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + $DAEMON start 2>&1 > /dev/null + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + ($DAEMON stop 2>&1 > /dev/null; true) + echo "$NAME." + ;; + status) + echo "Status $DESC: $NAME" + $DAEMON status + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + ($DAEMON stop 2>&1 > /dev/null; true) + sleep 1 + $DAEMON start 2>&1 > /dev/null + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/dnsmasq b/projectroot/etc/init.d/dnsmasq new file mode 100644 index 000000000..6e6aa5dbc --- /dev/null +++ b/projectroot/etc/init.d/dnsmasq @@ -0,0 +1,32 @@ +#!/bin/sh +# +# /etc/init.d/dnsmasq +# +# $Id$ +# +PIDFILE=/var/run/dnsmasq.pid + +case $1 in + + start) + test -e $PIDFILE && echo "already running" + echo "dnsmasq starting" + /usr/sbin/dnsmasq + ;; + + stop) + test -e $PIDFILE || echo "not running" + kill -s SIGTERM `cat $PIDFILE` + ;; + + reload) + test -e $PIDFILE || echo "not running" + kill -s SIGHUP `cat $PIDFILE` + ;; + + *) + echo "Usage: ${0} {start|stop|reload}" + exit 1 + ;; + +esac diff --git a/projectroot/etc/init.d/dropbear b/projectroot/etc/init.d/dropbear new file mode 100644 index 000000000..8f7438462 --- /dev/null +++ b/projectroot/etc/init.d/dropbear @@ -0,0 +1,77 @@ +#!/bin/sh + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/dropbear +NAME=dropbear + +DROPBEAR_PORT=22 +DROPBEAR_EXTRA_ARGS= + +. /lib/init/initmethod-bbinit-functions.sh + +# test ! -h /var/service/dropbear || exit 0 + +DROPBEAR_RSAKEY_DEFAULT="@KEYDIR@/dropbear_rsa_host_key" +DROPBEAR_DSSKEY_DEFAULT="@KEYDIR@/dropbear_dss_host_key" + +test -z "$DROPBEAR_BANNER" || \ + DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER" +test -n "$DROPBEAR_RSAKEY" || \ + DROPBEAR_RSAKEY=$DROPBEAR_RSAKEY_DEFAULT +test -n "$DROPBEAR_DSSKEY" || \ + DROPBEAR_DSSKEY=$DROPBEAR_DSSKEY_DEFAULT +test -n "$DROPBEAR_KEYTYPES" || \ + DROPBEAR_KEYTYPES="rsa dss" + +dropbear_start() { + + KEY_ARGS="" + test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY" + test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY" + + echo -n "starting dropbear..." + + start-stop-daemon -S -x "$DAEMON" --oknodo -- \ + $KEY_ARGS -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS > /dev/null 2>&1 + + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + exit 1 + fi +} + +dropbear_stop() { + + echo -n "stopping dropbear..." + + start-stop-daemon -K -x "$DAEMON" --oknodo > /dev/null 2>&1 + + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + exit 1 + fi +} + + +case "$1" in +start) + dropbear_start;; +stop) + dropbear_stop;; +restart|force-reload) + dropbear_stop + dropbear_start + ;; +*) + N=/etc/init.d/$NAME + echo "usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/fake-overlayfs b/projectroot/etc/init.d/fake-overlayfs new file mode 100644 index 000000000..3785103ce --- /dev/null +++ b/projectroot/etc/init.d/fake-overlayfs @@ -0,0 +1,18 @@ +#!/bin/sh + +# +# /etc/init.d/fake-overlay +# + +case $1 in + + start) + echo "${PREFIX}copying files to tmpfs..." + /sbin/fake-overlayfs + ;; + stop) + ;; + *) + echo "Usage: $0 [start|stop]" + ;; +esac diff --git a/projectroot/etc/init.d/famd b/projectroot/etc/init.d/famd new file mode 100644 index 000000000..f42d3045a --- /dev/null +++ b/projectroot/etc/init.d/famd @@ -0,0 +1,13 @@ +#!/bin/sh +# +# famd +# +case $1 in + + start) + echo "famd starting" + /usr/sbin/famd -c /etc/fam.conf + ;; + +esac + diff --git a/projectroot/etc/init.d/gpsd b/projectroot/etc/init.d/gpsd new file mode 100644 index 000000000..1a3706d57 --- /dev/null +++ b/projectroot/etc/init.d/gpsd @@ -0,0 +1,32 @@ +#!/bin/sh + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="GPS (Global Positioning System) daemon" +NAME=gpsd +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +GPSD_OPTIONS="-n" +DEVICES="/dev/ttyS2" + +case "$1" in + start) + echo -n "Starting $DESC" "$NAME" + if start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -- \ + $GPSD_OPTIONS -P $PIDFILE $DEVICES; then + echo done + else + echo failed + exit 1 + fi + ;; + stop) + echo "Stopping $DESC" "$NAME" + start-stop-daemon -K -q -p $PIDFILE --name $NAME + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop}" >&2 + exit 3 + ;; +esac diff --git a/projectroot/etc/init.d/hwclock b/projectroot/etc/init.d/hwclock new file mode 100644 index 000000000..3613f77e7 --- /dev/null +++ b/projectroot/etc/init.d/hwclock @@ -0,0 +1,21 @@ +#!/bin/sh +# setup current system time from local buffered time source +# +CLOCKREADER=/sbin/hwclock +SETSYSTEMOPT=-s +SETHARDOPT=-w +OPT4ALL=-u + +case "$1" in + start) + $CLOCKREADER $OPT4ALL $SETSYSTEMOPT + ;; + stop) + $CLOCKREADER $OPT4ALL $SETHARDOPT + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac +exit 0 diff --git a/projectroot/etc/init.d/inetd b/projectroot/etc/init.d/inetd new file mode 100644 index 000000000..128d41a82 --- /dev/null +++ b/projectroot/etc/init.d/inetd @@ -0,0 +1,51 @@ +#!/bin/sh +# +# This is an inetd init.d script which ist called by init(1) with [start|stop] as argument +# + +PATH=/sbin:/bin:/usr/bin +BINARY=/usr/sbin/inetd + +# --- nothing to change after this line --- + +test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 1; } + +start_proc() { + echo -n "starting inetd..." + $BINARY + echo "done" +} + +stop_proc() { + echo -n "stopping inetd..." + killall inetd + echo "done" +} + + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart|force-reload) + echo -n "restarting inetd..." + stop_proc + sleep 2 + start_proc + echo "done" + ;; + reload) + echo "Not supported" >&2 + exit 1 + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/lighttpd b/projectroot/etc/init.d/lighttpd new file mode 100644 index 000000000..24a17e2a0 --- /dev/null +++ b/projectroot/etc/init.d/lighttpd @@ -0,0 +1,55 @@ +#!/bin/sh + +# +# lighttpd +# +PATH=/usr/bin:/usr/sbin:/bin:/sbin + +PREFIX="lighttpd: " +LIGHTTPD="/usr/sbin/lighttpd" +LIGHTTPD_CONF="/etc/lighttpd/lighttpd.conf" + +start() +{ + echo "${PREFIX}starting" + + if start-stop-daemon --start --quiet --oknodo --exec ${LIGHTTPD} -- -f ${LIGHTTPD_CONF}; then + echo "${PREFIX}done" + else + echo "${PREFIX}error, could not start server" + fi +} + +stop() +{ + echo "${PREFIX}stoppping" + + if start-stop-daemon --stop --quiet --oknodo --exec ${LIGHTTPD}; then + echo "${PREFIX}done" + else + echo "${PREFIX}error, could not stop server" + fi +} + +case $1 in + + start) + start + ;; + + stop) + stop + ;; + + restart|force-reload) + stop + sleep 1 + start + ;; + + *) + echo "${PREFIX}usage: ${0} [start|stop|restart]" + exit 1 + ;; + +esac diff --git a/projectroot/etc/init.d/lldpd b/projectroot/etc/init.d/lldpd new file mode 100755 index 000000000..00c8240f5 --- /dev/null +++ b/projectroot/etc/init.d/lldpd @@ -0,0 +1,139 @@ +#!/bin/sh + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="LLDP daemon" +NAME=lldpd +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="@DAEMON_ARGS@" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +CHROOT=@PRIVSEP_CHROOT@ + +# exit if binary is missing +[ -x "$DAEMON" ] || exit 0 + +# read further config if present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +is_running() { + start-stop-daemon -K --quiet --test --exec $DAEMON --pidfile $PIDFILE +} + +do_chroot() { + oldumask=$(umask) + umask 022 + [ -d $CHROOT/etc ] || mkdir -p $CHROOT/etc + [ -f $CHROOT/etc/localtime ] || [ ! -f /etc/localtime ] || \ + cp /etc/localtime $CHROOT/etc/localtime + umask $oldumask +} + +do_start() { + do_chroot + is_running && return 1 + start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 +} + +do_stop() { + is_running || return 0 + start-stop-daemon -K --quiet --pidfile $PIDFILE --name $NAME + RETVAL="$?" + + # wait up to 30 seconds until daemon stopped + for i in $(seq 30) + do + sleep 1 + echo -n '.' + if ! is_running + then + break + fi + done + + # see if it's still running + if is_running + then + start-stop-daemon -K --quiet --signal KILL --pidfile $PIDFILE --name $NAME + + for i in $(seq 5) + do + sleep 1 + echo -n '.' + if ! is_running + then + break + fi + done + + if is_running + then + return 2 + fi + fi + + rm -f $PIDFILE + return "$RETVAL" +} + +do_reload() { + # send SIGHUP + start-stop-daemon -K --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + echo -n "Starting $DESC ..." + do_start + case "$?" in + 0|1) echo " Done." ;; + 2) echo " Failed." ;; + esac + ;; + stop) + echo -n "Stopping $DESC ." + do_stop + case "$?" in + 0|1) echo " Done." ;; + 2) echo " Failed." ;; + esac + ;; + reload) + echo -n "Reloading $DESC ..." + do_reload + echo " Done." + ;; + restart|force-reload) + echo -n "Restarting $DESC .." + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) echo " Done." ;; + 1) echo " Failed." ;; # Old process still running + *) echo " Failed." ;; # Failed to start + esac + ;; + *) + echo " Failed." # Failed to stop + ;; + esac + ;; + status) + if is_running + then + echo "$NAME is running with PID $(cat $PIDFILE) ..." + else + echo "$NAME is not running" + fi + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 + exit 3 + ;; +esac + +: diff --git a/projectroot/etc/init.d/logrotate b/projectroot/etc/init.d/logrotate new file mode 100644 index 000000000..c10c12d33 --- /dev/null +++ b/projectroot/etc/init.d/logrotate @@ -0,0 +1,49 @@ +#!/bin/sh + +# +# /etc/init.d/logrotate - Minimal Log Rotator for /var/log/{messages,*.{log,err}} +# + +PREFIX="logrotate: " +LOGDIR="/var/log" +MAXFILES="8" +PATTERNS="*.err *.log messages" + +my_exit(){ + echo "${PREFIX}${1}" + exit $2 +} + +logrotate(){ + cd "${LOGDIR}" + # rotate backups for log files + for filename in ${PATTERNS}; do + [ -e "${filename}" ] && + echo "${PREFIX}rotation for ${filename} ... " && + for i in `seq $(( MAXFILES - 1 )) -1 1` ; do + if [ -e "${filename}.${i}" ] + then + j=$(( i + 1 )) + mv -f ${filename}.${i} ${filename}.${j} + fi + done && + mv -f ${filename} ${filename}.1 + done +} + +# +# Main +# + +[ -d "$LOGDIR" ] || my_exit "Logdir $LOGDIR missing" 1 + +case $1 in + + start|stop) + echo "${PREFIX}rotating in $LOGDIR" + logrotate + ;; + *) + echo "Usage: $0 [start|stop]" + ;; +esac diff --git a/projectroot/etc/init.d/lvm2 b/projectroot/etc/init.d/lvm2 new file mode 100644 index 000000000..475225e58 --- /dev/null +++ b/projectroot/etc/init.d/lvm2 @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Setting up Logical Volume Management +# +case "$1" in + start) + echo "Setting up LVM2..." + if /usr/sbin/lvm vgscan > /dev/null 2>&1; then + /usr/sbin/lvm vgchange -a y + echo "done" + else + echo "failed" + exit 1 + fi + ;; + stop) + echo "Stopping LVM2" + /usr/sbin/lvm vgchange -a n + ;; + *) + echo "usage: $0 [start|stop]" + exit 1 + ;; +esac diff --git a/projectroot/etc/init.d/modules b/projectroot/etc/init.d/modules new file mode 100644 index 000000000..4b5df8a31 --- /dev/null +++ b/projectroot/etc/init.d/modules @@ -0,0 +1,42 @@ +#!/bin/sh + +# +# /etc/init.d/modules - load modules in /etc/modules +# + +MODULES_FILE=/etc/modules + +load_modules(){ + # Loop over every line in /etc/modules. + if [ ! -f $MODULES_FILE ]; then + echo "no /etc/modules, exiting" + exit 0 + fi + grep '^[^#]' $MODULES_FILE | \ + while read module args; do + [ "$module" ] || continue + if [ "$VERBOSE" != no ]; then + echo " $module" + modprobe $module $args || true + else + modprobe $module $args > /dev/null 2>&1 || true + fi + done +} + +# +# Main +# + +case $1 in + + start) + echo "${PREFIX}loading modules" + load_modules + ;; + stop) + ;; + *) + echo "Usage: $0 [start|stop]" + ;; +esac diff --git a/projectroot/etc/init.d/monit b/projectroot/etc/init.d/monit new file mode 100644 index 000000000..96ec86ab9 --- /dev/null +++ b/projectroot/etc/init.d/monit @@ -0,0 +1,167 @@ +#!/bin/sh + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="daemon monitor" +NAME=monit +DAEMON=/usr/bin/$NAME +CONFIG="/etc/monitrc" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +MONIT_OPTS= + +# exit if binary is missing +[ -x "$DAEMON" ] || exit 0 + +monit_check_config() { + # Check for existing config file + if [ ! -f "$CONFIG" ] + then + echo " missing config, please edit $CONFIG." + exit 1 + fi + + # Check for emtpy config + if [ $(grep -cv '^\s*$\|^\s*#' $CONFIG) -eq 0 ] + then + echo " empty config, please edit $CONFIG." + exit 2 + fi + + # Let monit check syntax + if ! $DAEMON -c $CONFIG -t >/dev/null 2>&1 + then + echo " syntax error in $CONFIG" + exit 3 + fi +} + +is_running() { + start-stop-daemon -K --quiet --test --exec $DAEMON \ + --pidfile $PIDFILE +} + +do_start() { + is_running && return 1 + start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $MONIT_OPTS || return 2 +} + +do_stop() { + is_running || return 0 + start-stop-daemon -K --quiet --pidfile $PIDFILE --exec $DAEMON + RETVAL="$?" + + # wait up to 30 seconds until daemon stopped + for i in $(seq 30) + do + sleep 1 + echo -n '.' + if ! is_running + then + break + fi + done + + # see if it's still running + if is_running + then + start-stop-daemon -K --quiet --signal KILL --pidfile $PIDFILE \ + --exec $DAEMON + + for i in $(seq 5) + do + sleep 1 + echo -n '.' + if ! is_running + then + break + fi + done + + if is_running + then + return 2 + fi + fi + + rm -f $PIDFILE + return "$RETVAL" +} + +do_reload() { + # monit has an own call for this, no need to send SIGHUP + $DAEMON reload +} + +monit_check_perms() { + # Check the permission on configfile. + # The permission must not have more than -rwx------ (0700) permissions. + + # Skip checking, fix perms instead. + /bin/chmod go-rwx $CONFIG +} + +monit_checks() { + # Check for emtpy configfile + monit_check_config + # Check permissions of configfile + monit_check_perms +} + +case "$1" in + start) + monit_checks + do_start + case "$?" in + 0) ;; + 1) echo "$DESC already running." ;; + *) echo "Starting $DESC failed." ;; + esac + ;; + stop) + echo -n "Stopping $DESC ." + do_stop + case "$?" in + 0|1) echo " Done." ;; + *) echo " Failed." ;; + esac + ;; + reload) + do_reload + ;; + restart|force-reload) + echo -n "Restarting $DESC .." + do_stop + case "$?" in + 0|1) + echo "" + do_start + case "$?" in + 0) ;; + 1) echo " Failed." ;; # Old process still running + *) echo " Failed." ;; # Failed to start + esac + ;; + *) + echo " Failed." # Failed to stop + ;; + esac + ;; + status) + if is_running + then + echo "$NAME is running with PID $(cat $PIDFILE) ..." + else + echo "$NAME is not running" + fi + ;; + syntax) + $DAEMON -c $CONFIG -t + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 + exit 3 + ;; +esac + +: diff --git a/projectroot/etc/init.d/mysql b/projectroot/etc/init.d/mysql new file mode 100644 index 000000000..dd80a4b33 --- /dev/null +++ b/projectroot/etc/init.d/mysql @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "Write Me" + diff --git a/projectroot/etc/init.d/networking b/projectroot/etc/init.d/networking new file mode 100644 index 000000000..4b82262d8 --- /dev/null +++ b/projectroot/etc/init.d/networking @@ -0,0 +1,35 @@ +#!/bin/sh + +echo "starting network interfaces..." + +grep "root=/dev/nfs" /proc/cmdline > /dev/null + +if [ $? != 0 ]; then + ifup -a +else + # We are doing nfsroot. We cannot simply call ifup -a + # here because we will run into trouble with dhcp. + # So we call ifup for every interface except the one + # we are doing nfsroot on. + # + if [ ! -f /etc/network/interfaces ]; then + exit 0 + fi + + ifaces=$(grep "^auto" /etc/network/interfaces) + + for i in $ifaces; do + if [ "$i" = auto ]; then + continue + fi + + ifconfig | grep "^$i" + + if [ $? != 0 ]; then + ifup "$i" + fi + done +fi + +exit 0 + diff --git a/projectroot/etc/init.d/nfsd b/projectroot/etc/init.d/nfsd new file mode 100644 index 000000000..744bdbf98 --- /dev/null +++ b/projectroot/etc/init.d/nfsd @@ -0,0 +1,22 @@ +#!/bin/sh +# +# lauching NFS service +# +case "$1" in + start) + echo "Mounting nfsd virtual filesystem..." + /bin/mount -t nfsd none /proc/fs/nfsd >/dev/null 2>&1 + + echo "Starting NFS mountd..." + /sbin/rpc.mountd + + echo "Starting NFS nfsd..." + /sbin/rpc.nfsd -p 2049 3 + + echo "Starting NFS statd..." + /sbin/rpc.statd + + echo "Exporting NFS Filesystems..." + /sbin/exportfs -ra >/dev/null 2>&1 + ;; +esac diff --git a/projectroot/etc/init.d/ntp-client b/projectroot/etc/init.d/ntp-client new file mode 100644 index 000000000..edca3f297 --- /dev/null +++ b/projectroot/etc/init.d/ntp-client @@ -0,0 +1,64 @@ +#!/bin/sh +# +# This is a ntp-client init.d script which ist called by init(1) with +# [start|stop] as argument + +PATH=/sbin:/bin:/usr/bin +BINARY=/usr/sbin/ntpdc +PIDFILE="/var/run/ntpdc.pid" +CONFIG="/etc/ntp-client.conf" + +HARD=false + +# --- nothing to change after this line --- + +test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 0; } + +start_proc() { + echo -n "Starting NTP client: ntpdc ..." + test -f "$PIDFILE" && { echo "pid-file exists" >&2 ; exit 0; } + $BINARY -p $PIDFILE -c $CONFIG + echo "DONE" +} + +stop_proc() { + echo -n "Stopping NTP client: ntpdc ..." + test -f "$PIDFILE" + case $? in + 0) + kill `cat $PIDFILE` && rm -f $PIDFILE + ;; + *) + if [ "$HARD" = "true" ] ; then killall ntpd; fi + ;; + esac + echo "DONE" +} + + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart|force-reload) + echo -n "Restarting NTP client: ntpdc... " + stop_proc + sleep 2 + start_proc + echo "done." + ;; + reload) + echo "Not supported" >&2 + exit 1 + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/ntp-server b/projectroot/etc/init.d/ntp-server new file mode 100644 index 000000000..bda35616e --- /dev/null +++ b/projectroot/etc/init.d/ntp-server @@ -0,0 +1,64 @@ +#!/bin/sh +# +# This is a ntp init.d script which ist called by init(1) with [start|stop] as argument +# + +PATH=/sbin:/bin:/usr/bin +BINARY=/usr/sbin/ntpd +PIDFILE="/var/run/ntpd.pid" +CONFIG="/etc/ntp-server.conf" + +HARD=false + +# --- nothing to change after this line --- + +test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 0; } + +start_proc() { + echo -n "Starting NTP server: ntpd ..." + test -f "$PIDFILE" && { echo "pid-file exists" >&2 ; exit 0; } + $BINARY -p $PIDFILE -c $CONFIG + echo "DONE" +} + +stop_proc() { + echo -n "Stopping NTP server: ntpd ..." + test -f "$PIDFILE" + case $? in + 0) + kill `cat $PIDFILE` && rm -f $PIDFILE + ;; + *) + if [ "$HARD" = "true" ] ; then killall ntpd; fi + ;; + esac + echo "DONE" +} + + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart|force-reload) + echo -n "Restarting NTP server: ntpd... " + stop_proc + sleep 2 + start_proc + echo "done." + ;; + reload) + echo "Not supported" >&2 + exit 1 + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/ntpclient b/projectroot/etc/init.d/ntpclient new file mode 100644 index 000000000..ccd79152f --- /dev/null +++ b/projectroot/etc/init.d/ntpclient @@ -0,0 +1,13 @@ +#!/bin/sh +# +# ntpclient +# +case $1 in + + start) + echo "ntpclient starting" + /usr/sbin/ntpclient -i 600 -l -h @HOST@ > /dev/null & + ;; + +esac + diff --git a/projectroot/etc/init.d/openssh b/projectroot/etc/init.d/openssh new file mode 100644 index 000000000..b65880e5d --- /dev/null +++ b/projectroot/etc/init.d/openssh @@ -0,0 +1,60 @@ +#!/bin/sh + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/sshd +NAME=sshd +PIDFILE=/var/run/sshd.pid + +case "$1" in + + start) + mkdir -p /var/run/sshd + + echo -n "starting sshd..." + start-stop-daemon -S -x "$DAEMON" -p "$PIDFILE" > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + exit 1 + fi + ;; + + stop) + echo -n "stopping sshd..." + start-stop-daemon -K -p $PIDFILE > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + exit 1 + fi + ;; + + restart|force-reload) + echo -n "restarting sshd..." + start-stop-daemon -K -x "$DAEMON" -p $PIDFILE > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + exit 1 + fi + sleep 1 + start-stop-daemon -S -x "$DAEMON" -p $PIDFILE > /dev/null 2>&1 + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + exit 1 + fi + ;; + + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/portmapd b/projectroot/etc/init.d/portmapd new file mode 100644 index 000000000..5a3f36315 --- /dev/null +++ b/projectroot/etc/init.d/portmapd @@ -0,0 +1,12 @@ +#!/bin/sh +# +# portmap +# +case $1 in + + start) + echo "portmap starting" + /sbin/portmap + ;; + +esac diff --git a/projectroot/etc/init.d/pppd b/projectroot/etc/init.d/pppd new file mode 100644 index 000000000..93cc92401 --- /dev/null +++ b/projectroot/etc/init.d/pppd @@ -0,0 +1,60 @@ +#!/bin/sh +# +DAEMON=/usr/sbin/pppd +PIDFILE=/var/run/ppp0.pid + +# define the interface used for the connection +DAEMON_OPTS=@PPPD_INTF@ + +case "${1}" in + start) + if [ -e $PIDFILE ]; then + echo "pppd already running" + exit 1 + fi + echo "Starting pppd..." + $DAEMON $DAEMON_OPTS || echo "failed" + ;; + + stop) + if [ ! -e $PIDFILE ]; then + echo "pppd not running" + exit 1 + fi + echo "Stopping pppd..." + kill -s SIGTERM `cat $PIDFILE` || echo "failed" + ;; + + restart) + if [ ! -e $PIDFILE ]; then + echo "pppd not running" + exit 1 + fi + echo "Restarting pppd..." + kill -s SIGTERM `cat $PIDFILE` || echo "failed" + sleep 1 + $DAEMON $DAEMON_OPTS || echo "failed" + ;; + + status) + if [ -e $PIDFILE ]; then + echo "pppd running" + else + echo "pppd not running" + fi + ;; + + hangup) + if [ ! -e $PIDFILE ]; then + echo "pppd not running" + exit 1 + fi + echo "pppd hanging up" + kill -s SIGHUP `cat $PIDFILE` || echo "failed" + ;; + + *) + echo "Usage: ${0} {start|stop|restart|status|hangup}" + exit 1 + ;; +esac diff --git a/projectroot/etc/init.d/proftpd b/projectroot/etc/init.d/proftpd new file mode 100644 index 000000000..ae69bb814 --- /dev/null +++ b/projectroot/etc/init.d/proftpd @@ -0,0 +1,88 @@ +#!/bin/sh +# +# /etc/init.d/proftpd +# Start the proftpd FTP daemon. +# + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +DAEMON=/usr/sbin/proftpd +NAME=proftpd + +PIDFILE=/var/run/proftpd.pid + +# Read config (will override defaults) +[ -r /etc/default/proftpd ] && . /etc/default/proftpd + +trap "" 1 +trap "" 15 + +start() +{ + start-stop-daemon --start --quiet --pidfile "$PIDFILE" --oknodo --exec $DAEMON -- $OPTIONS +} + +signal() +{ + start-stop-daemon --stop --signal ${1} --quiet --pidfile "$PIDFILE" +} + + +case "$1" in + start) + if [ \! -d /var/run/proftpd ]; then + mkdir -p /var/run/proftpd + fi + echo -n "Starting $NAME... " + if start; then + echo "Done" + else + echo "failed" + exit 1 + fi + ;; + + stop) + echo -n "Stopping $NAME... " + if signal TERM; then + echo "Done" + else + echo "Failed" + exit 1 + fi + ;; + + reload) + echo -n "Reloading $NAME configuration... " + if signal HUP; then + echo "done" + else + echo "Failed" + exit 1 + fi + ;; + + force-reload|restart) + echo -n "Restarting $NAME..." + if signal TERM; then + echo -n "." + else + echo "Failed" + exit 1 + fi + + sleep 2 + echo -n "." + + if start; then + echo " done." + else + echo "Failed" + exit 1 + fi + ;; + + *) + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|help}" + exit 1 + ;; +esac diff --git a/projectroot/etc/init.d/pureftpd b/projectroot/etc/init.d/pureftpd new file mode 100644 index 000000000..4d23aec2c --- /dev/null +++ b/projectroot/etc/init.d/pureftpd @@ -0,0 +1,117 @@ +#!/bin/sh +# +# /etc/init.d/pure-ftpd +# + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +# defaults +DAEMON="pure-ftpd" +NAME="pure-ftpd" +PREFIX="pure-ftpd: " +DAEMON_OPTIONS="-B @DAEMON_ARGS@" +DAEMON_PIDFILE=/var/run/pure-ftpd.pid + +HELPER="pure-uploadscript" +HELPER_START_SCRIPT="@HELPER_SCRIPT@" +HELPER_OPTIONS="-B @HELPER_ARGS@" + +trap "" 1 +trap "" 15 + +which $DAEMON || { echo "${PREFIX}$DAEMON not found"; exit; } + + +if [ ! -z $HELPER_START_SCRIPT ] ; then + DAEMON_OPTIONS="$DAEMON_OPTIONS -o" +fi + +start_helper(){ + if [ ! -z $HELPER_START_SCRIPT ]; then + which $HELPER || { echo "${PREFIX}$HELPER not found"; exit; } + echo "${PREFIX}starting upload helper daemon..." + $HELPER $HELPER_OPTIONS -r $HELPER_START_SCRIPT + else + echo "${PREFIX}no upload script defined, skipping" + fi +} + +stop_helper(){ + killall -9 "$HELPER" +} + +start_daemon(){ + which $DAEMON + $DAEMON -g $DAEMON_PIDFILE $DAEMON_OPTIONS +} + +stop_daemon(){ + if [ -e "$DAEMON_PIDFILE" ]; then + kill `cat $DAEMON_PIDFILE` + case $? in + 0) + echo "${PREFIX}$NAME stopped" + ;; + *) + kill -9 `cat $DAEMON_PIDFILE` + echo "${PREFIX}failed to stop $NAME - process killed" + ;; + esac + rm -f $DAEMON_PIDFILE + echo "${PREFIX}pidfile removed" + else + echo "${PREFIX}pid file not found - process not running" + fi +} + +start(){ + start_daemon + start_helper +} + +stop(){ + stop_daemon + stop_helper +} + +case "$1" in + start) + echo -n "${PREFIX}starting $NAME: " + start + echo "done" + ;; + + stop) + echo -n "${PREFIX}stopping $NAME: " + stop + echo "done" + ;; + + reload) + echo -n "${PREFIX}reloading $NAME configuration..." + if [ -e "$DAEMON_PIDFILE" ]; then + kill -HUP `cat $DAEMON_PIDFILE` + echo " done." + else + echo "pid file not found - process not running" + fi + ;; + + force-reload|restart) + echo -n "${PREFIX}restarting $NAME." + stop + echo -n "." + sleep 2 + echo -n "." + start + echo " done." + ;; + + *) + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|help}" + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/rc-once b/projectroot/etc/init.d/rc-once new file mode 100644 index 000000000..2387c3157 --- /dev/null +++ b/projectroot/etc/init.d/rc-once @@ -0,0 +1,36 @@ +#!/bin/sh + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +. /lib/init/initmethod-bbinit-functions.sh +. /lib/init/rc-once.sh + +do_start() { + test -e "$STAMP" && return + + mount_root_rw || exit 1 + + run_rc_once && : > "$STAMP" + + if ! mount_root_restore; then + # remounting rw/ro during the second boot will flush anything + # left in the filesystem journal + rm "$STAMP" + reboot + sleep 100 + fi +} + +case "$1" in + + start) + do_start >&2 + ;; + *) + echo "Usage: $0 {start}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/rcS b/projectroot/etc/init.d/rcS new file mode 100644 index 000000000..45dc909f5 --- /dev/null +++ b/projectroot/etc/init.d/rcS @@ -0,0 +1,22 @@ +#!/bin/sh +# +# /etc/init.d/rcS +# + +mount -t proc none /proc + +if grep -q "quiet" /proc/cmdline; then + exec 1>/dev/null +fi + +echo -n "mounting filesystems..." +mount -a 2>/dev/null +echo "done." + +# loadkmap < /etc/boottime.kmap + +# set hostname +test -e /etc/hostname && hostname -F /etc/hostname + +echo "running rc.d services..." +run-parts -a start /etc/rc.d diff --git a/projectroot/etc/init.d/rngd b/projectroot/etc/init.d/rngd new file mode 100644 index 000000000..623395478 --- /dev/null +++ b/projectroot/etc/init.d/rngd @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Start/stop rngd (random number generator daemon) from rng-tools +# + +# defaults are sane, normally no need to override +OPTIONS= + +# pid-file created from rngd by default +PIDFILE=/var/run/rngd.pid + +case $1 in + start) + if [ -e $PIDFILE ]; then + echo "rngd already running (found $PIDFILE)" + else + echo "starting rngd" + /usr/sbin/rngd $OPTIONS + fi + ;; + + stop) + if [ -e $PIDFILE ]; then + echo "stopping rngd" + kill -s SIGTERM `cat $PIDFILE` + else + echo "rngd not running (no $PIDFILE)" + fi + ;; + + restart) + $0 stop + $0 start + ;; + + *) + echo "Usage: ${0} {start|stop|restart}" + exit 1 + ;; +esac diff --git a/projectroot/etc/init.d/rsyncd b/projectroot/etc/init.d/rsyncd new file mode 100644 index 000000000..252683962 --- /dev/null +++ b/projectroot/etc/init.d/rsyncd @@ -0,0 +1,13 @@ +#!/bin/sh +# +# rsync +# +case $1 in + + start) + echo "rsyncd starting" + /usr/bin/rsync --daemon @CONFIG@ + ;; + +esac + diff --git a/projectroot/etc/init.d/rt-set-bandwidth b/projectroot/etc/init.d/rt-set-bandwidth new file mode 100644 index 000000000..4c0f7a503 --- /dev/null +++ b/projectroot/etc/init.d/rt-set-bandwidth @@ -0,0 +1,36 @@ +#! /bin/sh +# +# set bandwidth throttling of rt +# this default script will disable it since it seems the right choice for embedded systems. +# use this file as a template for custom settings (think about the period, too) and put it +# into projectroot. + +set -e +runtime=/proc/sys/kernel/sched_rt_runtime_us +runtime_orig=/var/run/sched_rt_runtime_us.orig + +case $1 in + start) + if [ -f "${runtime}" -a -w "${runtime}" ]; then + cp "${runtime}" "${runtime_orig}" + # Customize your value(s) here + echo "-1" > "${runtime}" + else + echo "WARNING: Disabling RT-bandwidth was requested, but there are access problems with ${runtime}!" + exit 1 + fi + ;; + stop) + if [ -f "${runtime_orig}" ]; then + cat "${runtime_orig}" > "${runtime}" + else + echo "WARNING: Restoring RT-bandwidth was requested, but original value was not found!" + fi + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/samba b/projectroot/etc/init.d/samba new file mode 100644 index 000000000..a85bdc5db --- /dev/null +++ b/projectroot/etc/init.d/samba @@ -0,0 +1,45 @@ +#!/bin/sh +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON_SMB=/usr/sbin/smbd +DAEMON_NMB=/usr/sbin/nmbd +NAME=samba +DESC="Samba server" + +case "$1" in + start) + echo -n "Starting $DESC: " + start-stop-daemon -S -x "$DAEMON_SMB" -- -D + echo -n "$DAEMON_SMB. " + start-stop-daemon -S -x "$DAEMON_NMB" -- -D + echo -n "$DAEMON_NMB. " + echo "done" + ;; + stop) + echo -n "Stopping $DESC: " + start-stop-daemon -K -x "$DAEMON_SMB" + echo -n "$DAEMON_SMB. " + start-stop-daemon -K -x "$DAEMON_NMB" + echo -n "$DAEMON_NMB." + echo "done" + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + start-stop-daemon -K -x "$DAEMON_SMB" + start-stop-daemon -K -x "$DAEMON_NMB" + start-stop-daemon -S -x "$DAEMON_SMB" -- -D + echo -n "$DAEMON_SMB. " + start-stop-daemon -S -x "$DAEMON_NMB" -- -D + echo -n "$DAEMON_NMB. " + echo "done" +sleep 1 + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/smartd b/projectroot/etc/init.d/smartd new file mode 100644 index 000000000..2849ffa74 --- /dev/null +++ b/projectroot/etc/init.d/smartd @@ -0,0 +1,30 @@ +#!/bin/sh + +DAEMON=/usr/sbin/smartd +PIDFILE=/var/run/smartd.pid + +case $1 in +start) + echo -n "Starting smartd..." + start-stop-daemon --start --oknodo \ + --pidfile $PIDFILE --exec $DAEMON + + if [ "$?" = "0" ]; then + echo "done" + exit 0 + else + echo "failed" + exit 1 + fi + + ;; +stop) + echo "Stopping smartd" + start-stop-daemon --stop --oknodo --quiet \ + --pidfile $PIDFILE --exec $DAEMON + ;; +*) + echo "usage: $0 [start|stop]" + ;; +esac + diff --git a/projectroot/etc/init.d/splashutils b/projectroot/etc/init.d/splashutils new file mode 100644 index 000000000..2e2abd04e --- /dev/null +++ b/projectroot/etc/init.d/splashutils @@ -0,0 +1,53 @@ +#!/bin/sh +# +# This is an splashutils daemon init.d script which ist called by init(1) with [start|stop] as argument +# + +PATH=/sbin:/bin:/usr/bin +FUNCTIONS=/sbin/splash-functions.sh + +# --- nothing to change after this line --- + +. $FUNCTIONS + +mkdir -p /var/run/splash/cache/ + +start_proc() { + echo -n "starting splashutils daemon..." + splash_start || (echo failed; exit 1) + echo "done" +} + +stop_proc() { + echo -n "stopping splashutils daemon..." + splash_exit + echo "done" +} + + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart|force-reload) + echo -n "restarting splashutils daemon..." + stop_proc + sleep 2 + start_proc + echo "done" + ;; + reload) + echo "Not supported" >&2 + exit 1 + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/sramdisk b/projectroot/etc/init.d/sramdisk new file mode 100644 index 000000000..c19e2dae8 --- /dev/null +++ b/projectroot/etc/init.d/sramdisk @@ -0,0 +1,71 @@ +#!/bin/sh +# +# /etc/init.d/sramdisk +# + +CONF=/etc/sramdisk.conf + +case "$1" in + + start|restart|force-reload) + echo -n "mounting sramdisk(s)..." + if [ ! -f "${CONF}" ]; then + echo "skipping, ${CONF} not found" + exit 0 + fi + OLD_IFS=${IFS} + unset IFS + cat ${CONF} | \ + grep -v -E "^[[:space:]]*$" | \ + grep -v -e "^[[:space:]]*#.*$" | \ + while read src dst fs opt dfl1 dfl2; + do + if [ ! -b $src ]; then + echo "error: $src must be a block device" + exit 1 + fi + if [ ! -d $dst ]; then + echo "error: $dst must be a mount point dir" + exit 1 + fi + mount -t $fs -o $opt $src $dst + if [ "$?" != "0" ]; then + case $fs in + minix) + echo "formating minix" + mkfs.minix -n 30 -v $src + ;; + *) + ;; + esac + fi + done + IFS=${OLD_IFS} + + ;; + stop) + echo -n "unmounting sramdisk(s)..." + if [ ! -f "${CONF}" ]; then + echo "skipping, ${CONF} not found" + exit 0 + fi + OLD_IFS=${IFS} + unset IFS + cat ${CONF} | \ + grep -v -E "^[[:space:]]*$" | \ + grep -v -e "^[[:space:]]*#.*$" | \ + while read src dst fs opt dfl1 dfl2; + do + umount $dst + done + IFS=${OLD_IFS} + + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/startup b/projectroot/etc/init.d/startup new file mode 100644 index 000000000..2b88bb3d8 --- /dev/null +++ b/projectroot/etc/init.d/startup @@ -0,0 +1,5 @@ +#! /bin/sh + +[ -x /home/startup ] && /home/startup + +exit 0 diff --git a/projectroot/etc/init.d/sysctl b/projectroot/etc/init.d/sysctl new file mode 100644 index 000000000..d23f9d5b2 --- /dev/null +++ b/projectroot/etc/init.d/sysctl @@ -0,0 +1,23 @@ +#! /bin/sh +# /etc/init.d/sysctl: Set kernel variables from /etc/sysctl.conf +# + +PATH=/sbin:$PATH +which sysctl > /dev/null || exit 0 + +case "$1" in + start|restart|force-reload) + for file in /etc/sysctl.conf /etc/sysctl.d/*.conf ; do + if [ -r "$file" ] ; then + sysctl -p "$file" > /dev/null 2>&1 + fi + done + ;; + stop) + ;; + *) + echo "Usage: /etc/init.d/sysctl {start|stop|restart|force-reload}" >&2 + exit 3 + ;; +esac +exit 0 diff --git a/projectroot/etc/init.d/syslog-ng b/projectroot/etc/init.d/syslog-ng new file mode 100644 index 000000000..f3d19d900 --- /dev/null +++ b/projectroot/etc/init.d/syslog-ng @@ -0,0 +1,47 @@ +#!/bin/sh +# +# /etc/init.d/syslog-ng +# + +PREFIX="syslog-ng: " +THISFILE=$0 +syslogng="/sbin/syslog-ng" +PIDFILE="/var/run/syslog-ng.pid" + +usage() { + echo "${PREFIX}usage: $THISFILE [start|stop]" +} + +case $1 in + + start) + echo "${PREFIX} starting" + if [ -e "$PIDFILE" ]; then + echo "${PREFIX} warning: another syslog-ng seems to be running, trying to kill it" + kill -9 `cat $PIDFILE` + rm -f $PIDFILE + fi + $syslogng + if [ "$?" != "0" ]; then + echo "${PREFIX} error, could not start daemon" + rm -f $PIDFILE + else + echo "${PREFIX} done" + fi + ;; + + stop) + echo "${PREFIX} stopping" + kill `cat $PIDFILE` + rm -f $PIDFILE + echo "${PREFIX} done" + ;; + + *) + + usage + exit 1 + ;; + +esac + diff --git a/projectroot/etc/init.d/syslogd b/projectroot/etc/init.d/syslogd new file mode 100644 index 000000000..67d8d5de4 --- /dev/null +++ b/projectroot/etc/init.d/syslogd @@ -0,0 +1,26 @@ +#!/bin/sh +# +# syslogd/klogd +# +LOGD=/sbin +# klogd is an option +KLOGD=klogd +SLOGD=syslogd + +case $1 in + + start) + echo "syslogd starting" + $LOGD/$SLOGD + if [ -e "$LOGD/$KLOGD" ]; then + echo "klogd starting" + $LOGD/$KLOGD + fi + ;; + + stop) + echo "stopping syslog" + killall -q $KLOGD + killall $SLOGD + ;; +esac diff --git a/projectroot/etc/init.d/telnetd b/projectroot/etc/init.d/telnetd new file mode 100644 index 000000000..2a568bc9e --- /dev/null +++ b/projectroot/etc/init.d/telnetd @@ -0,0 +1,21 @@ +#!/bin/sh +# +# /etc/init.d/telnetd +# +# $Id$ +# + +if [ -f /usr/sbin/telnetd ]; then + echo "Starting telnetd..." + /usr/sbin/telnetd + exit 0 +fi + +if [ -f /sbin/utelnetd ]; then + echo "Starting utelnetd..." + /sbin/utelnetd -d + exit 0 +fi + +echo "No telnetd found. Aborting" + diff --git a/projectroot/etc/init.d/tftpd b/projectroot/etc/init.d/tftpd new file mode 100644 index 000000000..e7ff579a6 --- /dev/null +++ b/projectroot/etc/init.d/tftpd @@ -0,0 +1,13 @@ +#!/bin/sh +# +# tftpd +# +case $1 in + + start) + echo "tftpd starting" + /sbin/tftpd -l @ROOT@ + ;; + +esac + diff --git a/projectroot/etc/init.d/thttpd b/projectroot/etc/init.d/thttpd new file mode 100644 index 000000000..51102b9d0 --- /dev/null +++ b/projectroot/etc/init.d/thttpd @@ -0,0 +1,52 @@ +#!/bin/sh +# +# thttpd +# + +PREFIX="thttpd: " +THISFILE=$0 +DOCUMENTROOT="/var/www" +thttpd="/usr/sbin/thttpd" +PIDFILE="/var/run/thttpd.pid" +LOGFILE="/var/log/thttpd.log" + +usage() { + echo "${PREFIX}usage: $THISFILE [start|stop]" +} + +case $1 in + + start) + echo "${PREFIX} starting" + if [ -e "$PIDFILE" ]; then + echo "${PREFIX} warning: another thttpd seems to be running, trying to kill it" + kill -9 `cat $PIDFILE` + rm -f $PIDFILE + fi + $thttpd -d $DOCUMENTROOT -u www -nor -nos -p 80 -c '**.cgi' -i $PIDFILE -l $LOGFILE + if [ "$?" != "0" ]; then + echo "${PREFIX} error, could not start server" + rm -f $PIDFILE + else + echo "${PREFIX} done" + fi + ;; + + stop) + if [ -e "$PIDFILE" ]; then + echo "${PREFIX} stopping" + kill -USR1 `cat $PIDFILE` + rm -f $PIDFILE + echo "${PREFIX} done" + else + echo "${PREFIX} not running" + fi + ;; + + *) + + usage + exit 1 + ;; + +esac diff --git a/projectroot/etc/init.d/tomcat b/projectroot/etc/init.d/tomcat new file mode 100644 index 000000000..8af34700c --- /dev/null +++ b/projectroot/etc/init.d/tomcat @@ -0,0 +1,52 @@ +#!/bin/sh +# +# This is a tomcat init.d script which is called by init(1) with [start|stop] as argument +# + +ARGS="-classpath /usr/tomcat/bin/bootstrap.jar -Dcatalina.home=/usr/tomcat org.apache.catalina.startup.Bootstrap" + +for j in /usr/bin/jamvm /usr/bin/java $JAVA_HOME/bin/java; do + if [ -x "$j" ]; then + JAVA="$j" + break + fi +done + +if [ -z "$JAVA" ]; then + echo java not found. + exit 1 +fi + +start_proc(){ + mkdir -p /tmp/tomcat/temp + mkdir -p /tmp/tomcat/work + mkdir -p /tmp/tomcat/logs + + $JAVA $ARGS start > /dev/null 2>&1 & +} + +stop_proc(){ + $JAVA $ARGS stop +} + + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart) + stop_proc + start_proc + ;; + *) + echo "Usage: $0 {start|stop|restart}" + echo "" + exit 1 + ;; +esac + +exit 0 + diff --git a/projectroot/etc/init.d/udev b/projectroot/etc/init.d/udev new file mode 100644 index 000000000..1020b40c7 --- /dev/null +++ b/projectroot/etc/init.d/udev @@ -0,0 +1,96 @@ +#!/bin/sh + +udev_root="/dev" +udev_rules="/lib/udev/rules.d" +udev_log="err" + +# for new udevd +PATH=/lib/udev:$PATH + +make_extra_nodes () { + # there are a few things that sysfs does not export for us. + # these things go here (and remember to remove them in + # remove_extra_nodes() + # + # Thanks to Gentoo for the initial list of these. + if ! mount | grep -q devtmpfs; then + ln -snf /proc/self/fd /dev/fd + ln -snf /proc/self/fd/0 /dev/stdin + ln -snf /proc/self/fd/1 /dev/stdout + ln -snf /proc/self/fd/2 /dev/stderr + ln -snf /proc/kcore /dev/core + + mknod /dev/null c 1 3 + mknod /dev/console c 5 1 + mknod /dev/zero c 1 5 + fi + + mkdir /dev/pts + mkdir /dev/shm +} + +case $1 in +start) + echo "starting udev" + + # don't use udev if sysfs is not mounted. + if [ ! -d /sys/kernel ]; then + echo "failed" + echo "error: sysfs not mounted" + exit 1 + fi + + # only mount a tmpfs if devtmpfs is not already there + if ! mount | grep -q devtmpfs; then + # The reason we don't write to mtab is because we don't ever + # want /dev to be unavailable (such as by `umount -a'). + echo "mounting tmpfs at $udev_root" + mount -n -t tmpfs tmpfs $udev_root -o mode=755 + fi + + # udev handles uevents itself, so we don't need to have + # the kernel call out to any binary in response to them + echo > /proc/sys/kernel/hotplug + + echo "creating static nodes" + make_extra_nodes + + # Start the udev daemon to continually + # watch for, and act on, uevents + echo -n "starting udevd..." + udevd --daemon + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + fi + + # Now traverse sys/ in order to "coldplug" + # devices that have already been discovered + udevadm trigger + # Now wait for udevd to process + # the uevents we triggered + echo -n "waiting for devices..." + udevadm settle --timeout=10 + if [ "$?" = "0" ]; then + echo "done" + else + echo "failed" + fi + + # We can only mount /dev/pts after initialising udev + if [ -d "/dev/pts" ]; then + mount /dev/pts + fi + + exit 0 + + ;; +stop) + echo "stopping udevd... error, udevd cannot be stopped, aborting" + ;; +*) + echo "usage: $0 [start|stop]" + ;; +esac + diff --git a/projectroot/etc/init.d/udhcpd b/projectroot/etc/init.d/udhcpd new file mode 100644 index 000000000..a10226e48 --- /dev/null +++ b/projectroot/etc/init.d/udhcpd @@ -0,0 +1,21 @@ +#!/bin/sh +# +# /etc/init.d/udhcpd +# +# $Id$ +# + +if [ -f /usr/sbin/udhcpd ]; then + echo "Starting udhcpd..." + /usr/sbin/udhcpd + exit 0 +fi + +if [ -f /sbin/udhcpd ]; then + echo "Starting udhcpd..." + /sbin/udhcpd -d + exit 0 +fi + +echo "No udhcpd found. Aborting" + diff --git a/projectroot/etc/init.d/urshd b/projectroot/etc/init.d/urshd new file mode 100644 index 000000000..7407d4bc8 --- /dev/null +++ b/projectroot/etc/init.d/urshd @@ -0,0 +1,34 @@ +#!/bin/sh + +DAEMON=/usr/sbin/urshd +PIDFILE=/var/run/urshd.pid +DESC="u remote shell daemon" + +set -e + +do_start() { + start-stop-daemon --start --oknodo \ + --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS +} + +do_stop() { + start-stop-daemon --stop --oknodo --quiet \ + --pidfile $PIDFILE --exec $DAEMON +} + +case "$1" in + start) + echo "Starting $DESC" + do_start || echo "failed" + ;; + stop) + echo "Stopping $DESC" + do_stop || echo "failed" + ;; + *) + echo "Usage: $0 {start|stop}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/projectroot/etc/init.d/zeroconf b/projectroot/etc/init.d/zeroconf new file mode 100644 index 000000000..ad4ebc135 --- /dev/null +++ b/projectroot/etc/init.d/zeroconf @@ -0,0 +1,103 @@ +#!/bin/sh +# +# This is a zeroconf init.d script which ist called by init(1) with [start|stop] as argument +# Mi 22. Jul 21:46:28 CEST 2009 + +PATH=/sbin:/bin:/usr/bin +BINARY=/usr/sbin/avahi-autoipd +OPTIONS="--force-bind -D" +INTERFACES="eth0" + +test -f $BINARY || { echo "$BINARY not found" >&2 ; exit 0; } + +start_proc(){ + for i in $INTERFACES; do + $BINARY $OPTIONS $i + case $? in + 0) + echo " [+] $i (zeroconf)" + ;; + *) + echo " [!] $i (zeroconf)" + ;; + esac + done +} + +stop_proc(){ + for i in $INTERFACES; do + $BINARY --kill $i + case $? in + 0) + echo " [-] $i (zeroconf)" + ;; + *) + echo " [!] $i (zeroconf)" + ;; + esac + done +} + +refresh_proc(){ + for i in $INTERFACES; do + $BINARY --refresh $i + case $? in + 0) + echo " [*] $i (zeroconf)" + ;; + *) + echo " [!] $i (zeroconf)" + ;; + esac + done +} + +check_proc(){ + for i in $INTERFACES; do + $BINARY --check $i + case $? in + 0) + echo " [+] $i (zeroconf)" + ;; + *) + echo " [-] $i (zeroconf)" + ;; + esac + done +} + + + +case "$1" in + start) + start_proc + ;; + stop) + stop_proc + ;; + restart|force-reload) + stop_proc + sleep 2 + start_proc + ;; + reload) + refresh_proc + ;; + status) + check_proc + ;; + *) + echo "Usage: $0 {start|stop|status|reload|restart|force-reload}" + echo "" + echo "Status Flags:" + echo "[+] -> started" + echo "[-] -> not started" + echo "[*] -> reloaded" + echo "[!] -> error - please debug without -D option" + echo "" + exit 1 + ;; +esac + +exit 0 + |