Skip to content

Commit d0fe8fa

Browse files
committed
remove also mobiled mappers when lib not found
more shell script optimizations
1 parent 04ecc69 commit d0fe8fa

File tree

6 files changed

+80
-74
lines changed

6 files changed

+80
-74
lines changed

decompressed/base/etc/init.d/rootdevice

+7-7
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ EOF
6161
rootdevice_log_file=/tmp/rootdevice_log
6262

6363
kecho() {
64-
echo " "$@ >/dev/console
65-
echo " "$@ >>$rootdevice_log_file
64+
echo " " "$@" >/dev/console
65+
echo " " "$@" >>$rootdevice_log_file
6666
}
6767

6868
logecho() {
6969
if [ "$debug" -eq 1 ]; then
70-
logger -t "Root Script" $@
71-
echo "Root Script" $@
70+
logger -t "Root Script" "$@"
71+
echo "Root Script" "$@"
7272
fi
73-
echo "Root Script" $@ >>$rootdevice_log_file
73+
echo "Root Script" "$@" >>$rootdevice_log_file
7474
}
7575

7676
logecho_always() {
77-
logger -t "Root Script" $@
78-
echo "Root Script" $@ >>rootdevice_log_file
77+
logger -t "Root Script" "$@"
78+
echo "Root Script" "$@" >>rootdevice_log_file
7979
}
8080

