mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			Merge pull request #308 from cronyx/master
sysupgrade: check file not found or corruptpull/309/head
						commit
						c93f21efef
					
				|  | @ -1,9 +1,9 @@ | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
| # | # | ||||||
| # OpenIPC.org | v.20220727 | # OpenIPC.org | v.20220803 | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| scr_version=1.0.1 | scr_version=1.0.2 | ||||||
| 
 | 
 | ||||||
| args=" $@" | args=" $@" | ||||||
| 
 | 
 | ||||||
|  | @ -116,16 +116,20 @@ self_update() { | ||||||
|   	else |   	else | ||||||
| 		echo -e "\nOnline upgrade, checking sysupgrade version..." | 		echo -e "\nOnline upgrade, checking sysupgrade version..." | ||||||
| 	  	curl -s -k -L -o /tmp/sysupgrade "https://raw.githubusercontent.com/OpenIPC/firmware/master/general/overlay/usr/sbin/sysupgrade" | 	  	curl -s -k -L -o /tmp/sysupgrade "https://raw.githubusercontent.com/OpenIPC/firmware/master/general/overlay/usr/sbin/sysupgrade" | ||||||
| 	  	dstv=`grep scr_version /tmp/sysupgrade | head -1 | cut -f 2 -d '='` | 		if [ -f /tmp/sysupgrade ] && grep -q "#!/bin/sh" /tmp/sysupgrade; then | ||||||
| 	  	if ! [ "${scr_version}" = "${dstv}" ]; then | 	  		dstv=`grep scr_version /tmp/sysupgrade | head -1 | cut -f 2 -d '='` | ||||||
| 			echo "A new version is available, trying to update..." | 	  		if ! [ "${scr_version}" = "${dstv}" ]; then | ||||||
| 			chmod +x /tmp/sysupgrade | 				echo "A new version is available, trying to run updated script..." | ||||||
| 			echo -e "Done. Restarting...\n" | 				chmod +x /tmp/sysupgrade | ||||||
| 			exec /tmp/sysupgrade ${args} | 				exec /tmp/sysupgrade ${args} | ||||||
| 			exit 1 | 				echo -e "Done. Restarting...\n" | ||||||
| 	  	else | 				exit 1 | ||||||
| 			echo "Ok, version match." | 	  		else | ||||||
| 	  	fi | 				echo "Ok, version match." | ||||||
|  | 	  		fi | ||||||
|  | 		else | ||||||
|  | 			echo -e "\nVersion check failed. Possible network connection problem, script is corrupt or not found. Continue with bundled version." | ||||||
|  | 		fi | ||||||
|   	fi |   	fi | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue