Skip to content

Commit abea741

Browse files
committed
minor fixes to sh scripts to be POSIX compliant
1 parent 2ebc4a4 commit abea741

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

decompressed/gui_file/etc/modgui_scripts/03_various.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ checkver_cron() {
121121
rm /etc/crontabs/root #THIS CHECK A VALID ROOT CRON... we remove it as it's useless if the owner is not root.
122122
fi
123123
fi
124-
if [ ! -f /etc/crontabs/root ] || [ ! "$(< /etc/crontabs/root grep checkver)" ]; then
124+
if [ ! -f /etc/crontabs/root ] || [ ! grep -q "checkver" /etc/crontabs/root ]; then
125125
rand_h=$(awk -v min=1 -v max=6 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
126126
rand_m=$(awk -v min=1 -v max=59 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
127127
echo "$rand_m $rand_h * * * /usr/share/transformer/scripts/checkver >/dev/null 2>&1" >> /etc/crontabs/root
@@ -131,7 +131,7 @@ checkver_cron() {
131131
}
132132

133133
cron_christmas() {
134-
if [ ! -f /etc/crontabs/root ] || [ "$(< /etc/crontabs/root grep -c "christmas_tree")" -lt 1 ]; then
134+
if [ ! -f /etc/crontabs/root ] || [ ! grep -q "christmas_tree" /etc/crontabs/root ]; then
135135
echo "*/30 * 24-26 12 * /etc/christmas_tree.sh &" >> /etc/crontabs/root
136136
fi
137137
}

decompressed/gui_file/etc/modgui_scripts/04_config.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ mobiled_lib_add() {
346346
/etc/init.d/mobiled restart
347347
else
348348
#make sure we haven't replaced it some old GUI install, restore from rom if needed
349-
if [[ -f /rom/etc/init.d/mobiled && -n "$(cmp /rom/etc/init.d/mobiled /etc/init.d/mobiled)" ]]; then
349+
if [ -f /rom/etc/init.d/mobiled ] && [ -n "$(cmp /rom/etc/init.d/mobiled /etc/init.d/mobiled)" ]; then
350350
logecho "Restoring and restarting /etc/init.d/mobiled ..."
351351
cp /rom/etc/init.d/mobiled /etc/init.d/mobiled
352352
/etc/init.d/mobiled restart

decompressed/gui_file/etc/modgui_scripts/05_app.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ trafficmon_support() {
3636
rm -rf /root/trafficmon
3737
fi
3838

39-
if [ -n "$(< /etc/crontabs/root grep trafficmon)" ]; then
39+
if grep -q trafficmon /etc/crontabs/root; then
4040
killall trafficmon 2>/dev/null
4141
killall trafficdata 2>/dev/null
4242
sed -i '/trafficmon/d' /etc/crontabs/root

decompressed/gui_file/etc/modgui_scripts/99_postreq.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ start_stop_nginx() {
2929
done
3030

3131
nginx_count=0
32-
while [ "$(curl 127.0.0.1 --max-time 20 -I -s | head -n 1 | cut -d$' ' -f2)" != "200" ] && [ $nginx_count -lt 5 ]; do
32+
while [ "$(curl 127.0.0.1 --max-time 20 -I -s | head -n 1 | cut -d' ' -f2)" != "200" ] && [ $nginx_count -lt 5 ]; do
3333
if [ $nginx_count -gt 3 ]; then
3434
if [ -f /var/run/nginx.pid ]; then
3535
kill -KILL "$(cat /var/run/nginx.pid)"

0 commit comments

Comments
 (0)