diff options
-rw-r--r-- | utils/Makefile.am | 1 | ||||
-rw-r--r-- | utils/pb-console | 49 |
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 |