mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 18:07:52 +00:00 
			
		
		
		
	mount_certs: sonicfi squashfs certifiacte storage improve
Fixes: WIFI-15120 Signed-off-by: wingate5678 <wingate.chi@cybertan.com.tw>
This commit is contained in:
		 wingate5678
					wingate5678
				
			
				
					committed by
					
						 John Crispin
						John Crispin
					
				
			
			
				
	
			
			
			 John Crispin
						John Crispin
					
				
			
						parent
						
							e9d3e39d5e
						
					
				
				
					commit
					741007178f
				
			| @@ -25,6 +25,11 @@ copy_certificates() { | |||||||
| } | } | ||||||
|  |  | ||||||
| boot() { | boot() { | ||||||
|  | 	case "$(board_name)" in | ||||||
|  | 	sonicfi,rap6*) | ||||||
|  | 		touch /tmp/squashfs | ||||||
|  | 	;; | ||||||
|  | 	esac | ||||||
| 	[ -f /etc/ucentral/key.pem ] && return | 	[ -f /etc/ucentral/key.pem ] && return | ||||||
| 	/usr/bin/mount_certs | 	/usr/bin/mount_certs | ||||||
| 	copy_certificates | 	copy_certificates | ||||||
|   | |||||||
| @@ -37,13 +37,16 @@ sonicfi,rap7*) | |||||||
| 		mtd=$(find_mtd_index certificates) | 		mtd=$(find_mtd_index certificates) | ||||||
| 		[ -n "$mtd" ] && mount -t ext4 /dev/mtdblock$mtd /certificates | 		[ -n "$mtd" ] && mount -t ext4 /dev/mtdblock$mtd /certificates | ||||||
| 	fi | 	fi | ||||||
| 	if [ ! -f /certificates/cert.pem ] || [ ! -f /certificates/key.pem ]; then | 	;; | ||||||
| 		part=$(tar_part_lookup "0:BOOTCONFIG" "0:BOOTCONFIG1") | sonicfi,rap6*) | ||||||
| 		if [ -n "part" ]; then | 	mtd=$(find_mtd_index certificates) | ||||||
| 			mmc_dev=$(echo $(find_mmc_part "$part") | sed 's/^.\{5\}//') | 	if [ "$(head -c 4 /dev/mtd$mtd)" == "hsqs" ]; then | ||||||
| 			[ -n "$mmc_dev" ] && tar xf /dev/$mmc_dev -C /certificates | 		mount -t squashfs /dev/mtdblock$mtd /mnt | ||||||
| 		fi | 		cp /mnt/* /certificates | ||||||
|  | 		umount /mnt | ||||||
| 	fi | 	fi | ||||||
|  | 		mtd=$(find_mtd_index devinfo) | ||||||
|  | 		[ -n "$mtd" ] && tar xf /dev/mtdblock$mtd -C /certificates | ||||||
| 	;; | 	;; | ||||||
| udaya,a5-id2|\ | udaya,a5-id2|\ | ||||||
| yuncore,ax820) | yuncore,ax820) | ||||||
| @@ -59,19 +62,6 @@ yuncore,ax820) | |||||||
| 		[ -n "$mtd" ] && tar xf /dev/mtdblock$mtd -C /certificates | 		[ -n "$mtd" ] && tar xf /dev/mtdblock$mtd -C /certificates | ||||||
| 	fi | 	fi | ||||||
| 	;; | 	;; | ||||||
| sonicfi,rap6*) |  | ||||||
| 	mtd=$(find_mtd_index certificates) |  | ||||||
| 	if [ "$(head -c 4 /dev/mtd$mtd)" == "hsqs" ]; then |  | ||||||
| 		mount -t squashfs /dev/mtdblock$mtd /mnt |  | ||||||
| 		cp /mnt/* /certificates |  | ||||||
| 		umount /mnt |  | ||||||
| 	fi |  | ||||||
| 	part=$(tar_part_lookup "devinfo" "certificates") |  | ||||||
| 	if [ -n "$part" ]; then |  | ||||||
| 		mtd=$(find_mtd_index $part) |  | ||||||
| 		[ -n "$mtd" ] && tar xf /dev/mtdblock$mtd -C /certificates |  | ||||||
| 	fi |  | ||||||
| 	;; |  | ||||||
| *) | *) | ||||||
| 	mtd=$(find_mtd_index certificates) | 	mtd=$(find_mtd_index certificates) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,13 +14,6 @@ tar_part_lookup() { | |||||||
|  |  | ||||||
| . /lib/functions.sh | . /lib/functions.sh | ||||||
| case "$(board_name)" in | case "$(board_name)" in | ||||||
| sonicfi,rap7110c-341x) |  | ||||||
| 	cd /certificates |  | ||||||
| 	tar cf /tmp/certs.tar . |  | ||||||
| 	part=$(tar_part_lookup "0:BOOTCONFIG" "0:BOOTCONFIG1") |  | ||||||
| 	mmc_dev=$(echo $(find_mmc_part $part) | sed 's/^.\{5\}//') |  | ||||||
| 	dd if=/tmp/certs.tar of=/dev/$mmc_dev |  | ||||||
| 	;; |  | ||||||
| udaya,a5-id2|\ | udaya,a5-id2|\ | ||||||
| yuncore,ax820) | yuncore,ax820) | ||||||
| 	cd /certificates | 	cd /certificates | ||||||
| @@ -33,8 +26,7 @@ sonicfi,rap6*) | |||||||
| 	if [ "$(fw_printenv -n store_certs_disabled)" != "1" ]; then | 	if [ "$(fw_printenv -n store_certs_disabled)" != "1" ]; then | ||||||
| 		cd /certificates | 		cd /certificates | ||||||
| 		tar cf /tmp/certs.tar . | 		tar cf /tmp/certs.tar . | ||||||
| 		part=$(tar_part_lookup "devinfo" "certificates") | 		mtd=$(find_mtd_index devinfo) | ||||||
| 		mtd=$(find_mtd_index $part) |  | ||||||
| 		block_size=$(cat /sys/class/mtd/mtd$mtd/size) | 		block_size=$(cat /sys/class/mtd/mtd$mtd/size) | ||||||
| 		dd if=/tmp/certs.tar of=/tmp/certs_pad.tar bs=$block_size conv=sync | 		dd if=/tmp/certs.tar of=/tmp/certs_pad.tar bs=$block_size conv=sync | ||||||
| 		mtd write /tmp/certs_pad.tar /dev/mtd$mtd | 		mtd write /tmp/certs_pad.tar /dev/mtd$mtd | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user