Since the "?" character is a filename expansion metacharacter (match any single character), it would probably be a good idea to escape it. If there's no filename expansion match, the unaltered string is passed to the program by the shell, so it is likely to work, even if not as safe as it could be.
Also, why not use the generic IP address that means "the computer I'm running on": 127.0.0.1 or localhost? So something like this safer and more generic:
wget -q -O - 'http://localhost/web/powerstate?newstate=3'
My main problem with it is that I can't see how it could ever work at UI startup, because the OpenWebif server only runs when enigma2 is running, and at the time that, as its name suggests, enigma2_pre_start.sh runs, enigma2 isn't yet running.
E.g:
Code: Select all
root@beyonwizu4:/media/hdd/logs# init 4 # shut down enigma2
root@beyonwizu4:/media/hdd/logs# wget -q -O - 'http://localhost/web/powerstate?newstate=3'
wget: can't connect to remote host (127.0.0.1): Connection refused
root@beyonwizu4:/media/hdd/logs#
Also, stylistically, and for readability, you might want something like:
Code: Select all
#!/bin/sh
exec >> /tmp/pre_start.txt 2>&1
## restart UI if non-Terrestrial
awk '/NIM Socket 2:/ {USBtuner = 1}
USBtuner && /Mode [0-9]: DVB-/ {
if($0 !~ /DVB-T/) {
print "*** non-Terrestrial USB tuner type, restarting UI"
exit 99
}
}' /proc/bus/nim_sockets
RC=$?
echo -e "awk RC: $RC"
if [ $RC -eq 99 -a -f /home/root/Allow_UI_Restart ] ; then
echo "*** about to restart"
wget -q -O - 'http://localhost/web/powerstate?newstate=3'
fi
Both in the shell script and in the awk script,
in most cases will do the same thing as:
De gustibus non est disputandum, of course