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>
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (C) 2014 OpenWrt.org
 | 
					# Copyright (C) 2021 OpenWrt.org
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
platform_get_rootfs() {
 | 
					platform_get_rootfs() {
 | 
				
			||||||
@@ -17,23 +17,25 @@ platform_get_rootfs() {
 | 
				
			|||||||
	fi
 | 
						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() {
 | 
					platform_copy_config() {
 | 
				
			||||||
	case "$(board_name)" in
 | 
						case "$(board_name)" in
 | 
				
			||||||
	erlite)
 | 
						erlite)
 | 
				
			||||||
		mount -t vfat /dev/sda1 /mnt
 | 
							platform_copy_config_helper /dev/sda1
 | 
				
			||||||
		cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
 | 
					 | 
				
			||||||
		umount /mnt
 | 
					 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	itus,shield-router)
 | 
						itus,shield-router)
 | 
				
			||||||
		mount -t vfat /dev/mmcblk1p1 /mnt
 | 
							platform_copy_config_helper /dev/mmcblk1p1
 | 
				
			||||||
		cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
 | 
					 | 
				
			||||||
		umount /mnt
 | 
					 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	ubnt,edgerouter-4 | \
 | 
						ubnt,edgerouter-4|\
 | 
				
			||||||
	ubnt,edgerouter-6p)
 | 
						ubnt,edgerouter-6p)
 | 
				
			||||||
		mount -t vfat /dev/mmcblk0p1 /mnt
 | 
							platform_copy_config_helper /dev/mmcblk0p1
 | 
				
			||||||
		cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
 | 
					 | 
				
			||||||
		umount /mnt
 | 
					 | 
				
			||||||
		;;
 | 
							;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user