summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2010-02-12 09:57:45 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2010-02-16 17:30:11 +0100
commit1c020c48c60ef81cf98f882ff51350433869c5f2 (patch)
treecd53a782bfc814eff63d0b8b74b766d9e93cda8f /generic
parent5ff9ebcba67dadb96b7a97c24d42fe6eadab33a0 (diff)
downloadptxdist-1c020c48c60ef81cf98f882ff51350433869c5f2.tar.gz
ptxdist-1c020c48c60ef81cf98f882ff51350433869c5f2.tar.xz
[rc-once] new package
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'generic')
-rw-r--r--generic/etc/init.d/rc-once50
1 files changed, 50 insertions, 0 deletions
diff --git a/generic/etc/init.d/rc-once b/generic/etc/init.d/rc-once
new file mode 100644
index 000000000..59ce05797
--- /dev/null
+++ b/generic/etc/init.d/rc-once
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+RC_ONCE_DIR=/etc/rc.once.d
+DONE_DIR="$RC_ONCE_DIR/.done"
+STAMP="$DONE_DIR/rc-once"
+
+. /lib/init/initmethod-bbinit-functions.sh
+
+run_start() {
+ test -e "$STAMP" && return
+
+ mount_root_rw || exit 1
+
+ export RC_ONCE_FAILED=no
+ echo "running rc.once.d services..."
+ cd "$RC_ONCE_DIR" || exit 1
+ mkdir -p "$DONE_DIR"
+ for script in *; do
+ test -x "$script" || continue
+ test -e "$DONE_DIR/$script" && continue
+ "$RC_ONCE_DIR/$script"
+ if [ $? -ne 0 ]; then
+ echo "running $script failed."
+ RC_ONCE_FAILED=yes
+ else
+ : > "$DONE_DIR/$script"
+ fi
+ done
+ if [ "$RC_ONCE_FAILED" != "yes" ]; then
+ : > "$STAMP"
+ fi
+ mount_root_restore
+}
+
+case "$1" in
+
+ start)
+ run_start
+ ;;
+
+ *)
+ echo "Usage: $0 {start}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
+