summaryrefslogtreecommitdiffstats
path: root/projectroot/lib/init/rc-once.sh
diff options
context:
space:
mode:
Diffstat (limited to 'projectroot/lib/init/rc-once.sh')
-rw-r--r--projectroot/lib/init/rc-once.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/projectroot/lib/init/rc-once.sh b/projectroot/lib/init/rc-once.sh
new file mode 100644
index 000000000..8689a32bc
--- /dev/null
+++ b/projectroot/lib/init/rc-once.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+RC_ONCE_DIR=/etc/rc.once.d
+DONE_DIR="$RC_ONCE_DIR/.done"
+STAMP="$DONE_DIR/rc-once"
+
+run_rc_once() {
+ failed=0
+ 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."
+ failed=1
+ else
+ : > "$DONE_DIR/$script"
+ fi
+ done
+ return $failed
+}
+