format scripts with tabs, replace backticks, refactor (#770)

pull/771/head
Paul Philippov 2023-05-07 22:06:10 -04:00 committed by GitHub
parent ca3fffe5cd
commit a6b9d985f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 167 additions and 239 deletions

View File

@ -13,8 +13,7 @@ SYSLOGD_ARGS="-C64 -t"
start() { start() {
printf 'Starting %s: ' "$DAEMON" printf 'Starting %s: ' "$DAEMON"
# shellcheck disable=SC2086 # we need the word splitting # shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" \ start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/sbin/$DAEMON" -- -n $SYSLOGD_ARGS
-- -n $SYSLOGD_ARGS
status=$? status=$?
if [ "$status" -eq 0 ]; then if [ "$status" -eq 0 ]; then
echo "OK" echo "OK"
@ -45,10 +44,10 @@ restart() {
case "$1" in case "$1" in
start|stop|restart) start|stop|restart)
"$1";; "$1" ;;
reload) reload)
# Restart, since there is no true "reload" feature. # Restart, since there is no true "reload" feature.
restart;; restart ;;
*) *)
echo "Usage: $0 {start|stop|restart|reload}" echo "Usage: $0 {start|stop|restart|reload}"
exit 1 exit 1

View File

@ -1,20 +1,20 @@
#!/bin/sh #!/bin/sh
case "$1" in case "$1" in
start) start)
printf "Loading modules:" printf "Loading modules:"
# load modules for detected devices # load modules for detected devices
# find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq # find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
# load modules from /etc/modules # load modules from /etc/modules
[ -r /etc/modules ] || exit 0 [ -r /etc/modules ] || exit 0
while read module args; do while read module args; do
case "$module" in case "$module" in
""|"#"*) continue ;; ""|"#"*) continue ;;
esac esac
# attempt to load modules # attempt to load modules
modprobe ${module} ${args} >/dev/null modprobe ${module} ${args} >/dev/null
done < /etc/modules done < /etc/modules
;; ;;
esac esac

View File

@ -31,18 +31,11 @@ stop()
} }
case "$1" in case "$1" in
start) start|stop)
start "$1" ;;
;;
stop)
stop
;;
restart|reload) restart|reload)
stop stop; start ;;
start
;;
*) *)
echo "Usage: $0 {start|stop|restart|reload}" >&2 echo "Usage: $0 {start|stop|restart|reload}" >&2
exit 1 exit 1
;;
esac esac

View File

@ -4,18 +4,18 @@
# #
case "$1" in case "$1" in
start) start)
echo "Starting mdev..." echo "Starting mdev..."
# echo /sbin/mdev >/proc/sys/kernel/hotplug echo /sbin/mdev >/proc/sys/kernel/hotplug
/sbin/mdev -s /sbin/mdev -s
;; ;;
stop) stop)
;; ;;
restart|reload) restart|reload)
;; ;;
*) *)
echo "Usage: $0 {start|stop|restart}" echo "Usage: $0 {start|stop|restart}"
exit 1 exit 1
esac esac
exit $? exit $?

View File

@ -13,8 +13,7 @@ NTPD_ARGS="-n"
start() { start() {
printf 'Starting %s: ' "$DAEMON" printf 'Starting %s: ' "$DAEMON"
# shellcheck disable=SC2086 # we need the word splitting # shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $NTPD_ARGS
-- $NTPD_ARGS
status=$? status=$?
if [ "$status" -eq 0 ]; then if [ "$status" -eq 0 ]; then
echo "OK" echo "OK"
@ -45,10 +44,9 @@ restart() {
case "$1" in case "$1" in
start|stop|restart) start|stop|restart)
"$1";; "$1" ;;
reload) reload)
# Restart, since there is no true "reload" feature. restart ;;
restart;;
*) *)
echo "Usage: $0 {start|stop|restart|reload}" echo "Usage: $0 {start|stop|restart|reload}"
exit 1 exit 1

View File

