Remove busybox package dependencies, make Shellcheck happy

This commit is contained in:
df 2020-11-05 16:12:42 +00:00
parent 536b1977b1
commit 7da9ca930a
1 changed files with 29 additions and 13 deletions

View File

@ -3,19 +3,19 @@
#exec >>/tmp/reboot.log 2>&1
if [ "$1" = "-f" -a "$0" != "/tmp/fastreboot" ]; then
cp $0 /tmp/fastreboot
cp "$0" /tmp/fastreboot
chmod 755 /tmp/fastreboot
exec /tmp/fastreboot -f
exit 0
fi
model="`cat /etc/model`"
model=$(cat /etc/model)
feedback()
{
[ -x /mod/bin/hwctl ] && /mod/bin/hwctl 13 0 >> /dev/null 2>&1
[ "$model" = HDR ] && display "$1" || display "\$$2"
if [ "$model" = HDR ]; then display "$1"; else display "\$$2"; fi
}
readwakeup()
@ -23,7 +23,7 @@ readwakeup()
# Read the wakeup timer from the front panel
tries=10
while [ $tries -gt 0 ]; do
wakeup="`/mod/bin/hwctl d`"
wakeup=$(/mod/bin/hwctl d)
[ -n "$wakeup" ] && break
tries=$((tries - 1))
sleep 1
@ -37,7 +37,7 @@ setwakeup()
tries=10
while [ $tries -gt 0 ]; do
echo "Setting wakeup timer..."
/mod/bin/hwctl 5 1 ^`date +%s` >/dev/null
/mod/bin/hwctl 5 1 "^$(date +%s)" >/dev/null
tries=$((tries - 1))
if readwakeup | grep "00 00 00 00"; then
sleep 1
@ -50,7 +50,7 @@ setwakeup()
lbr=0
if [ -f /tmp/.lbr ]; then
lbr="`cat /tmp/.lbr`"
lbr=$(cat /tmp/.lbr)
#echo "LBR: $lbr"
else
# No last-boot-reason file, fall-back to reading timer directly.
@ -87,12 +87,28 @@ fi
feedback "Fast Reboot" "FRBT"
# Stop mod services
for f in `ls -1r /mod/etc/init.d/S??*`; do
[ -f "$f" -a -x "$f" ] || continue
# Don't stop the SSH server
echo $f | grep -q dropbear && continue
$f stop
done
ls -1r /mod/etc/init.d/S??* |
while read -r f; do
[ -f "$f" ] || continue
case $f in
*.sh)
# actually no such scripts
continue
(
trap - INT QUIT TSTP
set -- stop
# might not use $1 ?
. "$f"
)
;;
*)
# Don't stop the SSH server
echo "$f" | grep -q dropbear && continue
[ -x "$f" ] && "$f" stop
;;
esac
done
# Stop Humax App
/etc/init.d/S90settop shut
@ -116,7 +132,7 @@ mount | grep '^/dev/sd' |
# Stop device
for f in /sys/block/sd?; do
echo 1 >> $f/device/delete
echo 1 >> "$f/device/delete"
done
feedback "START SYSTEM" "boot"