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