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
1428MYSELF=" ${0} "
1529
@@ -31,13 +45,15 @@ update_myself()
3145
3246gpg_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
4359USAGE=" 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
6475fi
6576
6677if [ -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
159171else
160172 echo " Cannot update this file"
161173 echo " You need to an updater that can handle $TYPE " >&2
162174 update_myself
175+ exit 1
163176fi
164177
165178rm * .zs-old 2> /dev/null || true
179+
180+ echo " Successfully updated to version ${VERSION} "
0 commit comments