#!/bin/sh # # Petitboot utility script for running a petitboot UI program # on a console tty. # ui=petitboot-nc shell=sh detach=0 usage() { echo "pb-console [OPTIONS] console_dev" >&2 echo "OPTIONS" >&2 echo " -d, --detach" >&2 echo " Start in a detached (background) state." >&2 echo " -h, --help" >&2 echo " Print a help message." >&2 exit 1 } while [ -n "$1" ] do case "$1" in --detach | -d) detach=1 ;; --help | -h) usage ;; --) ;; *) 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