@ -14,9 +14,7 @@ start() {
# create the directory pointed to by the symlink. # create the directory pointed to by the symlink.
# - the filesystem is RW (i.e. we can rm the symlink), # - the filesystem is RW (i.e. we can rm the symlink),
# replace the symlink with an actual directory # replace the symlink with an actual directory
if [ -L /etc/dropbear \ if [ -L /etc/dropbear -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]; then
-a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]
then
if rm -f /etc/dropbear >/dev/null 2>&1; then if rm -f /etc/dropbear >/dev/null 2>&1; then
mkdir -p /etc/dropbear mkdir -p /etc/dropbear
else else
@ -29,8 +27,7 @@ start() {
printf "Starting dropbear sshd: " printf "Starting dropbear sshd: "
umask 077 umask 077
start-stop-daemon -S -q -p /var/run/dropbear.pid \ start-stop-daemon -S -q -p /var/run/dropbear.pid --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
--exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
[ $? = 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
stop() { stop() {
@ -44,18 +41,13 @@ restart() {
} }
case "$1" in case "$1" in
start) start|stop|restart)
start "$1" ;;
;; reload)
stop) restart ;;
stop *)
;; echo "Usage: $0 {start|stop|restart}"
restart|reload) exit 1
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac esac
exit $? exit $?

View File

@ -14,8 +14,7 @@ start() {
printf 'Starting %s: ' "$DAEMON" printf 'Starting %s: ' "$DAEMON"
[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " [ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, "
# shellcheck disable=SC2086 # we need the word splitting # shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $SNMPD_ARGS
-- $SNMPD_ARGS
status=$? status=$?
if [ "$status" -eq 0 ]; then if [ "$status" -eq 0 ]; then
echo "OK" echo "OK"
@ -47,10 +46,9 @@ restart() {
case "$1" in case "$1" in
start|stop|restart) start|stop|restart)
"$1";; "$1" ;;
reload) reload)
# Restart, since there is no true "reload" feature. restart ;;
restart;;
*) *)
echo "Usage: $0 {start|stop|restart|reload}" echo "Usage: $0 {start|stop|restart|reload}"
exit 1 exit 1

View File

@ -7,35 +7,27 @@ TELNETD_ARGS="-F -p 4321 -l /bin/sh"
[ -r /etc/default/telnet ] && . /etc/default/telnet [ -r /etc/default/telnet ] && . /etc/default/telnet
start() { start() {
printf "Starting telnetd: " printf "Starting telnetd: "
[ -f /usr/sbin/telnetd ] || echo -en "DISABLED, " [ -f /usr/sbin/telnetd ] || echo -en "DISABLED, "
start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid \ start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid -x /usr/sbin/telnetd -- $TELNETD_ARGS
-x /usr/sbin/telnetd -- $TELNETD_ARGS [ $? = 0 ] && echo "OK" || echo "FAIL"
[ $? = 0 ] && echo "OK" || echo "FAIL"
} }
stop() { stop() {
printf "Stopping telnetd: " printf "Stopping telnetd: "
[ -f /usr/sbin/telnetd ] || echo -en "DISABLED, " [ -f /usr/sbin/telnetd ] || echo -en "DISABLED, "
start-stop-daemon -K -q -p /var/run/telnetd.pid \ start-stop-daemon -K -q -p /var/run/telnetd.pid -x /usr/sbin/telnetd
-x /usr/sbin/telnetd
[ $? = 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
case "$1" in case "$1" in
start) start|stop)
start "$1" ;;
;; restart|reload)
stop) stop; start ;;
stop *)
;; echo "Usage: $0 {start|stop|restart}"
restart|reload) exit 1
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac esac
exit $? exit $?

View File

@ -14,8 +14,7 @@ start() {
printf 'Starting %s: ' "$DAEMON" printf 'Starting %s: ' "$DAEMON"
[ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, " [ -f /usr/sbin/$DAEMON ] || echo -en "DISABLED, "
# shellcheck disable=SC2086 # we need the word splitting # shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- $CROND_ARGS
-- $CROND_ARGS
status=$? status=$?
if [ "$status" -eq 0 ]; then if [ "$status" -eq 0 ]; then
echo "OK" echo "OK"
@ -47,10 +46,9 @@ restart() {
case "$1" in case "$1" in
start|stop|restart) start|stop|restart)
"$1";; "$1" ;;
reload) reload)
# Restart, since there is no true "reload" feature. restart ;;
restart;;
*) *)
echo "Usage: $0 {start|stop|restart|reload}" echo "Usage: $0 {start|stop|restart|reload}"
exit 1 exit 1

