diff options
Diffstat (limited to 'target/device/valka/target_skeleton/etc/rc.d')
19 files changed, 529 insertions, 0 deletions
diff --git a/target/device/valka/target_skeleton/etc/rc.d/00.virtualfs b/target/device/valka/target_skeleton/etc/rc.d/00.virtualfs new file mode 100755 index 000000000..6c1a627a8 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/00.virtualfs @@ -0,0 +1,24 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Mounting virtual filesystems:" + mount_fs proc /proc proc + mount_fs sys /sys sysfs + mount_fs config /config configfs + mount_fs tmp /tmp tmpfs + mount_fs run /var/run tmpfs + mkdir_fs /var/run/lock + if mount_fs dev /dev tmpfs "size=512k,mode=0755"; then + mkdir_fs /dev/pts + mkdir_fs /dev/shm + fi + mount_fs ptr /dev/pts devpts + echo "" +} + +stop() { + return 0 +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/01.mdev b/target/device/valka/target_skeleton/etc/rc.d/01.mdev new file mode 100755 index 000000000..a9a2da7c3 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/01.mdev @@ -0,0 +1,23 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Starting mdev: " + set -e + trap 'echo "Failed"' EXIT + ${ln_program} -s /proc/self/fd /dev/fd + ${ln_program} -s /proc/self/fd/0 /dev/stdin + ${ln_program} -s /proc/self/fd/1 /dev/stdout + ${ln_program} -s /proc/self/fd/2 /dev/stderr + ${ln_program} -s /proc/kcore /dev/core + echo /sbin/mdev > /proc/sys/kernel/hotplug + ${mdev_program} ${mdev_flags} + trap - EXIT + echo "Ok" +} + +stop() { + return 0; +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/02.localfs b/target/device/valka/target_skeleton/etc/rc.d/02.localfs new file mode 100755 index 000000000..2614d020f --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/02.localfs @@ -0,0 +1,22 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Mounting local filesystems: " + if ${mount_program} -a; then + echo "Ok" + else + echo "Failed" + fi +} + +stop() { + echo -n " * Unmounting local filesystems: " + if ${umount_program} -a 2>/dev/null; then + echo "Ok" + else + echo "Failed" + fi +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/03.hostname b/target/device/valka/target_skeleton/etc/rc.d/03.hostname new file mode 100755 index 000000000..5cbae3f78 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/03.hostname @@ -0,0 +1,25 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Settings hostname: " + if [ ! -x ${hostname_program} ]; then + log_error "Missing 'hostname' program (${hostname_program})" + echo "Failed" + return 1 + fi + + if ${hostname_program} ${hostname}; then + echo "'${hostname}'" + echo ${hostname} > /etc/hostname + else + echo "Failed" + return 1 + fi +} + +stop() { + return 0 +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/04.syslog b/target/device/valka/target_skeleton/etc/rc.d/04.syslog new file mode 100755 index 000000000..b00347085 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/04.syslog @@ -0,0 +1,24 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Starting syslogd: " + if [ ! -x ${syslogd_program} ]; then + log_error "Missing 'syslogd' program (${syslogd_program})" + echo "Failed" + return 1 + fi + + if ${syslogd_program}; then + echo "Ok" + else + echo "Failed" + exit 1 + fi +} + +stop() { + return 0 +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/05.klog b/target/device/valka/target_skeleton/etc/rc.d/05.klog new file mode 100755 index 000000000..1d018392f --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/05.klog @@ -0,0 +1,24 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Starting klogd: " + if [ ! -x ${klogd_program} ]; then + log_error "Missing 'klogd' program (${klogd_program})" + echo "Failed" + return 1 + fi + + if ${klogd_program}; then + echo "Ok" + else + echo "Failed " + exit 1 + fi +} + +stop() { + return 0 +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/06.modules b/target/device/valka/target_skeleton/etc/rc.d/06.modules new file mode 100755 index 000000000..af800d4d3 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/06.modules @@ -0,0 +1,31 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + if checkyesno ${modules_enable}; then + if [ ! -x "${modprobe_program}" -o ! -f "/etc/modules" ]; then + echo "Missing 'modprobe_program' program (${modprobe_program})" + exit 1 + else + echo + fi + + echo -n "Loading modules: " + grep '^[^#]' "/etc/modules" | \ + while read module args; do + [ "$module" ] || continue + if ${modprobe_program} $module $args; then + echo -n "$module " + else + echo -n "$module=failed " + fi + done + echo "" + fi +} + +stop() { + return 0 +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/10.network b/target/device/valka/target_skeleton/etc/rc.d/10.network new file mode 100755 index 000000000..ebe092a0e --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/10.network @@ -0,0 +1,32 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Network interfaces: " + if checkyesno ${eth0_enable}; then + if ${ifup_program} eth0 > /dev/null 2>&1; then + echo -n "eth0 " + else + echo -n "eth0=failed " + fi + fi + if checkyesno ${eth1_enable}; then + if ${ifup_program} eth1 > /dev/null 2>&1; then + echo -n "eth1" + else + echo -n "eth1=failed" + fi + fi + echo "" +} + +stop() { + echo -n " * Stopping network interfaces: " + if ${ifdown_program} -fa > /dev/null 2>&1; then + echo "Ok" + else + echo "Failed" + fi +} + +rc_run_command "$1" diff --git a/target/device/valka/target_skeleton/etc/rc.d/11.ntpdate b/target/device/valka/target_skeleton/etc/rc.d/11.ntpdate new file mode 100755 index 000000000..94f2626d1 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/11.ntpdate @@ -0,0 +1,24 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Running ntpdate: " + if [ ! -x ${ntpdate_program} ]; then + log_error "Missing 'ntpdate' program (${ntpdate_program})" + echo "Failed" + return 1 + fi + + if ${ntpdate_program} ${ntpdate_flags} ${ntpdate_servers} > /dev/null 2>&1; then + echo "Ok" + else + echo "Failed" + exit 1 + fi +} + +stop() { + return 0 +} + +rc_run_command "$1" "ntpdate" diff --git a/target/device/valka/target_skeleton/etc/rc.d/crond b/target/device/valka/target_skeleton/etc/rc.d/crond new file mode 100755 index 000000000..ef1b7fee0 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/crond @@ -0,0 +1,27 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Starting crond: " + if [ ! -x ${crond_program} ]; then + log_error "Missing 'crond' program (${crond_program})" + echo "Failed" + return 1 + fi + + ${crond_program} -f -c ${crond_dir} ${crond_flags} & + pid=$! + if [ "$?" -eq 0 ]; then + echo "${pid}" > ${crond_pidfile} + echo "Ok" + else + echo "Failed" + fi +} + +stop() { + echo " * Stopping crond..." + killpid ${crond_pidfile} +} + +rc_run_command "$1" "crond" diff --git a/target/device/valka/target_skeleton/etc/rc.d/dbus b/target/device/valka/target_skeleton/etc/rc.d/dbus new file mode 100755 index 000000000..4b81d3c38 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/dbus @@ -0,0 +1,30 @@ +#!/bin/sh +. /etc/rc.subr + +start() { + [ -x /usr/bin/dbus-daemon ] || exit 0 + [ -d /var/run/dbus ] || mkdir -p /var/run/dbus + [ -d /var/lock/subsys ] || mkdir -p /var/lock/subsys + + echo -n " * Starting dbus: " + + dbus-uuidgen --ensure + dbus-daemon --system + RETVAL=$? + echo "Ok" + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dbus-daemon +} + +stop() { + echo -n " * Stopping dbus: " + + killall dbus-daemon + RETVAL=$? + echo "Ok" + if [ $RETVAL -eq 0 ]; then + rm -f /var/lock/subsys/dbus-daemon + rm -f /var/run/messagebus.pid + fi +} + +rc_run_command "$1" "dbus" diff --git a/target/device/valka/target_skeleton/etc/rc.d/dropbear b/target/device/valka/target_skeleton/etc/rc.d/dropbear new file mode 100755 index 000000000..0868b2acf --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/dropbear @@ -0,0 +1,37 @@ +#!/bin/sh +. /etc/rc.subr + +start() { + if [ ! -d /etc/dropbear ]; then + if ! mkdir_fs /etc/dropbear; then + return 1 + fi + fi + + # Check for the Dropbear RSA key + if [ ! -f /etc/dropbear/dropbear_rsa_host_key ] ; then + echo -n " * Generating SSH RSA Key: " + ${dropbearkey_program} -t rsa -f /etc/dropbear/dropbear_rsa_host_key > /dev/null 2>&1 + echo "Ok" + fi + + # Check for the Dropbear DSS key + if [ ! -f /etc/dropbear/dropbear_dss_host_key ] ; then + echo -n " * Generating SSH DSS Key: " + ${dropbearkey_program} -t dss -f /etc/dropbear/dropbear_dss_host_key > /dev/null 2>&1 + echo "Ok" + fi + + echo -n " * Starting dropbear sshd: " + if ${dropbear_program} -P ${dropbear_pidfile} ${dropbear_flags}; then + echo "Ok" + else + echo "Failed" + fi +} +stop() { + echo " * Stopping dropbear sshd..." + killpid "${dropbear_pidfile}" +} + +rc_run_command "$1" "dropbear" diff --git a/target/device/valka/target_skeleton/etc/rc.d/gpio b/target/device/valka/target_skeleton/etc/rc.d/gpio new file mode 100755 index 000000000..39eb74dcc --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/gpio @@ -0,0 +1,34 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Setting up GPIO: " + + if ! create_gpio "io0" 1 0x03f8802a 0x03f88000; then + log_error "io0 failed" + echo "failed" + return 1 + fi + if ! create_gpio "io1" 0 0xaa800000 0x00000000; then + log_error "io1 failed" + echo "failed" + return 1 + fi + echo "Ok" +} + +stop() { + return 0 +} + +create_gpio() { + if ! mkdir_fs /config/gpio/${1}; then + return 1 + fi + echo "${2}" > /config/gpio/${1}/gpio_id + echo "${3}" > /config/gpio/${1}/pin_mask + echo "${4}" > /config/gpio/${1}/oe_mask + echo "1" > /config/gpio/${1}/enabled +} + +rc_run_command "$1" "gpio" diff --git a/target/device/valka/target_skeleton/etc/rc.d/gui b/target/device/valka/target_skeleton/etc/rc.d/gui new file mode 100755 index 000000000..494d11377 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/gui @@ -0,0 +1,39 @@ +#!/bin/sh +. /etc/rc.subr + +firsttime() { + if [ -e /var/db/gui.done ]; then + return 0 + fi + echo -n " * Running fc-cache: " + /usr/bin/fc-cache -v > /dev/null + echo "Ok" + + echo -n " * Querying PANGO modules: " + /usr/bin/pango-querymodules > /etc/pango/pango.modules + echo "Ok" + + echo -n " * Querying GTK Modules: " + /usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules + echo "Ok" + + echo -n " * Querying Pixbuf loaders: " + /usr/bin/gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders + echo "Ok" + + touch /var/db/gui.done +} + +start() { + firsttime + + echo -n " * Starting XOrg: " + ${xorg_program} ${xorg_flags} > ${xorg_log} 2>&1 & + echo "Ok" +} + +stop() { + return 0 +} + +rc_run_command "$1" "gui" diff --git a/target/device/valka/target_skeleton/etc/rc.d/inetd b/target/device/valka/target_skeleton/etc/rc.d/inetd new file mode 100755 index 000000000..f0d8d8452 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/inetd @@ -0,0 +1,27 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + echo -n " * Starting inetd: " + if [ ! -x ${inetd_program} ]; then + log_error "Missing 'inetd' program (${inetd_program})" + echo "Failed" + return 1 + fi + + ${inetd_program} -f ${inetd_flags} & + pid=$! + if [ "$?" -eq 0 ]; then + echo "${pid}" > ${inetd_pidfile} + echo "Ok" + else + echo "Failed" + fi +} + +stop() { + echo " * Stopping inetd..." + killpid ${inetd_pidfile} +} + +rc_run_command "$1" "inetd" diff --git a/target/device/valka/target_skeleton/etc/rc.d/lighttpd b/target/device/valka/target_skeleton/etc/rc.d/lighttpd new file mode 100755 index 000000000..97ff2f46a --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/lighttpd @@ -0,0 +1,17 @@ +#!/bin/sh +. /etc/rc.subr + +start() { + echo -n " * Starting lighttpd: " + if ${lighttpd_program} ${lighttpd_flags}; then + echo "Ok" + else + echo "Failed" + fi +} +stop() { + echo " * Stopping lighttpd..." + killpid "${lighttpd_pidfile}" +} + +rc_run_command "$1" "lighttpd" diff --git a/target/device/valka/target_skeleton/etc/rc.d/ntpd b/target/device/valka/target_skeleton/etc/rc.d/ntpd new file mode 100755 index 000000000..291da6317 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/ntpd @@ -0,0 +1,24 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + if [ ! -x ${ntpd_program} ]; then + log_error "Missing 'ntpd' program (${ntpd_program})" + echo "Failed" + return 1 + fi + + echo -n " * Starting ntpd: " + if ${ntpd_program} -c ${ntpd_config} -p ${ntpd_pidfile} ${ntpd_flags}; then + echo "Ok" + else + echo "Failed" + fi +} + +stop() { + echo " * Stopping ntpd..." + killpid ${ntpd_pidfile} +} + +rc_run_command "$1" "ntpd" diff --git a/target/device/valka/target_skeleton/etc/rc.d/onewire b/target/device/valka/target_skeleton/etc/rc.d/onewire new file mode 100755 index 000000000..332215463 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/onewire @@ -0,0 +1,34 @@ +#!/bin/ash +. /etc/rc.subr + +start() { + if checkyesno ${onewire_thermal_enable}; then + echo -n " * Loading 1wire thermal module: " + if ${modprobe_program} w1_therm; then + echo "Ok" + else + echo "Failed" + fi + fi + if checkyesno ${onewire_id_enable}; then + echo -n " * Loading 1wire id module: " + if ${modprobe_program} w1_ds2433; then + echo "Ok" + else + echo "Failed" + fi + fi + + echo -n " * Loading 1wire module: " + if ${modprobe_program} ds2482 force=0,0x18; then + echo "Ok" + else + echo "Failed" + fi +} + +stop() { + return 0 +} + +rc_run_command "$1" "onewire" diff --git a/target/device/valka/target_skeleton/etc/rc.d/portmap b/target/device/valka/target_skeleton/etc/rc.d/portmap new file mode 100755 index 000000000..12a7dc912 --- /dev/null +++ b/target/device/valka/target_skeleton/etc/rc.d/portmap @@ -0,0 +1,31 @@ +#!/bin/sh +. /etc/rc.subr + +start() { + if checkyesno ${portmap_enable}; then + if [ ! -x ${portmap_program} ]; then + log_error "Missing 'portmap' program (${portmap_program})" + echo "Failed" + return 1 + fi + + echo -n " * Starting portmap: " + if ${portmap_program} ${portmap_flags}; then + mkdir -p /var/lock/subsys + touch /var/lock/subsys/portmap + echo "Ok" + else + echo "Failed" + fi + fi +} + + +stop() { + echo -n " * Stopping portmap: " + killall portmap + rm -rf /var/lock/subsys > /dev/null 2>&1 + echo "Ok" +} + +rc_run_command "$1" |