Skip to content

Commit d11fe4d

Browse files
committed
Uninstall logic
1 parent 036c6af commit d11fe4d

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

services-installer.sh

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,34 @@ PKGVER=v4
44
iv2sh SetActiveTask `pidof bookshelf.app` 0
55
PVER=`cat /mnt/secure/.pkgver`
66

7-
if [ "$PVER" != "" ] && [ "$PVER" != "$PKGVER" ]; then
8-
dialog 1 "" "Version $PVER already installed" "Update to $PKGVER" "Cancel" "Uninstall"
9-
st=$?
10-
if [ $st == 3 ]; then
11-
chattr -i /mnt/secure/runonce/*.sh
12-
rm -rf /mnt/secure/runonce/*.sh /mnt/secure/bin /mnt/secure/etc /mnt/secure/.pkgver
13-
settings=/mnt/ext1/system/config/settings/settings.json
14-
rm -f $settings
15-
mv -f $settings.old $settings
16-
dialog 2 "" "Services uninstalled, restart is needed." "Restart now" "Restart later"
17-
if [ $? == 1 ]; then
18-
sync
19-
reboot
7+
function uninstall() {
8+
chattr -i /mnt/secure/runonce/*.sh
9+
rm -rf /mnt/secure/runonce/*.sh /mnt/secure/bin /mnt/secure/etc /mnt/secure/.pkgver
10+
settings=/mnt/ext1/system/config/settings/settings.json
11+
rm -f $settings
12+
mv -f $settings.old $settings
13+
dialog 2 "" "Services uninstalled, restart is needed." "Restart now" "Restart later"
14+
if [ $? == 1 ]; then
15+
sync
16+
reboot
17+
fi
18+
exit 0
19+
}
20+
21+
if [ "$PVER" != "" ]; then
22+
if [ "$PVER" != "$PKGVER" ]; then
23+
dialog 1 "" "Version $PVER already installed" "Update to $PKGVER" "Cancel" "Uninstall"
24+
st=$?
25+
if [ $st == 3 ]; then
26+
uninstall
27+
elif [ $st == 2 ]; then
28+
exit 0
29+
fi
30+
else
31+
dialog 1 "" "Version $PVER already installed." "Cancel" "Uninstall"
32+
if [ $? == 2 ]; then
33+
uninstall
2034
fi
21-
exit 0
22-
elif [ $st == 2 ]; then
23-
exit 0
2435
fi
2536
else
2637
dialog 1 "" "Do you wish to install $PKGVER?" "Yes" "No"

0 commit comments

Comments
 (0)