summaryrefslogtreecommitdiffstats
path: root/defaultenv-2/base/bin/_boot
blob: 71d149082cd5d68e8e34c8c12bb1988f1b714fae (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
41
42
43
44
#!/bin/sh

# The real boot script, to be called from _boot_list which is called
# from boot

. /env/data/ansi-colors

# clear linux.bootargs.dyn.* and bootm.*
global -r linux.bootargs.dyn.
global -r bootm.

file="$1"

scr=/env/boot/$file
if [ ! -f "$scr" ]; then
	scr="$file"
fi

if [ ! -f "$scr" ]; then
	echo -e "${RED}/env/boot/${file}${NC} or ${RED}${file}${NC} do not exist"
	_boot_help
	exit 2
fi

if [ -L $scr ]; then
	readlink -f $scr boot
	basename $boot link
	basename $scr boot
	echo -e "${GREEN}boot${NC} ${YELLOW}${boot}${NC} -> ${CYAN}${link}${NC}"
else
	echo -e "${GREEN}booting ${YELLOW}$file${NC}..."
fi

$scr

if [ -n "$BOOT_DRYRUN" ]; then
	echo "dryrun. exiting now"
	exit 0
fi

${global.bootm.image} $BOOT_BOOTM_OPTS
bootm $BOOT_BOOTM_OPTS

echo -e "${GREEN}booting ${YELLOW}$file${NC} ${RED}failed${NC}"