ar71xx: remove hard-coded folder name from Mikrotik RB upgrade
[openwrt/openwrt.git] / target / linux / ar71xx / base-files / lib / upgrade / dir825.sh
index e16128a9c5ebda82d2b55daf0dae90d589e694c1..e991a06b7a4dcb15be4b094da6af57b44332ca8e 100644 (file)
@@ -6,18 +6,6 @@
 . /lib/functions.sh
 . /lib/ar71xx.sh
 
-get_mtd_part_size() {
-       local part_name=$1
-       local first dev size erasesize name
-       while read dev size erasesize name; do
-               name=${name#'"'}; name=${name%'"'}
-               if [ "$name" = "$part_name" ]; then
-                       echo $((0x$size))
-                       break
-               fi
-       done < /proc/mtd
-}
-
 get_magic_at() {
        local mtddev=$1
        local pos=$2
@@ -87,7 +75,7 @@ dir825b_do_upgrade_combined() {
 
        if [ -n "$fw_mtd" ] &&  [ ${fw_blocks:-0} -gt 0 ]; then
                local append=""
-               [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR"
+               [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP"
 
                sync
                dd if="$fw_file" bs=64k skip=1 count=$fw_blocks 2>/dev/null | \
@@ -106,7 +94,7 @@ dir825b_check_image() {
                local md5_img=$(dd if="$1" bs=2 skip=9 count=16 2>/dev/null)
                local md5_chk=$(dd if="$1" bs=64k skip=1 2>/dev/null | md5sum -); md5_chk="${md5_chk%% *}"
                local fw_len=$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null)
-               local fw_part_len=$(get_mtd_part_size "firmware")
+               local fw_part_len=$(mtd_get_part_size "firmware")
 
                if [ -z "$fw_mtd" ]; then
                        ask_bool 0 "Do you have a backup of the caldata partition?" || {
@@ -160,7 +148,7 @@ platform_do_upgrade_dir825b() {
                else
                        PART_NAME="firmware"
                fi
-               default_do_upgrade "$ARGV"
+               default_do_upgrade "$1"
                ;;
        "43493030")
                if [ -z "$fw_mtd" ]; then
@@ -171,7 +159,7 @@ platform_do_upgrade_dir825b() {
                                exit 1
                        }
                fi
-               dir825b_do_upgrade_combined "firmware" "$ARGV"
+               dir825b_do_upgrade_combined "firmware" "$1"
                ;;
        esac
 }