-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathfirmware-upgrade-L3
executable file
·61 lines (48 loc) · 1.42 KB
/
firmware-upgrade-L3
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh -e
#
# Copyright (C) 2016-2020 Hiveon
# Distributed under GNU GENERAL PUBLIC LICENSE 2.0
# License information can be found in the LICENSE file or at https://github.com/minershive/hiveos-asic/blob/master/LICENSE
#
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/hive/bin:/hive/sbin
URL="$1"
file=/tmp/$$
trap atexit 0
atexit() {
rm -rf $file
umount $file.boot 2>/dev/null || true
rmdir $file.boot 2>/dev/null || true
sync
if [ ! $ok ]; then
print "<h1>System upgrade failed</h1>"
fi
}
mkdir $file
cd $file
curl "$URL" | tar xvz
if [ -f runme.sh ]; then
sh runme.sh
else
if [ -e /dev/mmcblk0p3 ]; then
mkdir $file.boot
mount /dev/mmcblk0p1 $file.boot
cp -rf * $file.boot/
umount $file.boot
sync
fi
if [ -e /dev/mtd8 ]; then
if [ -f initramfs.bin.SD ]; then
echo "flash romfs"
flash_eraseall /dev/mtd8 >/dev/null 2>&1
nandwrite -p /dev/mtd8 initramfs.bin.SD >/dev/null 2>&1
fi
if [ -f uImage.bin ]; then
echo "flash kernel"
flash_eraseall /dev/mtd7 2>/dev/null
nandwrite -p /dev/mtd7 uImage.bin 2>/dev/null
fi
fi
fi
echo
echo "done"
sleep 1; /sbin/reboot -f