aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2021-05-16 23:58:59 +0200
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2021-05-17 01:01:32 +0200
commit4508b12b088a1d54baeabea117fcd7bb3dd5ed1f (patch)
tree6121c0c397e81627d1dc00247794d9a86cdc45d1
parentb108ed0ab09492d8d5a1775714da1ee34ce475ee (diff)
downloadupstream-4508b12b088a1d54baeabea117fcd7bb3dd5ed1f.tar.gz
upstream-4508b12b088a1d54baeabea117fcd7bb3dd5ed1f.tar.bz2
upstream-4508b12b088a1d54baeabea117fcd7bb3dd5ed1f.zip
octeon: use shared function for platform_copy_config()
This reduces redundant instructions. The solution is inspired by a different implemention of Roman Kuzmitskii. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
-rwxr-xr-xtarget/linux/octeon/base-files/lib/upgrade/platform.sh24
1 files changed, 13 insertions, 11 deletions
diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh b/target/linux/octeon/base-files/lib/upgrade/platform.sh
index 255699bb31..84533d642a 100755
--- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
+++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2014 OpenWrt.org
+# Copyright (C) 2021 OpenWrt.org
#
platform_get_rootfs() {
@@ -17,23 +17,25 @@ platform_get_rootfs() {
fi
}
+platform_copy_config_helper() {
+ local device=$1
+
+ mount -t vfat "$device" /mnt
+ cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
+ umount /mnt
+}
+
platform_copy_config() {
case "$(board_name)" in
erlite)
- mount -t vfat /dev/sda1 /mnt
- cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
- umount /mnt
+ platform_copy_config_helper /dev/sda1
;;
itus,shield-router)
- mount -t vfat /dev/mmcblk1p1 /mnt
- cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
- umount /mnt
+ platform_copy_config_helper /dev/mmcblk1p1
;;
- ubnt,edgerouter-4 | \
+ ubnt,edgerouter-4|\
ubnt,edgerouter-6p)
- mount -t vfat /dev/mmcblk0p1 /mnt
- cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
- umount /mnt
+ platform_copy_config_helper /dev/mmcblk0p1
;;
esac
}