summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-07 15:39:53 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-05-09 08:47:54 +0800
commitd92dcc900005d21911748cc85cd21df04ebad76d (patch)
tree72ca50b24952e3084b07d4030cfaef8ee521f05c /utils
parentc3f79834be3fe862388432d01f15f727c8b7cd7c (diff)
downloadtalos-petitboot-d92dcc900005d21911748cc85cd21df04ebad76d.tar.gz
talos-petitboot-d92dcc900005d21911748cc85cd21df04ebad76d.zip
utils: Add pb-console util
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile.am1
-rw-r--r--utils/pb-console49
2 files changed, 50 insertions, 0 deletions
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 67d64cc..3c13e61 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -21,6 +21,7 @@ AM_CFLAGS = \
$(DEFAULT_CFLAGS)
dist_sbin_SCRIPTS = pb-udhcpc
+pkglibexec_SCRIPTS = pb-console
sbin_PROGRAMS = pb-event
diff --git a/utils/pb-console b/utils/pb-console
new file mode 100644
index 0000000..636c5ad
--- /dev/null
+++ b/utils/pb-console
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+ui=petitboot-nc
+shell=sh
+
+detach=0
+
+while [ -n "$1" ]
+do
+ case "$1" in
+ -d)
+ detach=1
+ ;;
+ --)
+ ;;
+ *)
+ console=$1
+ ;;
+ esac
+ shift
+done
+
+if [ -n "$console" -a "${console#/dev/}" = "$console" ]
+then
+ console="/dev/$console"
+fi
+
+pb_loop() {
+ while :
+ do
+ $ui
+ echo "Exiting petitboot. Type 'exit' to return"
+ $shell
+ done
+}
+
+if [ -n "$console" ]
+then
+ exec <$console >$console 2>&1
+fi
+
+if [ "$detach" = 1 ]
+then
+ (
+ pb_loop
+ ) &
+else
+ pb_loop
+fi
OpenPOWER on IntegriCloud