mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 01:52:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			107 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			107 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| check_certificates() {
 | |
| 	[ -f /certificates/cas.pem -a -f /certificates/cert.pem -a -f /certificates/key.pem ] && exit 0
 | |
| }
 | |
| 
 | |
| check_certificates
 | |
| 
 | |
| . /lib/functions.sh
 | |
| mkdir -p /certificates /etc/ucentral/
 | |
| mtd=$(find_mtd_index certificates)
 | |
| 
 | |
| if [ "$(head -c 4 /dev/mtd$mtd)" == "hsqs" ]; then
 | |
| 	mount -t squashfs /dev/mtdblock$mtd /certificates
 | |
| else
 | |
| 	[ -n "$mtd" -a -f /sys/class/mtd/mtd$mtd/oobsize ] && ubiattach -p /dev/mtd$mtd
 | |
| 	if [ -n "$(ubinfo -a | grep certificates)" ]; then
 | |
| 		[ -e /dev/ubi0 ] && mount -t ubifs ubi0:certificates /certificates
 | |
| 		[ -e /dev/ubi1 ] && mount -t ubifs ubi1:certificates /certificates
 | |
| 	fi
 | |
| fi
 | |
| 
 | |
| case "$(board_name)" in
 | |
| cig,wf660a)
 | |
| 	mmc_dev=$(echo $(find_mmc_part "0:ETHPHYFW") | sed 's/^.\{5\}//')
 | |
| 	[ -n "$mmc_dev" ] && mount -t ext4 /dev/$mmc_dev /certificates
 | |
| 	;;
 | |
| sonicfi,rap7110c-341x)
 | |
| 	mmc_dev=$(echo $(find_mmc_part "certificates") | sed 's/^.\{5\}//')
 | |
| 	[ -n "$mmc_dev" ] && mount -t squashfs /dev/$mmc_dev /certificates
 | |
| 	;;
 | |
| esac
 | |
| 
 | |
| check_certificates
 | |
| 
 | |
| # if we get here no valid certificates were found
 | |
| 
 | |
| PART_NAME=
 | |
| 
 | |
| case "$(board_name)" in
 | |
| actiontec,web7200)
 | |
| 	if grep -q bootselect=0 /proc/cmdline; then
 | |
| 		PART_NAME=firmware2
 | |
| 	else
 | |
| 		PART_NAME=firmware1
 | |
| 	fi
 | |
| 	;;
 | |
| edgecore,ecw5211|\
 | |
| edgecore,eap101|\
 | |
| edgecore,eap102|\
 | |
| edgecore,eap104|\
 | |
| edgecore,eap105|\
 | |
| edgecore,eap111|\
 | |
| edgecore,eap112|\
 | |
| edgecore,oap101|\
 | |
| edgecore,oap101e|\
 | |
| edgecore,oap101-6e|\
 | |
| edgecore,oap101e-6e|\
 | |
| edgecore,oap103)
 | |
| 	if grep -q rootfs1 /proc/cmdline; then
 | |
| 		PART_NAME=rootfs2
 | |
| 	else
 | |
| 		PART_NAME=rootfs1
 | |
| 	fi	
 | |
| 	;;
 | |
| hfcl,ion4xi|\
 | |
| hfcl,ion4xi_w|\
 | |
| hfcl,ion4x_w|\
 | |
| hfcl,ion4xi_HMR|\
 | |
| hfcl,ion4x|\
 | |
| hfcl,ion4x_2|\
 | |
| hfcl,ion4xi_wp|\
 | |
| hfcl,ion4xe)
 | |
| 	if grep -q rootfs_1 /proc/cmdline; then
 | |
| 		PART_NAME=rootfs
 | |
| 	else
 | |
| 		PART_NAME=rootfs_1
 | |
| 	fi	
 | |
| 	;;
 | |
| cig,wf186w|\
 | |
| cig,wf189|\
 | |
| cig,wf189w|\
 | |
| cig,wf189h|\
 | |
| cig,wf186h|\
 | |
| yuncore,ax840|\
 | |
| yuncore,fap655)
 | |
| 	PART_NAME=rootfs_1
 | |
| 	;;
 | |
| senao,iap2300m|\
 | |
| senao,iap4300m|\
 | |
| senao,jeap6500)
 | |
| 	PART_NAME=ubi
 | |
| 	;;
 | |
| *)
 | |
| 	return 1
 | |
| 	;;
 | |
| esac
 | |
| 
 | |
| MTD=$(find_mtd_index $PART_NAME)
 | |
| 
 | |
| [ -z "$MTD" ] && return 1
 | |
| 
 | |
| ubiattach -m $MTD -d 3
 | |
| [ -e /dev/ubi3 ] && mount -t ubifs ubi3:certificates /certificates
 | |
| 
 | |
| check_certificates
 | 
