modules/freifunk: prepare ar71xx support in remote-update
[project/luci.git] / modules / freifunk / root / usr / sbin / remote-update
index 3f50f32..b900ada 100755 (executable)
@@ -22,6 +22,11 @@ find_image()
                                echo "openwrt-ubiquity-combined.img"
                        fi
                ;;
+               ar71xx)
+                       if grep -q '"kernel"' /proc/mtd; then
+                               echo "openwrt-ar71xx-combined.img"
+                       fi
+               ;;
                brcm-2.4)
                        echo "openwrt-brcm-2.4-squashfs.trx"
                ;;
@@ -49,9 +54,14 @@ find_local_checksum()
        echo $1
 }
 
+find_remote_info()
+{
+       wget -qO- "${1%/*}/VERSION.txt" 2>/dev/null
+}
+
 find_remote_version()
 {
-       wget -qO- "${1%/*}/VERSION.txt" 2>/dev/null | \
+       find_remote_info "$1" | \
                sed -ne "s!.*$D4/$D2/$D2 $D2:$D2.*!\\1\\2\\3\\4\\5!p;t"
 }
 
@@ -197,9 +207,12 @@ if [ "$checkupdate" = 1 ]; then
        [ -n "$v1" -a -n "$v2" ] && {
                version_compare "$v1" "$v2"
                [ $? == 2 ] && {
-                       echo "Update available! $v1 -> $v2"
+                       echo "Update available!${NL}Local:  $v1${NL}Remote: $v2${NL}--"
+                       find_remote_info "$image_url"
+                       exit 0
                } || {
                        echo "Local version $v1 is up to date"
+                       exit 2
                }
        } || {
                echo "No remote time stamp found."