]> git.ozlabs.org Git - petitboot/blobdiff - utils/pb-console
utils: Add diagnostic script
[petitboot] / utils / pb-console
index 9da899fdf7b242f4c47652cd0d753c0691445253..282fca1193604ff57b7aff102844648ecd4e5f70 100644 (file)
@@ -9,6 +9,7 @@ shell=sh
 getty=/sbin/getty
 use_getty=0
 detach=0
+pb_config=pb-config
 
 usage() {
        cat >&2 <<EOF
@@ -96,17 +97,36 @@ do
        fi
 done
 
+# we force local terminals to use the linux termcap definition
+case "$(tty)" in
+/dev/tty[0-9]*)
+       export TERM=linux
+       ;;
+esac
+
+# we may have been run from udev - ensure we have a sensible PATH
+if [ -z "$PATH" ]
+then
+       PATH=/usr/bin:/usr/sbin:/bin:/sbin
+fi
+PATH=/var/lib/pb-plugins/bin:$PATH
+export PATH
+
 verbose_opt=
-sysinfo_bin=$(dirname $0)/pb-sysinfo
-if [ -x $sysinfo_bin ] && $sysinfo_bin --debug-enabled
+if $pb_config debug | grep -q enabled
 then
        verbose_opt=--verbose
 fi
 
+# kernel messages may write over the ncurses ui - change log level to only
+# show particularly important messages
+dmesg -n 1
+
 while :
 do
        $ui $verbose_opt
        reset
        echo "Exiting petitboot. Type 'exit' to return."
+       echo "You may run 'pb-sos' to gather diagnostic data"
        $shell
 done