View File

@ -1,18 +1,18 @@
#!/bin/sh #!/bin/sh
# load vendor specific drivers # load vendor specific drivers
# #
vendor=$(ipcinfo -v) vendor=$(ipcinfo -v)
status=$(check_mac) status=$(check_mac)
log_vendor() { log_vendor() {
logger -s -p daemon.info -t ${vendor} "$1" logger -s -p daemon.info -t ${vendor} "$1"
} }
case "$1" in case "$1" in
start) start)
[ -n "${status}" ] && log_vendor "${status}" [ -n "${status}" ] && log_vendor "${status}"
echo -e '\nLoading of kernel modules...' echo -e '\nLoading of kernel modules...'
load_${vendor} -i load_${vendor} -i
;; ;;
esac esac

View File

@ -1,34 +1,23 @@
#!/bin/sh #!/bin/sh
# You don't usually need to touch this file at all, the full configuration # Configuration of the bridge should be done in /etc/network/interfaces.d/bridgeX
# of the bridge can be done in a standard way on /etc/network/interfaces. # Read more at https://wiki.debian.org/BridgeNetworkConnections
# Have a look at /usr/share/doc/bridge-utils/README.Debian.gz if you want [ ! -x /usr/sbin/brctl ] && exit 0
# more info about the way on wich a bridge is set up on Debian.
if [ ! -x /usr/sbin/brctl ]
then
exit 0
fi
case "$IF_BRIDGE_PORTS" in case "$IF_BRIDGE_PORTS" in
"") "")
exit 0 exit 0 ;;
;; none)
none) INTERFACES="" ;;
INTERFACES="" all)
;; INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') ;;
all) *)
INTERFACES=`grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/'` INTERFACES="$IF_BRIDGE_PORTS" ;;
;;
*)
INTERFACES="$IF_BRIDGE_PORTS"
;;
esac esac
brctl delbr $IFACE brctl delbr $IFACE
for i in $INTERFACES for i in $INTERFACES; do
do
ip link set $i down ip link set $i down
done done

View File

@ -1,12 +1,6 @@
#!/bin/sh #!/bin/sh
if [ -z "$IF_VLAN_RAW_DEVICE" ] && [ -z "`echo $IFACE | grep '.\+\.[0-9]\+$'`" ] [ -z "$IF_VLAN_RAW_DEVICE" ] && [ -z "$(echo $IFACE | grep '.\+\.[0-9]\+$')" ] && exit 0
then [ ! -x /sbin/vconfig ] && exit 0
exit 0
fi
if [ ! -x /sbin/vconfig ]
then
exit 0
fi
vconfig rem $IFACE vconfig rem $IFACE

View File

@ -1,39 +1,26 @@
#!/bin/sh #!/bin/sh
# You don't usually need to touch this file at all, the full configuration # Configuration of the bridge should be done in /etc/network/interfaces.d/bridgeX
# of the bridge can be done in a standard way on /etc/network/interfaces. # Read more at https://wiki.debian.org/BridgeNetworkConnections
# Have a look at /usr/share/doc/bridge-utils/README.Debian.gz if you want [ ! -x /usr/sbin/brctl ] && exit 0
# more info about the way on wich a bridge is set up on Debian.
if [ ! -x /usr/sbin/brctl ]
then
exit 0
fi
case "$IF_BRIDGE_PORTS" in case "$IF_BRIDGE_PORTS" in
"") "")
exit 0 exit 0 ;;
;; none)
none) INTERFACES="" ;;
INTERFACES="" all)
;; INTERFACES=$(grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/') ;;
all) *)
INTERFACES=`grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/'` INTERFACES="$IF_BRIDGE_PORTS" ;;
;;
*)
INTERFACES="$IF_BRIDGE_PORTS"
;;
esac esac
brctl addbr $IFACE && brctl addbr $IFACE &&
for i in $INTERFACES for i in $INTERFACES; do
do [ -x /etc/network/if-pre-up.d/vlan ] && env IFACE=$i /etc/network/if-pre-up.d/vlan
if [ -x /etc/network/if-pre-up.d/vlan ]; then brctl addif $IFACE $i && ip link set dev $i up
env IFACE=$i /etc/network/if-pre-up.d/vlan
fi
brctl addif $IFACE $i && ip link set dev $i up
done done
brctl stp $IFACE off brctl stp $IFACE off

