Skip to content

Commit 4192344

Browse files
authored
Remove the need for curl, use zsync_curl -r instead
1 parent f0fe0cb commit 4192344

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

AppImageUpdate.AppDir/usr/bin/appimageupdate

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ set -e
88
# Communication between this script and the GUI happen through
99
# file descriptors (&1 = stdout, &2 = stderr, $3 ... up to &9)
1010
# http://stackoverflow.com/questions/2342826/how-to-pipe-stderr-and-not-stdout
11-
#
12-
# echo "######" | tee >(sed -e 's/#/#\n/g' >&1)
11+
1312

1413
error()
1514
{
@@ -27,12 +26,11 @@ error()
2726

2827
finished()
2928
{
30-
echo "#########################" | tee >(sed -e 's/#/#\n/g')
29+
echo "#########################"
3130
}
3231

3332
# A simple dependency check
3433
which zsync_curl >/dev/null || error "zsync_curl is missing"
35-
which curl >/dev/null || error "curl is missing"
3634
which dd >/dev/null || error "dd is missing"
3735

3836
MYSELF="${0}"
@@ -56,10 +54,10 @@ update_myself()
5654
gpg_check()
5755
{
5856
set +e
59-
if [ "$(which gpg)" != "" ] ; then
57+
if [ "$(which gpg_currently_disabled)" != "" ] ; then
6058
echo "GPG is installed; hence attempting signature verification"
6159
ASC_URL=$( echo "${ZSYNC_URL}" | sed -e 's|.zsync|.asc|g' )
62-
curl -k -L -O -# "${ASC_URL}" && gpg --verify $(basename "${ASC_URL}") && echo "Signature verified"
60+
# curl -k -L -O -# "${ASC_URL}" && gpg --verify $(basename "${ASC_URL}") && echo "Signature verified"
6361
else
6462
echo "GPG is not installed; hence skipping signature verification" >&2
6563
fi
@@ -140,7 +138,7 @@ if [ "$TYPE" == "zsync" ] ; then
140138
# downloads and reuse the data already downloaded.
141139
ZSYNC_URL=$(echo "${APPLICATION_USED}" | cut -d "|" -f 2) # Get the URL of the zsync file
142140
# Get the file with zsync using $1 as an input file
143-
zsync_curl -I -i "${ISO}" "${ZSYNC_URL}" 2>&1 | tee >(sed -e 's/#/#\n/g') && finished
141+
zsync_curl -I -i "${ISO}" "${ZSYNC_URL}" 2>&1 && finished
144142
NEWFILE=$(basename "${ZSYNC_URL}" | sed -e 's|.zsync||g' ) # FIXME: Use the file that zsync has written!!!
145143
chmod --reference="${ISO}.zs-old" "${NEWFILE}" # Set the same permissions as for the original file
146144
gpg_check
@@ -160,7 +158,7 @@ elif [ "$TYPE" == "bintray-zsync" ] ; then
160158
ZSYNCDUMMYNAME=$(echo "${APPLICATION_USED}" | cut -d "|" -f 5)
161159
REDIRECTOR_URL="https://bintray.com/$USERNAME/$REPO/$PACKAGE/_latestVersion"
162160
DUMMY_URL="https://bintray.com/artifact/download/$USERNAME/$REPO/$ZSYNCDUMMYNAME"
163-
VERSION=$(curl -k -r 0-0 -Ls -o /dev/null -w %{url_effective} "${REDIRECTOR_URL}" | cut -d "/" -f 7)
161+
VERSION=$(zsync_curl -r "${REDIRECTOR_URL}" | cut -d "/" -f 7)
164162
if [ "$VERSION" == "_latestVersion" ] ; then
165163
echo "Error"
166164
echo "Could not get the latest version from Bintray" >&2
@@ -170,7 +168,7 @@ elif [ "$TYPE" == "bintray-zsync" ] ; then
170168
fi
171169
ZSYNC_URL=$(echo "${DUMMY_URL}" | sed -e "s|_latestVersion|$VERSION|g" )
172170
# Get the file with zsync using $1 as an input file
173-
zsync_curl -I -i "${ISO}" "${ZSYNC_URL}" 2>&1 | tee >(sed -e 's/#/#\n/g') && finished
171+
zsync_curl -I -i "${ISO}" "${ZSYNC_URL}" 2>&1 && finished
174172
NEWFILE=$(basename "${ZSYNC_URL}" | sed -e 's|.zsync||g' ) # FIXME: Use the file that zsync has written!!!
175173
chmod --reference="${ISO}" "${NEWFILE}" # Set the same permissions as for the original file
176174
gpg_check

0 commit comments

Comments
 (0)