mirror of https://github.com/OpenIPC/firmware.git
[no ci] Overlay: minor script adjustments (#1389)
parent
6346c442d2
commit
fe4c986beb
|
@ -13,5 +13,7 @@ case "$1" in
|
||||||
sh /usr/share/openipc/wireless.sh
|
sh /usr/share/openipc/wireless.sh
|
||||||
touch /etc/network.ok
|
touch /etc/network.ok
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
check_mac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
vendor=$(ipcinfo -v)
|
|
||||||
|
|
||||||
log_vendor() {
|
|
||||||
logger -s -p daemon.info -t ${vendor} "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
[ "${vendor}" = "goke" ] || [ "${vendor}" = "hisilicon" ] && status=$(check_mac)
|
echo "Loading vendor modules..."
|
||||||
[ -n "${status}" ] && log_vendor "${status}"
|
load_"$(ipcinfo -v)" -i
|
||||||
echo -e "\nLoading vendor modules..."
|
|
||||||
load_${vendor} -i
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
export SENSOR=$(fw_printenv -n sensor)
|
||||||
# Setting the TimeZone for all processes
|
export UPGRADE=$(fw_printenv -n upgrade)
|
||||||
export TZ=$(cat /etc/TZ)
|
export TZ=$(cat /etc/TZ)
|
||||||
|
|
||||||
# Set the firmware creation time as the base system time
|
# Set the firmware creation time as the base system time
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
.d88888b. 8888888 8888888b. .d8888b.
|
.d88888b. 8888888 8888888b. .d8888b.
|
||||||
d88P" "Y88b 888 888 Y88b d88P Y88b
|
d88P" "Y88b 888 888 Y88b d88P Y88b
|
||||||
888 888 888 888 888 888 888
|
888 888 888 888 888 888 888
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/tmp"
|
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/tmp"
|
||||||
export EDITOR="/bin/vi"
|
export EDITOR="/bin/vi"
|
||||||
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
export HOME="/root"
|
||||||
export HOME=${HOME:-/root}
|
|
||||||
export TZ=$(cat /etc/TZ)
|
|
||||||
export SENSOR=$(fw_printenv -n sensor)
|
export SENSOR=$(fw_printenv -n sensor)
|
||||||
|
export UPGRADE=$(fw_printenv -n upgrade)
|
||||||
|
export TZ=$(cat /etc/TZ)
|
||||||
|
|
||||||
echo_c() {
|
echo_c() {
|
||||||
echo -ne "\e[1;$1m$2\e[0m"
|
echo -ne "\e[1;$1m$2\e[0m"
|
||||||
|
@ -11,8 +11,8 @@ echo_c() {
|
||||||
|
|
||||||
if [ "$PS1" ]; then
|
if [ "$PS1" ]; then
|
||||||
[ -f /etc/os-release ] && . /etc/os-release
|
[ -f /etc/os-release ] && . /etc/os-release
|
||||||
[ -f /etc/openipc_banner ] && echo_c 34 "$(cat /etc/openipc_banner)"
|
[ -f /etc/openipc_banner ] && echo_c 34 "\n$(cat /etc/openipc_banner)"
|
||||||
echo_c 32 "$(printf "%51s" "${GITHUB_VERSION}")"
|
echo_c 32 "$(printf %51s "$GITHUB_VERSION")"
|
||||||
[ -f /etc/openipc_donors ] && echo_c 37 "\n\n$(cat /etc/openipc_donors)\n\n"
|
[ -f /etc/openipc_donors ] && echo_c 37 "\n\n$(cat /etc/openipc_donors)\n\n"
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
export PS1='\u@\h:\w\# '
|
export PS1='\u@\h:\w\# '
|
||||||
|
@ -46,7 +46,7 @@ show_fullname() {
|
||||||
}
|
}
|
||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
echo $(grep 'show.*()' /etc/profile | grep -v profile | cut -d '(' -f1)
|
grep 'show.*()' /etc/profile | grep -v profile | cut -d '(' -f1
|
||||||
}
|
}
|
||||||
|
|
||||||
show_gain() {
|
show_gain() {
|
||||||
|
@ -66,8 +66,8 @@ show_modules() {
|
||||||
echo "Module: $module"
|
echo "Module: $module"
|
||||||
link=/sys/module/$module/parameters
|
link=/sys/module/$module/parameters
|
||||||
if [ -d "$link" ]; then
|
if [ -d "$link" ]; then
|
||||||
ls $link | while read parameter; do
|
ls "$link" | while read parameter; do
|
||||||
val=$(cat $link/$parameter)
|
val=$(cat "$link/$parameter")
|
||||||
echo " $parameter --> ${val:-none}"
|
echo " $parameter --> ${val:-none}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -76,7 +76,7 @@ show_modules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
show_wlan() {
|
show_wlan() {
|
||||||
grep -r '$1..=' /etc/wireless | cut -d '"' -f4 | sort | grep -e $(fw_printenv -n soc) -e generic
|
grep -r '$1..=' /etc/wireless | cut -d '"' -f4 | sort | grep -e "$(fw_printenv -n soc)" -e generic
|
||||||
}
|
}
|
||||||
|
|
||||||
legacy_webui() {
|
legacy_webui() {
|
||||||
|
@ -85,6 +85,6 @@ legacy_webui() {
|
||||||
|
|
||||||
# Source configuration files from /etc/profile.d
|
# Source configuration files from /etc/profile.d
|
||||||
for i in /etc/profile.d/*.sh; do
|
for i in /etc/profile.d/*.sh; do
|
||||||
[ -r "$i" ] && . $i
|
[ -r "$i" ] && . "$i"
|
||||||
done
|
done
|
||||||
unset i
|
unset i
|
||||||
|
|
|
@ -1,28 +1,26 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
CMD=$(echo $0 | cut -d / -f 4)
|
CMD=$(echo "$0" | cut -d / -f 4)
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
if echo $ARCH | grep -q mips; then
|
if echo "$ARCH" | grep -q mips; then
|
||||||
ARC='-mips32'
|
ARC="-mips32"
|
||||||
else
|
|
||||||
ARC=''
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${CMD}" in
|
case "$CMD" in
|
||||||
cli)
|
cli)
|
||||||
yaml-cli -i /etc/majestic.yaml "$@"
|
yaml-cli -i /etc/majestic.yaml "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
sensor_cli)
|
sensor_cli)
|
||||||
yaml-cli -i /etc/sensor/$(fw_printenv -n sensor).yaml $@
|
yaml-cli -i /etc/sensor/"$(fw_printenv -n sensor)".yaml "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ipctool)
|
ipctool)
|
||||||
IPCTOOL=/tmp/ipctool
|
IPCTOOL=/tmp/ipctool
|
||||||
if [ ! -x $IPCTOOL ]; then
|
if [ ! -x $IPCTOOL ]; then
|
||||||
curl -s -L -f -o $IPCTOOL https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool$ARC
|
curl -s -L -f -o $IPCTOOL https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool"$ARC"
|
||||||
response=$?
|
response=$?
|
||||||
if [[ "$response" -ne 0 ]]; then
|
if [ "$response" -ne 0 ]; then
|
||||||
echo "Unable to download ipctool. cUrl error code is $response."
|
echo "Unable to download ipctool. cUrl error code is $response."
|
||||||
exit $response
|
exit $response
|
||||||
else
|
else
|
||||||
|
@ -30,12 +28,21 @@ case "${CMD}" in
|
||||||
echo "The ipctool installed as remote GitHub plugin"
|
echo "The ipctool installed as remote GitHub plugin"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
$IPCTOOL $@
|
$IPCTOOL "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
check_mac)
|
check_mac)
|
||||||
if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then
|
VENDOR=$(ipcinfo -v)
|
||||||
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."
|
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
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ debug() {
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
export SENSOR=$(fw_printenv -n sensor)
|
|
||||||
printf "Starting $DAEMON: "
|
printf "Starting $DAEMON: "
|
||||||
start-stop-daemon -b -S -m -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" -- $MAJESTIC_ARGS
|
start-stop-daemon -b -S -m -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" -- $MAJESTIC_ARGS
|
||||||
if [ $? = 0 ]; then
|
if [ $? = 0 ]; then
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
/etc/init.d/S10modules
|
/etc/init.d/S10modules
|
||||||
/etc/init.d/S20urandom
|
/etc/init.d/S20urandom
|
||||||
/etc/init.d/S21rngd
|
/etc/init.d/S21rngd
|
||||||
/etc/init.d/S40mdev
|
/etc/init.d/S38mdev
|
||||||
/etc/init.d/S49ntpd
|
/etc/init.d/S49ntpd
|
||||||
/etc/init.d/S50dropbear
|
/etc/init.d/S50dropbear
|
||||||
/etc/init.d/S50snmpd
|
|
||||||
/lib/libatomic*
|
/lib/libatomic*
|
||||||
/lib/libgcc*
|
/lib/libgcc*
|
||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
|
|
Loading…
Reference in New Issue