Newer
Older
barebox / defaultenv-2 / base / bin / init
@Sascha Hauer Sascha Hauer on 1 Nov 2012 931 bytes defenv-2: bring back /env/config
#!/bin/sh

export PATH=/env/bin

global hostname=generic
global user=none
global autoboot_timeout=3
global boot.default=net
global allow_color=true
global linux.bootargs.base
#linux.bootargs.dyn.* will be cleared at the beginning of boot
global linux.bootargs.dyn.ip
global linux.bootargs.dyn.root
global editcmd=sedit

/env/config

if [ ${global.allow_color} = "true" ]; then
        export PS1="\e[1;32mbarebox@\e[1;36m\h:\w\e[0m "
else
        export PS1="barebox@\h:\w "
fi

if [ -e /env/menu ]; then
	echo -e -n "\nHit m for menu or any other key to stop autoboot: "
else
	echo -e -n "\nHit any key to stop autoboot: "
fi

timeout -a $global.autoboot_timeout -v key
autoboot="$?"

if [ "${key}" = "q" ]; then
	exit
fi

for i in /env/init/*; do
	. $i
done

if [ "$autoboot" = 0 ]; then
	boot
fi

if [ -e /env/menu ]; then
	if [ "${key}" != "m" ]; then
		echo -e "\ntype exit to get to the menu"
		sh
	fi
	/env/menu/mainmenu
fi