mirror of https://github.com/OpenIPC/firmware.git
format scripts with tabs, replace backticks, refactor (#770)
parent
ca3fffe5cd
commit
a6b9d985f4
|
@ -13,8 +13,7 @@ SYSLOGD_ARGS="-C64 -t"
|
|||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" \
|
||||
-- -n $SYSLOGD_ARGS
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" -- -n $SYSLOGD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
|
@ -45,10 +44,10 @@ restart() {
|
|||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
"$1" ;;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
restart ;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "Loading modules:"
|
||||
# load modules for detected devices
|
||||
# find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
|
||||
start)
|
||||
printf "Loading modules:"
|
||||
# load modules for detected devices
|
||||
# find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
|
||||
|
||||
# load modules from /etc/modules
|
||||
[ -r /etc/modules ] || exit 0
|
||||
while read module args; do
|
||||
case "$module" in
|
||||
""|"#"*) continue ;;
|
||||
esac
|
||||
# load modules from /etc/modules
|
||||
[ -r /etc/modules ] || exit 0
|
||||
while read module args; do
|
||||
case "$module" in
|
||||
""|"#"*) continue ;;
|
||||
esac
|
||||
|
||||
# attempt to load modules
|
||||
modprobe ${module} ${args} >/dev/null
|
||||
done < /etc/modules
|
||||
;;
|
||||
# attempt to load modules
|
||||
modprobe ${module} ${args} >/dev/null
|
||||
done < /etc/modules
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -31,18 +31,11 @@ stop()
|
|||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
start|stop)
|
||||
"$1" ;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
stop; start ;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
#
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting mdev..."
|
||||
# echo /sbin/mdev >/proc/sys/kernel/hotplug
|
||||
/sbin/mdev -s
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
restart|reload)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
start)
|
||||
echo "Starting mdev..."
|
||||
echo /sbin/mdev >/proc/sys/kernel/hotplug
|
||||
/sbin/mdev -s
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
restart|reload)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
|
|
@ -13,8 +13,7 @@ NTPD_ARGS="-n"
|
|||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
|
||||
-- $NTPD_ARGS
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $NTPD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
|
@ -45,10 +44,9 @@ restart() {
|
|||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
"$1" ;;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
restart ;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
|
|
|
@ -14,9 +14,7 @@ start() {
|
|||
# create the directory pointed to by the symlink.
|
||||
# - the filesystem is RW (i.e. we can rm the symlink),
|
||||
# replace the symlink with an actual directory
|
||||
if [ -L /etc/dropbear \
|
||||
-a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]
|
||||
then
|
||||
if [ -L /etc/dropbear -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]; then
|
||||
if rm -f /etc/dropbear >/dev/null 2>&1; then
|
||||
mkdir -p /etc/dropbear
|
||||
else
|
||||
|
@ -29,8 +27,7 @@ start() {
|
|||
printf "Starting dropbear sshd: "
|
||||
umask 077
|
||||
|
||||
start-stop-daemon -S -q -p /var/run/dropbear.pid \
|
||||
--exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
|
||||
start-stop-daemon -S -q -p /var/run/dropbear.pid --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
stop() {
|
||||
|
@ -44,18 +41,13 @@ restart() {
|
|||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
start|stop|restart)
|
||||
"$1" ;;
|
||||
reload)
|
||||
restart ;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
|
|
@ -14,8 +14,7 @@ start() {
|
|||
printf 'Starting %s: ' "$DAEMON"
|
||||
[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, "
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
|
||||
-- $SNMPD_ARGS
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $SNMPD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
|
@ -47,10 +46,9 @@ restart() {
|
|||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
"$1" ;;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
restart ;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
|
|
|
@ -7,35 +7,27 @@ TELNETD_ARGS="-F -p 4321 -l /bin/sh"
|
|||
[ -r /etc/default/telnet ] && . /etc/default/telnet
|
||||
|
||||
start() {
|
||||
printf "Starting telnetd: "
|
||||
[ -f /usr/sbin/telnetd ] || echo -en "DISABLED, "
|
||||
start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd -- $TELNETD_ARGS
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
printf "Starting telnetd: "
|
||||
[ -f /usr/sbin/telnetd ] || echo -en "DISABLED, "
|
||||
start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid -x /usr/sbin/telnetd -- $TELNETD_ARGS
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping telnetd: "
|
||||
[ -f /usr/sbin/telnetd ] || echo -en "DISABLED, "
|
||||
start-stop-daemon -K -q -p /var/run/telnetd.pid \
|
||||
-x /usr/sbin/telnetd
|
||||
start-stop-daemon -K -q -p /var/run/telnetd.pid -x /usr/sbin/telnetd
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
start|stop)
|
||||
"$1" ;;
|
||||
restart|reload)
|
||||
stop; start ;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
|
|
@ -14,8 +14,7 @@ start() {
|
|||
printf 'Starting %s: ' "$DAEMON"
|
||||
[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, "
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
|
||||
-- $CROND_ARGS
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $CROND_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
|
@ -47,10 +46,9 @@ restart() {
|
|||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
"$1" ;;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
restart ;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
# load vendor specific drivers
|
||||
#
|
||||
#
|
||||
vendor=$(ipcinfo -v)
|
||||
status=$(check_mac)
|
||||
|
||||
log_vendor() {
|
||||
logger -s -p daemon.info -t ${vendor} "$1"
|
||||
logger -s -p daemon.info -t ${vendor} "$1"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ -n "${status}" ] && log_vendor "${status}"
|
||||
echo -e '\nLoading of kernel modules...'
|
||||
load_${vendor} -i
|
||||
;;
|
||||
start)
|
||||
[ -n "${status}" ] && log_vendor "${status}"
|
||||
echo -e '\nLoading of kernel modules...'
|
||||
load_${vendor} -i
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -1,34 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
# You don't usually need to touch this file at all, the full configuration
|
||||
# of the bridge can be done in a standard way on /etc/network/interfaces.
|
||||
# Configuration of the bridge should be done in /etc/network/interfaces.d/bridgeX
|
||||
# Read more at https://wiki.debian.org/BridgeNetworkConnections
|
||||
|
||||
# Have a look at /usr/share/doc/bridge-utils/README.Debian.gz if you want
|
||||
# more info about the way on wich a bridge is set up on Debian.
|
||||
|
||||
if [ ! -x /usr/sbin/brctl ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
[ ! -x /usr/sbin/brctl ] && exit 0
|
||||
|
||||
case "$IF_BRIDGE_PORTS" in
|
||||
"")
|
||||
exit 0
|
||||
;;
|
||||
none)
|
||||
INTERFACES=""
|
||||
;;
|
||||
all)
|
||||
INTERFACES=`grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/'`
|
||||
;;
|
||||
*)
|
||||
INTERFACES="$IF_BRIDGE_PORTS"
|
||||
;;
|
||||
"")
|
||||
exit 0 ;;
|
||||
none)
|
||||
INTERFACES="" ;;
|
||||
all)
|
||||
INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') ;;
|
||||
*)
|
||||
INTERFACES="$IF_BRIDGE_PORTS" ;;
|
||||
esac
|
||||
|
||||
brctl delbr $IFACE
|
||||
|
||||
for i in $INTERFACES
|
||||
do
|
||||
for i in $INTERFACES; do
|
||||
ip link set $i down
|
||||
done
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$IF_VLAN_RAW_DEVICE" ] && [ -z "`echo $IFACE | grep '.\+\.[0-9]\+$'`" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -x /sbin/vconfig ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
[ -z "$IF_VLAN_RAW_DEVICE" ] && [ -z "$(echo $IFACE | grep '.\+\.[0-9]\+$')" ] && exit 0
|
||||
[ ! -x /sbin/vconfig ] && exit 0
|
||||
|
||||
vconfig rem $IFACE
|
||||
|
|
|
@ -1,39 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
# You don't usually need to touch this file at all, the full configuration
|
||||
# of the bridge can be done in a standard way on /etc/network/interfaces.
|
||||
# Configuration of the bridge should be done in /etc/network/interfaces.d/bridgeX
|
||||
# Read more at https://wiki.debian.org/BridgeNetworkConnections
|
||||
|
||||
# Have a look at /usr/share/doc/bridge-utils/README.Debian.gz if you want
|
||||
# more info about the way on wich a bridge is set up on Debian.
|
||||
|
||||
if [ ! -x /usr/sbin/brctl ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
[ ! -x /usr/sbin/brctl ] && exit 0
|
||||
|
||||
case "$IF_BRIDGE_PORTS" in
|
||||
"")
|
||||
exit 0
|
||||
;;
|
||||
none)
|
||||
INTERFACES=""
|
||||
;;
|
||||
all)
|
||||
INTERFACES=`grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/'`
|
||||
;;
|
||||
*)
|
||||
INTERFACES="$IF_BRIDGE_PORTS"
|
||||
;;
|
||||
"")
|
||||
exit 0 ;;
|
||||
none)
|
||||
INTERFACES="" ;;
|
||||
all)
|
||||
INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') ;;
|
||||
*)
|
||||
INTERFACES="$IF_BRIDGE_PORTS" ;;
|
||||
esac
|
||||
|
||||
brctl addbr $IFACE &&
|
||||
|
||||
for i in $INTERFACES
|
||||
do
|
||||
if [ -x /etc/network/if-pre-up.d/vlan ]; then
|
||||
env IFACE=$i /etc/network/if-pre-up.d/vlan
|
||||
fi
|
||||
brctl addif $IFACE $i && ip link set dev $i up
|
||||
for i in $INTERFACES; do
|
||||
[ -x /etc/network/if-pre-up.d/vlan ] && env IFACE=$i /etc/network/if-pre-up.d/vlan
|
||||
brctl addif $IFACE $i && ip link set dev $i up
|
||||
done
|
||||
|
||||
brctl stp $IFACE off
|
||||
|
|
|
@ -3,36 +3,31 @@
|
|||
# Most of this stuff is to enable vlans
|
||||
|
||||
case "$IFACE" in
|
||||
vlan0*)
|
||||
vlan0*)
|
||||
vconfig set_name_type VLAN_PLUS_VID
|
||||
VLANID=`echo $IFACE|sed "s/vlan0*//"`
|
||||
VLANID=$(echo $IFACE|sed "s/vlan0*//")
|
||||
;;
|
||||
vlan*)
|
||||
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
|
||||
VLANID=`echo $IFACE|sed "s/vlan*//"`
|
||||
VLANID=$(echo $IFACE|sed "s/vlan*//")
|
||||
;;
|
||||
*.0*)
|
||||
vconfig set_name_type DEV_PLUS_VID
|
||||
VLANID=`echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g"`
|
||||
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/"`
|
||||
VLANID=$(echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g")
|
||||
IF_VLAN_RAW_DEVICE=$(echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/")
|
||||
;;
|
||||
*.*)
|
||||
vconfig set_name_type DEV_PLUS_VID_NO_PAD
|
||||
VLANID=`echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g"`
|
||||
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/"`
|
||||
;;
|
||||
*) exit 0
|
||||
VLANID=$(echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g")
|
||||
IF_VLAN_RAW_DEVICE=$(echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/")
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
esac
|
||||
|
||||
if [ -n "$IF_VLAN_RAW_DEVICE" ]
|
||||
then
|
||||
if [ ! -x /sbin/vconfig ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null
|
||||
then
|
||||
if [ -n "$IF_VLAN_RAW_DEVICE" ]; then
|
||||
[ ! -x /sbin/vconfig ] && exit 0
|
||||
if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null; then
|
||||
echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -43,7 +38,4 @@ fi
|
|||
ip link set qlen 1000 dev $IFACE
|
||||
|
||||
# This is not vlan specific, and should actually go somewhere else.
|
||||
if [ -n "$IF_HW_MAC_ADDRESS" ]
|
||||
then
|
||||
ip link set $IFACE address $IF_HW_MAC_ADDRESS
|
||||
fi
|
||||
[ -n "$IF_HW_MAC_ADDRESS" ] && ip link set $IFACE address $IF_HW_MAC_ADDRESS
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
iface eth0:1 inet static
|
||||
address $(fw_printenv -n ipaddr || echo 192.168.1.10)
|
||||
netmask 255.255.255.0
|
||||
|
|
|
@ -12,7 +12,7 @@ if [ "$PS1" ]; then
|
|||
echo_c 32 "$(printf "%56s" "${GITHUB_VERSION}")"
|
||||
[ -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\# '
|
||||
else
|
||||
export PS1='\u@\h:\w\$ '
|
||||
|
|
|
@ -4,32 +4,32 @@ CMD=$(echo $0 | cut -d / -f 4)
|
|||
ARCH=$(uname -m)
|
||||
|
||||
if echo $ARCH | grep -q mips; then
|
||||
ARC='-mips32'
|
||||
ARC='-mips32'
|
||||
else
|
||||
ARC=''
|
||||
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 -o $IPCTOOL https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool$ARC
|
||||
chmod +x $IPCTOOL
|
||||
echo "The ipctool installed as remote GitHub plugin"
|
||||
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
|
||||
;;
|
||||
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 -o $IPCTOOL https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool$ARC
|
||||
chmod +x $IPCTOOL
|
||||
echo "The ipctool installed as remote GitHub plugin"
|
||||
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
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -9,41 +9,41 @@ mpp=$(awk '/Version:/ {print $3,$4"]"}' /proc/umap/sys) || true
|
|||
soc=$(ipcinfo --chip-name)
|
||||
|
||||
prepare() {
|
||||
case ${soc} in
|
||||
case ${soc} in
|
||||
|
||||
hi3516ev200 | hi3516ev300 | hi3516dv200 | hi3518ev300)
|
||||
echo -e "\n\e[1;31mA supported processor with ${mpp} was found...\e[0m\n"
|
||||
echo -e "\n\e[1;31mDownload PQTools from https://github.com/widgetii/pqtools/raw/master/hi3516ev300/PQTools.tgz\e[0m\n"
|
||||
ittb_url="https://raw.githubusercontent.com/widgetii/pqtools/master/hi3516ev300/ittb_V1.0.1.2.tgz"
|
||||
ittb_folder="ittb_V1.0.1.2"
|
||||
;;
|
||||
hi3516ev200 | hi3516ev300 | hi3516dv200 | hi3518ev300)
|
||||
echo -e "\n\e[1;31mA supported processor with ${mpp} was found...\e[0m\n"
|
||||
echo -e "\n\e[1;31mDownload PQTools from https://github.com/widgetii/pqtools/raw/master/hi3516ev300/PQTools.tgz\e[0m\n"
|
||||
ittb_url="https://raw.githubusercontent.com/widgetii/pqtools/master/hi3516ev300/ittb_V1.0.1.2.tgz"
|
||||
ittb_folder="ittb_V1.0.1.2"
|
||||
;;
|
||||
|
||||
gk7205v200 | gk7205v300)
|
||||
echo -e "\n\e[1;31mA supported processor with unknown MPP was found...\e[0m\n"
|
||||
echo -e "\n\e[1;31mDownload PQTools from https://github.com/widgetii/pqtools/raw/master/gk7205v200/PQTools.tgz\e[0m\n"
|
||||
ittb_url="https://raw.githubusercontent.com/widgetii/pqtools/master/gk7205v200/ittb_V1.0.2.0.tgz"
|
||||
ittb_folder="ittb_V1.0.2.0"
|
||||
;;
|
||||
gk7205v200 | gk7205v300)
|
||||
echo -e "\n\e[1;31mA supported processor with unknown MPP was found...\e[0m\n"
|
||||
echo -e "\n\e[1;31mDownload PQTools from https://github.com/widgetii/pqtools/raw/master/gk7205v200/PQTools.tgz\e[0m\n"
|
||||
ittb_url="https://raw.githubusercontent.com/widgetii/pqtools/master/gk7205v200/ittb_V1.0.2.0.tgz"
|
||||
ittb_folder="ittb_V1.0.2.0"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo -e "\n\e[1;31mSorry but the ${soc} is not supported at the moment...\e[0m\n"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e "\n\e[1;31mSorry but the ${soc} is not supported at the moment...\e[0m\n"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
download() if [[ -d /tmp/${ittb_folder} ]]; then
|
||||
echo -e "\n\e[1;31mA directory with utilities was found and the download is not needed...\e[0m\n"
|
||||
echo -e "\n\e[1;31mWe run the utilities for sensor calibration...\e[0m\n"
|
||||
cd /tmp/${ittb_folder}
|
||||
./start.sh
|
||||
echo -e "\n\e[1;31mA directory with utilities was found and the download is not needed...\e[0m\n"
|
||||
echo -e "\n\e[1;31mWe run the utilities for sensor calibration...\e[0m\n"
|
||||
cd /tmp/${ittb_folder}
|
||||
./start.sh
|
||||
else
|
||||
echo -e "\n\e[1;31mDownloading the latest tools, please wait...\e[0m\n"
|
||||
curl -s ${ittb_url} | gzip -d - | tar xvf - -C /tmp
|
||||
echo -e "\n\e[1;31mWe run the utilities for sensor calibration...\e[0m\n"
|
||||
cd /tmp/${ittb_folder}
|
||||
./start.sh
|
||||
echo -e "\n\e[1;31mDownloading the latest tools, please wait...\e[0m\n"
|
||||
curl -s ${ittb_url} | gzip -d - | tar xvf - -C /tmp
|
||||
echo -e "\n\e[1;31mWe run the utilities for sensor calibration...\e[0m\n"
|
||||
cd /tmp/${ittb_folder}
|
||||
./start.sh
|
||||
fi
|
||||
|
||||
prepare && download
|
||||
|
|
|
@ -40,7 +40,7 @@ do_update_kernel() {
|
|||
echo_c 33 "\nKernel"
|
||||
echo "Update kernel from $x"
|
||||
[ ! -f "$x" ] && die "File $x not found"
|
||||
if [ "1" != "$skip_soc" ]; then
|
||||
if [ "1" != "$skip_soc" ]; then
|
||||
local ksoc=$(od -j 32 -N 32 -S 1 -A n "$x" | cut -d- -f3)
|
||||
# FIXME: Ingenic kernels do not include proper SoC identifiers.
|
||||
case "$soc" in
|
||||
|
@ -55,7 +55,7 @@ do_update_kernel() {
|
|||
}
|
||||
|
||||
do_update_rootfs() {
|
||||
local x=$1
|
||||
local x=$1
|
||||
[ -z "$x" ] && x="/tmp/rootfs.squashfs.$soc"
|
||||
echo_c 33 "\nRootFS"
|
||||
echo "Update rootfs from $x"
|
||||
|
|
|
@ -108,8 +108,8 @@ esac
|
|||
|
||||
HOOK_DIR="$0.d"
|
||||
for hook in "${HOOK_DIR}/"*; do
|
||||
[ -f "${hook}" -a -x "${hook}" ] || continue
|
||||
"${hook}" "${@}"
|
||||
[ -f "${hook}" -a -x "${hook}" ] || continue
|
||||
"${hook}" "${@}"
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -9,16 +9,14 @@
|
|||
TOKEN="4938561407:AAGcMIK1zBFW40AT5436vPvEUsFP6BmxhI"
|
||||
RUPOR="-10013071148102"
|
||||
SDATE=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
ALARM=`echo -e "\xE2\x98\x8E K-Telecom"`
|
||||
ALARM=$(echo -e "\xE2\x98\x8E K-Telecom")
|
||||
STAMP=$(date -u +%s)
|
||||
NOMER=$(echo $1 | tr -d '+')
|
||||
|
||||
|
||||
send() {
|
||||
#
|
||||
if [ -z "${NOMER}" ] ; then
|
||||
NOMER="anonymouse"
|
||||
fi
|
||||
[ -z "${NOMER}" ] && NOMER="anonymouse"
|
||||
#
|
||||
curl -k -o - --connect-timeout 30 --max-time 30 -X POST \
|
||||
https://api.telegram.org/bot${TOKEN}/sendMessage -d chat_id="${RUPOR}" -d disable_notification="true" -d text="${ALARM} ${NOMER} | ${SDATE}" >/dev/null 2>&1
|
||||
|
@ -28,4 +26,3 @@ send() {
|
|||
}
|
||||
|
||||
send
|
||||
|
||||
|
|
Loading…
Reference in New Issue