summaryrefslogtreecommitdiffstats
path: root/utils/pb-console
blob: 924e1c3ac3bea9d2eb57100ad90035650edf02d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
#
# Petitboot utility script for running a petitboot UI program
# on a console tty.
#
# Copyright © 2017 Raptor Engineering, LLC
# Released under the terms of the GNU GPL v2

for f in /etc/environment /etc/locale
do
	if [ -e "$f" ]
	then
		export $(cat "$f")
	fi
done

case "$(tty)" in
/dev/tty[0-9]*)
	export TERM=linux
	;;
esac

if [ -z "$PATH" ]
then
	PATH=/usr/bin:/usr/sbin:/bin:/sbin
fi
PATH=/var/lib/pb-plugins/bin:$PATH
export PATH

echo 0 > /proc/sys/kernel/printk
clear

if [ -e /etc/pb-lockdown ]; then
	echo "Failed to launch petitboot, rebooting!"
	echo 1 > /proc/sys/kernel/sysrq
	echo b > /proc/sysrq-trigger
else
	echo "Failed to launch petitboot, dropping to a shell"
	exec sh
fi
OpenPOWER on IntegriCloud