mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
| #!/bin/sh
 | |
| 
 | |
| CMD=$(echo $0 | cut -d / -f 4)
 | |
| ARCH=$(uname -m)
 | |
| 
 | |
| if echo $ARCH | grep -q mips; then
 | |
| 	ARC='-mips32'
 | |
| else
 | |
| 	ARC=''
 | |
| fi
 | |
| 
 | |
| case "${CMD}" in
 | |
| 	cli)
 | |
| 		yaml-cli -i /etc/majestic.yaml "$@"
 | |
| 		;;
 | |
| 
 | |
| 	sensor_cli)
 | |
| 		yaml-cli -i /etc/sensor/$(fw_printenv -n sensor).yaml $@
 | |
| 		;;
 | |
| 
 | |
| 	ipctool)
 | |
| 		IPCTOOL=/tmp/ipctool
 | |
| 		if [ ! -x $IPCTOOL ]; then
 | |
| 			curl -s -L -f -o $IPCTOOL https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool$ARC
 | |
| 			response=$?
 | |
| 			if [[ "$response" -ne 0 ]]; then
 | |
| 				echo "Unable to download ipctool. cUrl error code is $response."
 | |
| 				exit $response
 | |
| 			else
 | |
| 				chmod +x $IPCTOOL
 | |
| 				echo "The ipctool installed as remote GitHub plugin"
 | |
| 			fi
 | |
| 		fi
 | |
| 		$IPCTOOL $@
 | |
| 		;;
 | |
| 
 | |
| 	check_mac)
 | |
| 		if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then
 | |
| 			XMMAC="$(ipcinfo --xm-mac)" && [ -n "${XMMAC}" ] && [ ! "Nothing found." = "${XMMAC}" ] && fw_setenv ethaddr ${XMMAC} && reboot -f || echo "Warning. Wired network interface has default MAC address, please change it."
 | |
| 		fi
 | |
| 		;;
 | |
| 
 | |
| 	system_fb)
 | |
| 		if ! [ -f /etc/system.ok ]; then
 | |
| 			[ -f /usr/share/openipc/customizer.sh ] && echo "Run customizer script..." && sh /usr/share/openipc/customizer.sh && touch /etc/system.ok || echo "Customizer script not present..."
 | |
| 		fi
 | |
| 		;;
 | |
| 	*)
 | |
| 		;;
 | |
| esac
 |