1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/audiobookshelf_ynh.git synced 2024-09-03 18:06:19 +02:00

Update updater.sh

This commit is contained in:
Navan Chauhan 2022-07-15 14:23:02 +05:30 committed by GitHub
parent a7f6185e05
commit cef283040d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,44 +45,15 @@ elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"admin"*)
src="app"
;;
*"update"*)
src="app-upgrade"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
filename="https://github.com/advplyr/audiobookshelf/archive/refs/tags/v$version.tar.gz"
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)