a0678b858da0099efec7eb47010d0bec3ef6c3a1
[openwrt.git] / target / linux / adm5120 / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2009-2010 OpenWrt.org
3 #
4
5 . /lib/adm5120.sh
6
7 PART_NAME="firmware"
8 RAMFS_COPY_DATA=/lib/adm5120.sh
9
10 platform_check_image() {
11         local magic="$(get_magic_word "$1")"
12
13         [ "$ARGC" -gt 1 ] && return 1
14
15         case "$board_name" in
16         "ZyXEL"*)
17                 # .trx files
18                 [ "$magic" != "4844" ] && {
19                         echo "Invalid image type."
20                         return 1
21                 }
22                 return 0
23                 ;;
24         *)
25                 ;;
26         esac
27
28         echo "Sysupgrade is not yet supported on $board_name."
29         return 1
30 }
31
32 platform_do_upgrade() {
33         PART_NAME="$sys_mtd_part"
34         default_do_upgrade "$ARGV"
35 }
36
37 disable_watchdog() {
38         killall watchdog
39         ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
40                 echo 'Could not disable watchdog'
41                 return 1
42         }
43 }
44 append sysupgrade_pre_upgrade disable_watchdog