1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dotclear2_ynh.git synced 2024-09-03 18:26:29 +02:00

Update updater.sh

This commit is contained in:
yalh76 2022-06-08 01:25:47 +02:00
parent 17a0c8f71f
commit 57d894fb22

View file

@ -16,9 +16,8 @@
# Fetching information # Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
asset=$(curl --silent "https://download.dotclear.org/latest/" | grep "dotclear-.*?.zip" -Po | head -1)
asset=$(curl --silent "https://download.dotclear.org/latest/" | grep "dotclear-.*?.tar.gz" -Po | head -1) version=${asset%.zip}
version=${asset%.tar.gz}
version=${version#dotclear-} version=${version#dotclear-}
# Later down the script, we assume the version has only digits and dots # Later down the script, we assume the version has only digits and dots
@ -55,20 +54,20 @@ src="app"
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
# Download sources and calculate checksum # Download sources and calculate checksum
curl --silent -4 -L http://download.dotclear.org/latest/dotclear-$version.tar.gz -o "$tempdir/$asset" curl --silent -4 -L http://download.dotclear.org/latest/dotclear-$version.zip -o "$tempdir/$asset"
checksum=$(sha256sum "$tempdir/$asset" | head -c 64) checksum=$(sha256sum "$tempdir/$asset" | head -c 64)
# Delete temporary directory # Delete temporary directory
rm -rf $tempdir rm -rf $tempdir
# Get extension # Get extension
if [[ $asset == *.tar.gz ]]; then if [[ $asset == *.zip ]]; then
extension=tar.gz extension=zip
fi fi
# Rewrite source file # Rewrite source file
cat <<EOT > conf/$src.src cat <<EOT > conf/$src.src
SOURCE_URL=http://download.dotclear.org/latest/dotclear-$version.tar.gz SOURCE_URL=http://download.dotclear.org/latest/dotclear-$version.zip
SOURCE_SUM=$checksum SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension SOURCE_FORMAT=$extension