ps3/petitboot: Run petitboot at first startup
[10.03/openwrt.git] / target / linux / ps3 / petitboot / base-files / sbin / initrun
index e253c24..1c3363f 100755 (executable)
@@ -1,3 +1,18 @@
 #!/bin/sh
+# Run petitboot at first startup, otherwise run a login.
 
-/bin/ash --login
+sbindir=/usr/sbin
+localstatedir=/var/petitboot
+
+petitboot=$sbindir/petitboot
+run_once=$localstatedir/.run-once
+
+if [ ! -f $run_once -a -x $petitboot ]; then
+       # quiet console
+       echo 3 > /proc/sys/kernel/printk
+       mkdir -p $localstatedir
+       touch $run_once
+        exec $petitboot --timeout
+fi
+
+exec /bin/ash --login