mirror of
https://github.com/YunoHost-Apps/nodered_ynh.git
synced 2024-09-03 19:46:25 +02:00
30 lines
593 B
Bash
30 lines
593 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Create the temporary directory
|
||
|
tempdir="$(mktemp -d)"
|
||
|
|
||
|
# Download sources and calculate checksum
|
||
|
filename=${DOWNLOAD_URL##*/}
|
||
|
curl --silent -4 -L $DOWNLOAD_URL -o "$tempdir/$filename"
|
||
|
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||
|
|
||
|
# Delete temporary directory
|
||
|
rm -rf $tempdir
|
||
|
|
||
|
# Get extension
|
||
|
if [[ $filename == *.tar.gz ]]; then
|
||
|
extension=tar.gz
|
||
|
else
|
||
|
extension=${filename##*.}
|
||
|
fi
|
||
|
|
||
|
# Rewrite source file
|
||
|
cat <<EOT > conf/app.src
|
||
|
SOURCE_URL=$DOWNLOAD_URL
|
||
|
SOURCE_SUM=$checksum
|
||
|
SOURCE_SUM_PRG=sha256sum
|
||
|
SOURCE_FORMAT=$extension
|
||
|
SOURCE_IN_SUBDIR=true
|
||
|
SOURCE_FILENAME=
|
||
|
EOT
|