summaryrefslogtreecommitdiffstats
path: root/defaultenv/bin/_update
blob: 87e6922326d43efbcbe1921d0406444cf4064480 (plain) (blame)
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
#!/bin/sh

if [ -z "$part" -o -z "$image" ]; then
	echo "define \$part and \$image"
	exit 1
fi

if [ ! -e "$part" ]; then
	echo "Partition $part does not exist"
	exit 1
fi

if [ x$mode = xtftp ]; then
	if [ x$ip = xdhcp ]; then
		dhcp
	fi

	ping $eth0.serverip
	if [ $? -ne 0 ] ; then
		echo "Server did not reply! Update aborted."
		exit 1
	fi
fi

unprotect $part

echo
echo "erasing partition $part"
echo
erase $part

echo
echo "flashing $image to $part"
echo

if [ x$mode = xtftp ]; then
	tftp $image $part
else
	loadb -f $image -c
	cp $image $part
fi

protect $part