8181
create_modgui_log() {

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,10 @@ mobiled_lib_add() {
305305
fi
306306

307307
if [ ! -d /usr/lib/lua/mobiled ]; then
308-
logecho "Removing mobiled card as it is not detected on this device..."
308+
logecho "Removing mobiled components as it is not detected on this device..."
309309
rm -rf /www/cards/010_lte.lp
310+
rm -rf /usr/share/transformer/mappings/rpc/mobiled.*
311+
rm -rf /usr/share/transformer/mappings/rpc/ltedoctor.*
310312
fi
311313

312314
marketing_version="$(uci get -q version.@version[0].marketing_version)"

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ start_stop_nginx() {
3939
kill -KILL "$pid"
4040
done
4141
fi
42-
logecho "Restarting nginx..." ConsoleOnly
42+
logecho "Restarting nginx..."
4343
/etc/init.d/nginx restart 2>/dev/null
4444
sleep 5
4545
nginx_count=$((nginx_count+1))
@@ -63,9 +63,9 @@ if [ -f /root/.install_gui ]; then
6363
logecho "Removing .install_gui flag"
6464
rm /root/.install_gui
6565
fi
66-
logecho "Process done."
66+
logecho "Process complete, restarting services."
6767

68-
logecho "Restarting transformer" ConsoleOnly
68+
logecho "Restarting transformer..."
6969
/etc/init.d/transformer restart
7070
#Call a random value to check start of transformer
7171
lua -e "require('datamodel').get('uci.env.var.oui')" > /dev/null
@@ -78,5 +78,5 @@ lua -e "require('datamodel').get('uci.env.var.oui')" > /dev/null
7878
# /etc/init.d/transformer restart
7979
#fi
8080

81-
logecho "Stopping nginx" ConsoleOnly
81+
logecho "Stopping nginx"
8282
start_stop_nginx

decompressed/gui_file/usr/share/transformer/scripts/appInstallRemoveUtility.sh

+62-61
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,43 @@ cpu_type="$(uname -m)"
88
# 3rd arg : raw or normal. Raw is used to download specific file from specific dir
99
# 4th arg : addtional command to append to setup.sh (usefull if setup.sh contains also uninstall command)
1010
install_from_github() {
11-
mkdir /tmp/$2
11+
mkdir "/tmp/$2"
1212

13-
if [ $3 == "specificapp" ]; then
14-
if [ ! -f /tmp/$2.tar.bz2 ]; then
13+
if [ "$3" = "specificapp" ]; then
14+
if [ ! -f "/tmp/$2.tar.bz2" ]; then
1515
if ! ping -q -c 1 -W 1 8.8.8.8 >/dev/null 2>&1; then
1616
echo "No internet connection detected, download manually!"
1717
exit 0
1818
fi
19-
curl -sLk https://raw.githubusercontent.com/$1/$2.tar.bz2 --output /tmp/$2.tar.bz2
19+
curl -sLk "https://raw.githubusercontent.com/$1/$2.tar.bz2" --output "/tmp/$2.tar.bz2"
2020
fi
21-
if [ ! -f /tmp/$2.tar.bz2 ]; then
21+
if [ ! -f "/tmp/$2.tar.bz2" ]; then
2222
echo "Error installing App: Cannot find/download $2.tar.bz2"
2323
return 1
2424
fi
25-
bzcat /tmp/$2.tar.bz2 | tar -C /tmp/$2 -xf -
26-
rm /tmp/$2.tar.bz2
27-
cd /tmp/$2
25+
bzcat "/tmp/$2.tar.bz2" | tar -C "/tmp/$2" -xf -
26+
rm "/tmp/$2.tar.bz2"
27+
cd "/tmp/$2" || return 1
2828
else
29-
if [ ! -f /tmp/$2.tar.gz ]; then
29+
if [ ! -f "/tmp/$2.tar.gz" ]; then
3030
if ! ping -q -c 1 -W 1 8.8.8.8 >/dev/null 2>&1; then
3131
echo "No internet connection detected, download manually!"
3232
exit 0
3333
fi
34-
curl -sLk https://github.com/$1/tarball/$2 --output /tmp/$2.tar.gz
34+
curl -sLk "https://github.com/$1/tarball/$2" --output "/tmp/$2.tar.gz"
3535
fi
36-
if [ ! -f /tmp/$2.tar.gz ]; then
36+
if [ ! -f "/tmp/$2.tar.gz" ]; then
3737
echo "Error installing App: Cannot find/download $2.tar.gz"
3838
return 1
3939
fi
40-
tar -xzf /tmp/$2.tar.gz -C /tmp/$2
41-
rm /tmp/$2.tar.gz
42-
cd /tmp/$2/*
40+
tar -xzf "/tmp/$2.tar.gz" -C "/tmp/$2"
41+
rm "/tmp/$2.tar.gz"
42+
cd "/tmp/$2/*"
4343
fi
4444

4545
chmod +x ./setup.sh
4646
./setup.sh "$4"
47-
rm -rf /tmp/$2
47+
rm -rf "/tmp/$2"
4848
}
4949

5050
############TRANSFORMER UTILITY##################
@@ -74,12 +74,12 @@ app_transmission() {
7474
install() {
7575
case $marketing_version in
7676
"16.1"* | "16.2"*)
77-
[ "$cpu_type" == "armv7l" ] && install_from_github FrancYescO/sharing_tg789 transmission-xtream
78-
[ "$cpu_type" == "mips" ] && install_from_github FrancYescO/sharing_tg789 transmission
77+
[ "$cpu_type" = "armv7l" ] && install_from_github FrancYescO/sharing_tg789 transmission-xtream
78+
[ "$cpu_type" = "mips" ] && install_from_github FrancYescO/sharing_tg789 transmission
7979
;;
8080
"16."* | "17."* | "18."*)
81-
[ "$cpu_type" == "armv7l" ] && install_arm
82-
[ "$cpu_type" == "mips" ] && install_from_github FrancYescO/sharing_tg789 transmission
81+
[ "$cpu_type" = "armv7l" ] && install_arm
82+
[ "$cpu_type" = "mips" ] && install_from_github FrancYescO/sharing_tg789 transmission
8383
;;
8484
*)
8585
echo "Unknown app install script for $marketing_version $cpu_type"
@@ -106,7 +106,7 @@ app_transmission() {
106106

107107
case $1 in
108108
install)
109-
install $2
109+
install "$2"
110110
;;
111111
remove)
112112
remove
@@ -152,7 +152,7 @@ app_telstra() {
152152

153153
case $1 in
154154
install)
155-
install $2
155+
install "$2"
156156
;;
157157
remove)
158158
remove
@@ -181,7 +181,7 @@ app_luci() {
181181
mv /usr/lib/lua/uci.so_bak /usr/lib/lua/uci.so
182182
sed -i 's/require "uci"/require "uci_luci"/g' /usr/lib/lua/luci/model/uci.lua #modify luci to load his original lib with different name
183183

184-
if [ ! $(uci get uhttpd.main.listen_http | grep 9080) ]; then
184+
if [ ! "$(uci get uhttpd.main.listen_http | grep 9080)" ]; then
185185
uci del_list uhttpd.main.listen_http='0.0.0.0:80'
186186
uci add_list uhttpd.main.listen_http='0.0.0.0:9080'
187187
uci del_list uhttpd.main.listen_http='[::]:80'
@@ -205,20 +205,20 @@ app_luci() {
205205

206206
case $marketing_version in
207207
"16.1"* | "16.2"*)
208-
[ "$cpu_type" == "armv7l" ] && echo "Unknown app install script for $marketing_version $cpu_type"
209-
[ "$cpu_type" == "mips" ] && luci_install_mips
208+
[ "$cpu_type" = "armv7l" ] && echo "Unknown app install script for $marketing_version $cpu_type"
209+
[ "$cpu_type" = "mips" ] && luci_install_mips
210210
;;
211211
"16."* | "17."*)
212-
[ "$cpu_type" == "armv7l" ] && {
212+
[ "$cpu_type" = "armv7l" ] && {
213213
luci_install_arm
214214
opkg install --force-reinstall --force-overwrite libuci-lua
215215
sed -i 's/require "uci_luci"/require "uci"/g' /usr/lib/lua/luci/model/uci.lua
216216
}
217-
[ "$cpu_type" == "mips" ] && luci_install_mips
217+
[ "$cpu_type" = "mips" ] && luci_install_mips
218218
;;
219219
"18."*)
220-
[ "$cpu_type" == "armv7l" ] && luci_install_arm
221-
[ "$cpu_type" == "mips" ] && luci_install_mips
220+
[ "$cpu_type" = "armv7l" ] && luci_install_arm
221+
[ "$cpu_type" = "mips" ] && luci_install_mips
222222
;;
223223
*)
224224
echo "Unknown app install script for $marketing_version $cpu_type"
@@ -243,15 +243,15 @@ app_luci() {
243243
/tmp/uninstall.sh
244244
}
245245

246-
[ "$cpu_type" == "armv7l" ] && luci_remove_arm
247-
[ "$cpu_type" == "mips" ] && luci_remove_mips
246+
[ "$cpu_type" = "armv7l" ] && luci_remove_arm
247+
[ "$cpu_type" = "mips" ] && luci_remove_mips
248248
uci set modgui.app.luci_webui="0"
249249
uci commit modgui
250250
}
251251

252252
case $1 in
253253
install)
254-
install $2
254+
install "$2"
255255
;;
256256
remove)
257257
remove
@@ -265,8 +265,8 @@ app_luci() {
265265

266266
app_amule() {
267267
install() {
268-
[ "$cpu_type" == "armv7l" ] && echo "Unknown app install script for $marketing_version $cpu_type"
269-
[ "$cpu_type" == "mips" ] && install_from_github FrancYescO/sharing_tg789 amule
268+
[ "$cpu_type" = "armv7l" ] && echo "Unknown app install script for $marketing_version $cpu_type"
269+
[ "$cpu_type" = "mips" ] && install_from_github FrancYescO/sharing_tg789 amule
270270
uci set modgui.app.amule_webui="1"
271271
uci commit modgui
272272
}
@@ -285,7 +285,7 @@ app_amule() {
285285

286286
case $1 in
287287
install)
288-
install $2
288+
install "$2"
289289
;;
290290
start)
291291
start
@@ -294,7 +294,7 @@ app_amule() {
294294
stop
295295
;;
296296
*)
297-
echo "Unsupported action"
297+
remove
298298
return 1
299299
;;
300300
esac
@@ -315,15 +315,16 @@ app_aria2() {
315315
mkdir $ARIA2_DIR
316316
touch $ARIA2_DIR/aria2.conf
317317
touch $ARIA2_DIR/aria2.session
318-
319-
echo 'enable-rpc=true' >>$ARIA2_DIR/aria2.conf
320-
echo 'rpc-allow-origin-all=true' >>$ARIA2_DIR/aria2.conf
321-
echo 'rpc-listen-all=true' >>$ARIA2_DIR/aria2.conf
322-
echo 'rpc-listen-port=6800' >>$ARIA2_DIR/aria2.conf
323-
echo 'input-file=/etc/aria2/aria2.session' >>$ARIA2_DIR/aria2.conf
324-
echo 'save-session=/etc/aria2/aria2.session' >>$ARIA2_DIR/aria2.conf
325-
echo 'save-session-interval=300' >>$ARIA2_DIR/aria2.conf
326-
echo 'dir=/mnt/usb/USB-A1' >>$ARIA2_DIR/aria2.conf
318+
{
319+
echo 'enable-rpc=true'
320+
echo 'rpc-allow-origin-all=true'
321+
echo 'rpc-listen-all=true'
322+
echo 'rpc-listen-port=6800'
323+
echo 'input-file=/etc/aria2/aria2.session'
324+
echo 'save-session=/etc/aria2/aria2.session'
325+
echo 'save-session-interval=300'
326+
echo 'dir=/mnt/usb/USB-A1'
327+
} >>$ARIA2_DIR/aria2.conf
327328

328329
# add aria2 in /etc/rc.local to start the daemon after a reboot
329330
sed -i '/exit 0/i \
@@ -335,12 +336,12 @@ app_aria2() {
335336

336337
case $marketing_version in
337338
"16.1"* | "16.2"*)
338-
[ "$cpu_type" == "armv7l" ] && install_from_github FrancYescO/sharing_tg789 aria2-xtream
339-
[ "$cpu_type" == "mips" ] && install_from_github FrancYescO/sharing_tg789 aria2
339+
[ "$cpu_type" = "armv7l" ] && install_from_github FrancYescO/sharing_tg789 aria2-xtream
340+
[ "$cpu_type" = "mips" ] && install_from_github FrancYescO/sharing_tg789 aria2
340341
;;
341342
"16."* | "17."* | "18."*)
342-
[ "$cpu_type" == "armv7l" ] && install_arm
343-
[ "$cpu_type" == "mips" ] && install_from_github FrancYescO/sharing_tg789 aria2
343+
[ "$cpu_type" = "armv7l" ] && install_arm
344+
[ "$cpu_type" = "mips" ] && install_from_github FrancYescO/sharing_tg789 aria2
344345
;;
345346
*)
346347
echo "Unknown app install script for $marketing_version $cpu_type"
@@ -367,7 +368,7 @@ app_aria2() {
367368

368369
case $1 in
369370
install)
370-
install $2
371+
install "$2"
371372
;;
372373
remove)
373374
remove
@@ -387,7 +388,7 @@ app_aria2() {
387388

388389
app_blacklist() {
389390
install() {
390-
install_from_github Ansuel/blacklist master normal $2
391+
install_from_github Ansuel/blacklist master normal "$2"
391392
uci set modgui.app.blacklist_app="1"
392393
uci commit modgui
393394
}
@@ -402,7 +403,7 @@ app_blacklist() {
402403

403404
case $1 in
404405
install)
405-
install $2
406+
install "$2"
406407
;;
407408
remove)
408409
remove
@@ -447,7 +448,7 @@ app_xupnp() {
447448
install_specific_files() {
448449

449450
install() {
450-
install_from_github Ansuel/gui-dev-build-auto/master/modular upgrade-pack-specific$1 specificapp
451+
install_from_github Ansuel/gui-dev-build-auto/master/modular "upgrade-pack-specific$1" specificapp
451452
uci set modgui.app.specific_app=1
452453
uci commit
453454
}
@@ -458,7 +459,7 @@ install_specific_files() {
458459

459460
case $1 in
460461
install)
461-
install $2
462+
install "$2"
462463
;;
463464
remove)
464465
remove
@@ -473,28 +474,28 @@ install_specific_files() {
473474
call_app_type() {
474475
case "$2" in
475476
transmission)
476-
app_transmission $1
477+
app_transmission "$1"
477478
;;
478479
telstra)
479-
app_telstra $1
480+
app_telstra "$1"
480481
;;
481482
luci)
482-
app_luci $1
483+
app_luci "$1"
483484
;;
484485
amule)
485-
app_amule $1
486+
app_amule "$1"
486487
;;
487488
aria2)
488-
app_aria2 $1
489+
app_aria2 "$1"
489490
;;
490491
xupnp)
491-
app_xupnp $1
492+
app_xupnp "$1"
492493
;;
493494
blacklist)
494-
app_blacklist $1 $3
495+
app_blacklist "$1" "$3"
495496
;;
496497
specificapp)
497-
install_specific_files $1 $3
498+
install_specific_files "$1" "$3"
498499
;;
499500
*)
500501
echo "Provide a valid APP_NAME" 1>&2

decompressed/gui_file/usr/share/transformer/scripts/generate-debug-file.sh

+3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ log "Scanning /etc/config directory..."
9191
ls -lah /etc/config/
9292
}> ./configlist.txt
9393

94+
[ -d /overlay/modgui_log.remove_due_to_upgrade ] && cp -r /overlay/modgui_log.remove_due_to_upgrade ./
95+
[ -d /overlay/modgui_log ] && cp -r /overlay/modgui_log ./
96+
9497
###########################################################################################################################################################
9598
log "Tarring File..."
9699
tar -czvf "/tmp/DebugHelper$DATE.tar.gz" "/tmp/DebugHelper-$DATE" > /dev/null 2>&1

decompressed/gui_file/usr/share/transformer/scripts/upgradegui

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,4 @@ if [ -f "$WORKING_DIR/$CHECKSUM_FILE" ]; then
337337
fi
338338

339339
ubus send fwupgrade '{"state":"done"}'
340-
logecho "Upgrade Done" ConsoleOnly
340+
logecho "Upgrade Done"

0 commit comments

Comments
 (0)