View File

@ -3,36 +3,31 @@
# Most of this stuff is to enable vlans # Most of this stuff is to enable vlans
case "$IFACE" in case "$IFACE" in
vlan0*) vlan0*)
vconfig set_name_type VLAN_PLUS_VID vconfig set_name_type VLAN_PLUS_VID
VLANID=`echo $IFACE|sed "s/vlan0*//"` VLANID=$(echo $IFACE|sed "s/vlan0*//")
;; ;;
vlan*) vlan*)
vconfig set_name_type VLAN_PLUS_VID_NO_PAD vconfig set_name_type VLAN_PLUS_VID_NO_PAD
VLANID=`echo $IFACE|sed "s/vlan*//"` VLANID=$(echo $IFACE|sed "s/vlan*//")
;; ;;
*.0*) *.0*)
vconfig set_name_type DEV_PLUS_VID vconfig set_name_type DEV_PLUS_VID
VLANID=`echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g"` VLANID=$(echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g")
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/"` IF_VLAN_RAW_DEVICE=$(echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/")
;; ;;
*.*) *.*)
vconfig set_name_type DEV_PLUS_VID_NO_PAD vconfig set_name_type DEV_PLUS_VID_NO_PAD
VLANID=`echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g"` VLANID=$(echo $IFACE|sed "s/.*\.0*\([0-9]\+\)$/\1/g")
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/"` IF_VLAN_RAW_DEVICE=$(echo $IFACE|sed "s/^\(.*\)\.[^.]*/\1/")
;;
*) exit 0
;; ;;
*)
exit 0
esac esac
if [ -n "$IF_VLAN_RAW_DEVICE" ] if [ -n "$IF_VLAN_RAW_DEVICE" ]; then
then [ ! -x /sbin/vconfig ] && exit 0
if [ ! -x /sbin/vconfig ] if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null; then
then
exit 0
fi
if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null
then
echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE" echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE"
exit 1 exit 1
fi fi
@ -43,7 +38,4 @@ fi
ip link set qlen 1000 dev $IFACE ip link set qlen 1000 dev $IFACE
# This is not vlan specific, and should actually go somewhere else. # This is not vlan specific, and should actually go somewhere else.
if [ -n "$IF_HW_MAC_ADDRESS" ] [ -n "$IF_HW_MAC_ADDRESS" ] && ip link set $IFACE address $IF_HW_MAC_ADDRESS
then
ip link set $IFACE address $IF_HW_MAC_ADDRESS
fi

View File

@ -1,4 +1,3 @@
iface eth0:1 inet static iface eth0:1 inet static
address $(fw_printenv -n ipaddr || echo 192.168.1.10) address $(fw_printenv -n ipaddr || echo 192.168.1.10)
netmask 255.255.255.0 netmask 255.255.255.0

View File

@ -12,7 +12,7 @@ if [ "$PS1" ]; then
echo_c 32 "$(printf "%56s" "${GITHUB_VERSION}")" echo_c 32 "$(printf "%56s" "${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\# '
else else
export PS1='\u@\h:\w\$ ' export PS1='\u@\h:\w\$ '

View File

@ -4,32 +4,32 @@ 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 else
ARC='' 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 -o $IPCTOOL https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool$ARC curl -s -L -o $IPCTOOL https://github.com/OpenIPC/ipctool/releases/download/latest/ipctool$ARC
chmod +x $IPCTOOL chmod +x $IPCTOOL
echo "The ipctool installed as remote GitHub plugin" echo "The ipctool installed as remote GitHub plugin"
fi fi
$IPCTOOL $@ $IPCTOOL $@
;; ;;
check_mac) check_mac)
if [ "$(fw_printenv -n ethaddr)" = "00:00:23:34:45:66" ]; then 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." 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 fi
;; ;;
*) *)
;; ;;
esac esac

View File

