-
Notifications
You must be signed in to change notification settings - Fork 0
/
UPDATER
executable file
·115 lines (89 loc) · 4.57 KB
/
UPDATER
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
HERE="$(dirname "$(readlink -f "$0")")"
TERMINAL=urxvt
LAST_RELEASE=`wget -qO- https://raw.githubusercontent.com/lakshayrohila/marktext-portable/master/DATA/.MARKTEXT_LAST_RELEASE`
if [ -z "$LAST_RELEASE" ]; then
/usr/lib/gtkdialog/box_splash -bg red -fg white -timeout 5 -text "I am having problems checking for latest release."
if [ $? -eq 127 ]; then
gxmessage -borderless -center -bg orange -timeout 5 "I am having problems checking for latest release."
if [ $? -eq 127 ];then
$TERMINAL -e sh -c "echo \"I am having problems checking for latest release.\" && sleep 5"
echo "I am having problems checking for latest release."
fi
fi
if [ ! -f "$HERE/app/marktext-x86_64.AppImage" ]; then
exit 1
fi
exit 0
fi
if [ ! -f "$HERE/DATA/INSTALLED_VERSION" ]; then
echo "none" > "$HERE/DATA/INSTALLED_VERSION"
fi
INSTALLED_VERSION=`cat "$HERE/DATA/INSTALLED_VERSION"`
if [ ! -f "$HERE/app/marktext-x86_64.AppImage" ]; then
/usr/lib/gtkdialog/box_yesno --yes-first --no-label "Later" --info "Install MarkText!" "MarkText binary is not found! Do you want to download MarkText binary?"
USER_ACCEPTED=$?
if [ $USER_ACCEPTED -eq 127 ]; then
gxmessage -center -bg orange -buttons "Yes:0,Later:1" "MarkText binary is not found! Do you want to download MarkText binary?" -title "Install MarkText!"
USER_ACCEPTED=$?
if [ $USER_ACCEPTED -eq 127 ];then
$TERMINAL -e sh -c "echo \"Note that gxmessage is not found. Please install gxmessage.\" && sleep 10"
echo "Note that gxmessage is not found. Please install gxmessage."
exit 1
fi
fi
if [ $USER_ACCEPTED -eq 0 ]; then
$TERMINAL -e wget -P "$HERE/app/" "https://github.com/marktext/marktext/releases/download/$LAST_RELEASE/marktext-x86_64.AppImage"
if [ $? -eq 127 ]; then
/usr/lib/gtkdialog/box_splash -bg red -fg white -timeout 10 -text "Note that rxvt is not found. Please install rxvt."
if [ $? -eq 127 ]; then
gxmessage -borderless -center -bg orange -timeout 10 "Note that rxvt is not found. Please install rxvt."
fi
exit 1
fi
if [ ! -f "$HERE/app/marktext-x86_64.AppImage" ]; then
/usr/lib/gtkdialog/box_splash -bg red -fg white -timeout 10 -text " DOWNLOAD FAILED! Please try again later..... "
if [ $? -eq 127 ]; then
gxmessage -borderless -center -bg orange -timeout 10 " DOWNLOAD FAILED! Please try again later..... "
fi
else
chmod 777 "$HERE/app/marktext-x86_64.AppImage"
fi
echo $LAST_RELEASE > "$HERE/DATA/INSTALLED_VERSION"
elif [ $USER_ACCEPTED -eq 1 ]; then
exit 1
fi
elif [ $LAST_RELEASE != $INSTALLED_VERSION ]; then
/usr/lib/gtkdialog/box_yesno --yes-first --info "Update Available!" "A new update of MarkText is found! Do you want to update?"
USER_ACCEPTED=$?
if [ $USER_ACCEPTED -eq 127 ]; then
gxmessage -center -bg orange -buttons "Yes:0,No:1" "A new update of MarkText is found! Do you want to update?" -title "Update Available!"
USER_ACCEPTED=$?
if [ $USER_ACCEPTED -eq 127 ];then
$TERMINAL -e sh -c "echo \"Note that gxmessage is not found. Please install gxmessage.\" && sleep 10"
echo "Note that gxmessage is not found. Please install gxmessage."
exit 1
fi
fi
if [ $USER_ACCEPTED -eq 0 ]; then
rm "$HERE/app/marktext-x86_64.AppImage" >/dev/null 2>/dev/null
$TERMINAL -e wget -P "$HERE/app/" "https://github.com/marktext/marktext/releases/download/$LAST_RELEASE/marktext-x86_64.AppImage"
if [ $? -eq 127 ]; then
/usr/lib/gtkdialog/box_splash -bg red -fg white -timeout 10 -text "Note that rxvt is not found. Please install rxvt."
if [ $? -eq 127 ]; then
gxmessage -borderless -center -bg orange -timeout 10 "Note that rxvt is not found. Please install rxvt."
fi
exit 1
fi
if [ ! -f "$HERE/app/marktext-x86_64.AppImage" ]; then
/usr/lib/gtkdialog/box_splash -bg red -fg white -timeout 10 -text " DOWNLOAD FAILED! Please try again later..... "
if [ $? -eq 127 ]; then
gxmessage -borderless -center -bg orange -timeout 10 " DOWNLOAD FAILED! Please try again later..... "
fi
exit 1
else
chmod 777 "$HERE/app/marktext-x86_64.AppImage"
fi
echo $LAST_RELEASE > "$HERE/DATA/INSTALLED_VERSION"
fi
fi