base-files: pass "save_config" option to the "sysupgrade" method
This explicitly lets stage2 know if config should be preserved.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit b534ba9611)
			
			
This commit is contained in:
		 Rafał Miłecki
					Rafał Miłecki
				
			
				
					committed by
					
						 Jo-Philipp Wich
						Jo-Philipp Wich
					
				
			
			
				
	
			
			
			 Jo-Philipp Wich
						Jo-Philipp Wich
					
				
			
						parent
						
							4e85dc95b0
						
					
				
				
					commit
					f25d164aca
				
			| @@ -218,7 +218,7 @@ indicate_upgrade() { | |||||||
| # $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m | # $(2): (optional) pipe command to extract firmware, e.g. dd bs=n skip=m | ||||||
| default_do_upgrade() { | default_do_upgrade() { | ||||||
| 	sync | 	sync | ||||||
| 	if [ "$SAVE_CONFIG" -eq 1 ]; then | 	if [ "$UPGRADE_OPT_SAVE_CONFIG" -eq 1 ]; then | ||||||
| 		get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}" | 		get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}" | ||||||
| 	else | 	else | ||||||
| 		get_image "$1" "$2" | mtd $MTD_ARGS write - "${PART_NAME:-image}" | 		get_image "$1" "$2" | mtd $MTD_ARGS write - "${PART_NAME:-image}" | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ else | |||||||
| 	default_do_upgrade "$IMAGE" | 	default_do_upgrade "$IMAGE" | ||||||
| fi | fi | ||||||
|  |  | ||||||
| if [ "$SAVE_CONFIG" -eq 1 ] && type 'platform_copy_config' >/dev/null 2>/dev/null; then | if [ "$UPGRADE_OPT_SAVE_CONFIG" -eq 1 ] && type 'platform_copy_config' >/dev/null 2>/dev/null; then | ||||||
| 	platform_copy_config | 	platform_copy_config | ||||||
| fi | fi | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,7 +6,6 @@ | |||||||
| export IMAGE="$1" | export IMAGE="$1" | ||||||
| COMMAND="$2" | COMMAND="$2" | ||||||
|  |  | ||||||
| export SAVE_CONFIG=1 |  | ||||||
| export SAVE_PARTITIONS=1 | export SAVE_PARTITIONS=1 | ||||||
|  |  | ||||||
| export INTERACTIVE=0 | export INTERACTIVE=0 | ||||||
| @@ -18,7 +17,6 @@ RAMFS_COPY_BIN=		# extra programs for temporary ramfs root | |||||||
| RAMFS_COPY_DATA=	# extra data files | RAMFS_COPY_DATA=	# extra data files | ||||||
|  |  | ||||||
|  |  | ||||||
| [ -f "$CONF_TAR" ] || export SAVE_CONFIG=0 |  | ||||||
| [ -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap ] && export SAVE_PARTITIONS=0 | [ -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap ] && export SAVE_PARTITIONS=0 | ||||||
|  |  | ||||||
| include /lib/upgrade | include /lib/upgrade | ||||||
|   | |||||||
| @@ -369,6 +369,9 @@ else | |||||||
| 	ubus call system sysupgrade "{ | 	ubus call system sysupgrade "{ | ||||||
| 		\"prefix\": $(json_string "$RAM_ROOT"), | 		\"prefix\": $(json_string "$RAM_ROOT"), | ||||||
| 		\"path\": $(json_string "$IMAGE"), | 		\"path\": $(json_string "$IMAGE"), | ||||||
| 		\"command\": $(json_string "$COMMAND") | 		\"command\": $(json_string "$COMMAND"), | ||||||
|  | 		\"options\": { | ||||||
|  | 			\"save_config\": $SAVE_CONFIG | ||||||
|  | 		} | ||||||
| 	}" | 	}" | ||||||
| fi | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user