@ -9,41 +9,41 @@ mpp=$(awk '/Version:/ {print $3,$4"]"}' /proc/umap/sys) || true
soc=$(ipcinfo --chip-name) soc=$(ipcinfo --chip-name)
prepare() { prepare() {
case ${soc} in case ${soc} in
hi3516ev200 | hi3516ev300 | hi3516dv200 | hi3518ev300) hi3516ev200 | hi3516ev300 | hi3516dv200 | hi3518ev300)
echo -e "\n\e[1;31mA supported processor with ${mpp} was found...\e[0m\n" 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" 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_url="https://raw.githubusercontent.com/widgetii/pqtools/master/hi3516ev300/ittb_V1.0.1.2.tgz"
ittb_folder="ittb_V1.0.1.2" ittb_folder="ittb_V1.0.1.2"
;; ;;
gk7205v200 | gk7205v300) gk7205v200 | gk7205v300)
echo -e "\n\e[1;31mA supported processor with unknown MPP was found...\e[0m\n" 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" 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_url="https://raw.githubusercontent.com/widgetii/pqtools/master/gk7205v200/ittb_V1.0.2.0.tgz"
ittb_folder="ittb_V1.0.2.0" 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" echo -e "\n\e[1;31mSorry but the ${soc} is not supported at the moment...\e[0m\n"
exit 1 exit 1
;; ;;
esac esac
} }
download() if [[ -d /tmp/${ittb_folder} ]]; then 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;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" echo -e "\n\e[1;31mWe run the utilities for sensor calibration...\e[0m\n"
cd /tmp/${ittb_folder} cd /tmp/${ittb_folder}
./start.sh ./start.sh
else else
echo -e "\n\e[1;31mDownloading the latest tools, please wait...\e[0m\n" echo -e "\n\e[1;31mDownloading the latest tools, please wait...\e[0m\n"
curl -s ${ittb_url} | gzip -d - | tar xvf - -C /tmp 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" echo -e "\n\e[1;31mWe run the utilities for sensor calibration...\e[0m\n"
cd /tmp/${ittb_folder} cd /tmp/${ittb_folder}
./start.sh ./start.sh
fi fi
prepare && download prepare && download

View File

@ -40,7 +40,7 @@ do_update_kernel() {
echo_c 33 "\nKernel" echo_c 33 "\nKernel"
echo "Update kernel from $x" echo "Update kernel from $x"
[ ! -f "$x" ] && die "File $x not found" [ ! -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) local ksoc=$(od -j 32 -N 32 -S 1 -A n "$x" | cut -d- -f3)
# FIXME: Ingenic kernels do not include proper SoC identifiers. # FIXME: Ingenic kernels do not include proper SoC identifiers.
case "$soc" in case "$soc" in
@ -55,7 +55,7 @@ do_update_kernel() {
} }
do_update_rootfs() { do_update_rootfs() {
local x=$1 local x=$1
[ -z "$x" ] && x="/tmp/rootfs.squashfs.$soc" [ -z "$x" ] && x="/tmp/rootfs.squashfs.$soc"
echo_c 33 "\nRootFS" echo_c 33 "\nRootFS"
echo "Update rootfs from $x" echo "Update rootfs from $x"

View File

@ -108,8 +108,8 @@ esac
HOOK_DIR="$0.d" HOOK_DIR="$0.d"
for hook in "${HOOK_DIR}/"*; do for hook in "${HOOK_DIR}/"*; do
[ -f "${hook}" -a -x "${hook}" ] || continue [ -f "${hook}" -a -x "${hook}" ] || continue
"${hook}" "${@}" "${hook}" "${@}"
done done
exit 0 exit 0

View File

@ -9,16 +9,14 @@
TOKEN="4938561407:AAGcMIK1zBFW40AT5436vPvEUsFP6BmxhI" TOKEN="4938561407:AAGcMIK1zBFW40AT5436vPvEUsFP6BmxhI"
RUPOR="-10013071148102" RUPOR="-10013071148102"
SDATE=$(date "+%Y-%m-%d %H:%M:%S") 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) STAMP=$(date -u +%s)
NOMER=$(echo $1 | tr -d '+') NOMER=$(echo $1 | tr -d '+')
send() { send() {
# #
if [ -z "${NOMER}" ] ; then [ -z "${NOMER}" ] && NOMER="anonymouse"
NOMER="anonymouse"
fi
# #
curl -k -o - --connect-timeout 30 --max-time 30 -X POST \ 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 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 send