/
upgrade-bin-header2
53 lines (49 loc) · 1.08 KB
/
upgrade-bin-header2
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
#!/bin/sh
echo "Source file validation..."
sed -e '1,/^exit$/d' -e '/^rootfs-tag/,$d' "$0" | gzip -t -
err_chk=$?
if [ $err_chk -ne 1 ]; then
echo "Upgrading kernel image..."
/etc/init.d/br_wifi stop > /dev/null
/etc/init.d/samba stop > /dev/null
/usr/bin/killall -9 MonitorWan
/bin/kill -s USR1 `cat /tmp/lock/brlcd.lock`
/usr/bin/killall bandluxed
/usr/bin/killall BatteryMonitor
/usr/bin/killall crond
/usr/bin/killall udhcpd
/usr/bin/killall klogd
/usr/bin/killall syslogd
/bin/umount /data
/bin/umount /mnt
sync
sync
mtd erase mtd2
sed -e '1,/^exit$/d' -e '/^rootfs-tag/,$d' "$0" | tar xzOf - | mtd write - mtd2
echo "..."
sync
else
echo "Fail to decompress kernel image!"
fi
sync
sleep 3
echo "..."
sed -e '1,/^rootfs-tag/d' "$0" | gzip -t -
err_chk=$?
if [ $err_chk -ne 1 ]; then
echo "Upgrading rootfs..."
sync
mount -o remount,ro /
mtd erase mtd3
sed -e '1,/^rootfs-tag/d' "$0" | tar xzOf - | mtd write - mtd3
echo "...Upgrade Finish"
echo "System will reboot..."
sync
sync
sync
sleep 5
reboot -f
else
echo "Fail to decompress rootfs image!"
fi
exit