2017-01-28 10:59:40 +01:00
|
|
|
#!/bin/bash
|
2017-01-03 18:32:00 +01:00
|
|
|
#
|
|
|
|
# Common variables
|
|
|
|
#
|
|
|
|
|
|
|
|
# Application version
|
2017-01-28 10:59:40 +01:00
|
|
|
VERSION="2.8.6"
|
2017-01-03 18:32:00 +01:00
|
|
|
|
|
|
|
# Remote URL to fetch application source archive
|
|
|
|
APPLICATION_SOURCE_URL="http://piwigo.org/download/dlcounter.php?code=${VERSION}"
|
|
|
|
|
2017-01-08 14:16:28 +01:00
|
|
|
#
|
|
|
|
# Common helpers
|
|
|
|
#
|
|
|
|
|
2017-01-03 18:32:00 +01:00
|
|
|
# Download and extract application sources to the given directory
|
|
|
|
# usage: extract_application_to DESTDIR
|
|
|
|
extract_application() {
|
|
|
|
local DESTDIR=$1
|
2017-01-08 14:16:28 +01:00
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
chmod 755 $TMPDIR
|
|
|
|
archive="${TMPDIR}/application.zip"
|
2017-01-03 18:32:00 +01:00
|
|
|
wget -q -O "$archive" "$APPLICATION_SOURCE_URL" \
|
2017-01-08 14:16:28 +01:00
|
|
|
|| ynh_die "Unable to download application archive"
|
|
|
|
unzip -qq "$archive" -d "$TMPDIR" \
|
2017-01-03 18:32:00 +01:00
|
|
|
|| ynh_die "Unable to extract application archive"
|
|
|
|
rm "$archive"
|
2017-01-08 14:16:28 +01:00
|
|
|
sudo rsync -a "$TMPDIR"/*/* "$DESTDIR"
|
2017-01-03 18:32:00 +01:00
|
|
|
}
|