Add CLI tools, network configuration script, and project documentation
This commit introduces: - A versatile CLI script with multiple utility functions - A network configuration shell script for interface setup - A README.md with basic project information - Additional configuration files for development environment
This commit is contained in:
51
cli.sh
Executable file
51
cli.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
CMD=$(echo "$0" | cut -d / -f 4)
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if echo "$ARCH" | grep -q mips; then
|
||||
ARC="-mips32"
|
||||
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)
|
||||
VENDOR=$(ipcinfo -v)
|
||||
if [ "$VENDOR" = "hisilicon" ] || [ "$VENDOR" = "goke" ]; then
|
||||
if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then
|
||||
XMMAC=$(ipcinfo --xm-mac)
|
||||
if [ -n "$XMMAC" ] && [ "$XMMAC" != "Nothing found." ]; then
|
||||
fw_setenv ethaddr "$XMMAC"
|
||||
reboot -f
|
||||
else
|
||||
echo "Warning. Wired network interface has default MAC address, please change it."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user