Skip to content

Commit 6f5f566

Browse files
authored
1 parent 5e1dbf7 commit 6f5f566

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

AppImageUpdate.AppDir/usr/bin/appimageupdate

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,29 @@ if [ "$TYPE" == "zsync" ] ; then
146146
# .part appended, so it will automatically find previously interrupted zsync
147147
# downloads and reuse the data already downloaded.
148148
ZSYNC_URL=$(echo "${APPLICATION_USED}" | cut -d "|" -f 2) # Get the URL of the zsync file
149+
echo "$ZSYNC_URL"
149150
# Get the file with zsync using $1 as an input file
150151
zsync_curl -I -i "${ISO}" "${ZSYNC_URL}" 2>&1
151152
NEWFILE=$(basename "${ZSYNC_URL}" | sed -e 's|.zsync||g' ) # FIXME: Use the file that zsync has written!!!
152153
chmod --reference="${ISO}.zs-old" "$(printf '%b' "${NEWFILE//%/\\x}")" # Set the same permissions as for the original file
153154
gpg_check
155+
elif [ "$TYPE" == "gh-releases-zsync" ] ; then
156+
cd $(dirname "${ISO}")
157+
echo "Getting version information from GitHub Releases"
158+
USERNAME=$(echo "${APPLICATION_USED}" | cut -d "|" -f 2)
159+
REPO=$(echo "${APPLICATION_USED}" | cut -d "|" -f 3)
160+
RELEASE=$(echo "${APPLICATION_USED}" | cut -d "|" -f 4)
161+
FILENAME=$(echo "${APPLICATION_USED}" | cut -d "|" -f 5)
162+
URL="https://api.github.com/repos/$USERNAME/$REPO/releases/$RELEASE"
163+
REGEX=$(echo $FILENAME | sed -e 's|\*|\.\*|g')
164+
echo "$REGEX"
165+
ZSYNC_URL=$(curl "$URL" | grep "$REGEX" | grep "browser_download_url" | cut -d '"' -f 4) # TODO: Get rid of curl command
166+
echo "$ZSYNC_URL"
167+
# Get the file with zsync using $1 as an input file
168+
zsync_curl -I -i "${ISO}" "${ZSYNC_URL}" 2>&1
169+
NEWFILE=$(basename "${ZSYNC_URL}" | sed -e 's|.zsync||g' ) # FIXME: Use the file that zsync has written!!!
170+
chmod --reference="${ISO}" "$(printf '%b' "${NEWFILE//%/\\x}")" # Set the same permissions as for the original file
171+
gpg_check
154172
elif [ "$TYPE" == "bintray-zsync" ] ; then
155173
cd $(dirname "${ISO}")
156174
# Actually, instead of copying another zsync file to a fixed URL (which is cumbersome)
@@ -176,6 +194,7 @@ elif [ "$TYPE" == "bintray-zsync" ] ; then
176194
echo "Latest version: ${VERSION}"
177195
fi
178196
ZSYNC_URL=$(echo "${DUMMY_URL}" | sed -e "s|_latestVersion|$VERSION|g" )
197+
echo "$ZSYNC_URL"
179198
# Get the file with zsync using $1 as an input file
180199
zsync_curl -I -i "${ISO}" "${ZSYNC_URL}" 2>&1
181200
NEWFILE=$(basename "${ZSYNC_URL}" | sed -e 's|.zsync||g' ) # FIXME: Use the file that zsync has written!!!

0 commit comments

Comments
 (0)