ps3/petitboot: Run petitboot at first startup
authorgeoff <geoff@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 19 Aug 2009 22:36:53 +0000 (22:36 +0000)
committergeoff <geoff@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 19 Aug 2009 22:36:53 +0000 (22:36 +0000)
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17324 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/ps3/petitboot/base-files/sbin/initrun

index e253c24b3acaefa4dd16260d397835fcf0ac582a..1c3363fcc8cc97ef2db210c8e007bc15384254e2 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