summaryrefslogtreecommitdiffstats
path: root/projectroot/lib/init/rc-once.sh
blob: 8689a32bc72c22aff688aed77d244319052a2a6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
}