1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/agendav_ynh.git synced 2024-09-03 20:36:12 +02:00
agendav_ynh/scripts/_common.sh
Jérôme Lebleu 6f89f5dfc8 [enh] Improve packaging and upgrade AgenDAV to 2.0
Besides the AgenDAV upgrade, it improves the packaging - only the install
and remove scripts yet - with the following:
 * download and check sources, and apply a patch to modify them
 * add a specific PHP FPM pool for AgenDAV
 * allow to select AgenDAV default language
 * allow to extend AgenDAV configuration in a local.php file
2016-07-15 14:43:35 +02:00

54 lines
1.3 KiB
Bash

#
# Common variables
#
# AgenDAV version
VERSION="2.0.0-beta2"
# Source tarball checksum
SOURCE_SHA256="5cbb76c08ef1c669e5735473a963ca62b835fd43955d31cc1b6d8d32672bc54d"
# Source tarball URL
SOURCE_URL="https://github.com/adobo/agendav/releases/download/${VERSION}/agendav-${VERSION}.tar.gz"
# App package root directory should be the parent folder
PKGDIR=$(cd ../; pwd)
# Associative array of languages
declare -A LANGUAGES=(
[nl]=nl_NL
[en]=en
[fr]=fr_FR
[de]=de_DE
[it]=it_IT
[es]=es_ES
)
#
# Common helpers
#
# Source app helpers
source /usr/share/yunohost/helpers
# Download and extract AgenDAV sources to the given directory
# usage: extract_agendav DESTDIR
extract_agendav() {
local DESTDIR=$1
# retrieve and extract tarball
tarball_path="/tmp/agendav.tar.gz"
rm -f "$tarball_path"
wget -q -O "$tarball_path" "$SOURCE_URL" \
|| ynh_die "Unable to download AgenDAV archive"
echo "$SOURCE_SHA256 $tarball_path" | sha256sum -c >/dev/null \
|| ynh_die "Invalid checksum of downloaded archive"
tar xf "$tarball_path" -C "$DESTDIR" --strip-components 1 \
|| ynh_die "Unable to extract AgenDAV archive"
rm -rf "$tarball_path"
# apply patches
(cd "$DESTDIR" \
&& for p in ${PKGDIR}/patches/*.patch; do patch -p1 < $p; done) \
|| die "Unable to apply patches to AgenDAV"
}