Skip to content

Commit 40aa797

Browse files
author
Live System User
committed
More GUI preparation
1 parent ca4dbe3 commit 40aa797

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

AppImageUpdate.AppDir/usr/bin/appimageupdate

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,24 @@ set -e
66
# or though the appimageupdate GUI. The GUI is purely optional.
77
# It displays stdout and stderr, as well as a progress indicator.
88

9+
error()
10+
{
11+
if [ -x /usr/bin/zenity ] ; then
12+
zenity --error --text "${1}" 2>/dev/null
13+
elif [ -x /usr/bin/kdialog ] ; then
14+
kdialog --msgbox "${1}" 2>/dev/null
15+
elif [ -x /usr/bin/Xdialog ] ; then
16+
Xdialog --msgbox "${1}" 2>/dev/null
17+
else
18+
echo "${1}"
19+
fi
20+
exit 1
21+
}
22+
923
# A simple dependency check
10-
which zsync_curl >/dev/null
11-
which curl >/dev/null
12-
which dd >/dev/null
24+
which zsync_curl >/dev/null || error "zsync_curl is missing"
25+
which curl >/dev/null || error "curl is missing"
26+
which dd >/dev/null || error "dd is missing"
1327

1428
MYSELF="${0}"
1529

@@ -31,13 +45,15 @@ update_myself()
3145

3246
gpg_check()
3347
{
48+
set +e
3449
if [ "$(which gpg)" != "" ] ; then
3550
echo "GPG is installed; hence attempting signature verification"
3651
ASC_URL=$( echo "${ZSYNC_URL}" | sed -e 's|.zsync|.asc|g' )
37-
curl -k -L -O -# "${ASC_URL}" && gpg --verify $(basename "${ASC_URL}")
52+
curl -k -L -O -# "${ASC_URL}" && gpg --verify $(basename "${ASC_URL}") && echo "Signature verified"
3853
else
3954
echo "GPG is not installed; hence skipping signature verification" >&2
4055
fi
56+
set -e
4157
}
4258

4359
USAGE="Usage:
@@ -53,14 +69,9 @@ if [ $# -lt 1 ] ; then
5369
RESULT=$?
5470
set -e
5571
if [ $RESULT != 0 ] ; then
56-
if [ -x /usr/bin/zenity ] ; then
57-
zenity --error --text "${MSG}" 2>/dev/null
58-
elif [ -x /usr/bin/kdialog ] ; then
59-
kdialog --msgbox "${MSG}" 2>/dev/null
60-
elif [ -x /usr/bin/Xdialog ] ; then
61-
Xdialog --msgbox "${MSG}" 2>/dev/null
62-
fi
72+
error "${MSG}"
6373
fi
74+
exit $RESULT
6475
fi
6576

6677
if [ -e "${1}" ] ; then
@@ -156,10 +167,14 @@ elif [ "$TYPE" == "" ] ; then
156167
echo "Cannot update this file"
157168
echo "This file contains no update information or you need to update the updater" >&2
158169
update_myself
170+
exit 1
159171
else
160172
echo "Cannot update this file"
161173
echo "You need to an updater that can handle $TYPE" >&2
162174
update_myself
175+
exit 1
163176
fi
164177

165178
rm *.zs-old 2>/dev/null || true
179+
180+
echo "Successfully updated to version ${VERSION}"

appimageupdategui/progress.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public class ProgressWindow : Window {
130130
channel.read_line (out line, null, null);
131131
stdout.printf(line); // Be verbose
132132
file_counts = 12; // TODO: Get from command line output
133-
action_label.label = "Updating: " + line.substring(0, line.length - 1);
133+
action_label.label = line.substring(0, line.length - 1);
134134
counter++;
135135
progress.set_fraction( 1.0f * counter / file_counts);
136136

0 commit comments

Comments
 (0)