1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00
baikal_ynh/scripts/_common.sh
Jérôme Lebleu 1252a08d63 [enh] Update to Baikal 0.4.4 and download upstream sources
Sources are removed from the repository and downloaded instead to
improve readability and updates. This also comes with a patch to add
LDAP authentication backend.
The `install` and `remove` scripts have also been almost rewrite to
make use of new YunoHost helpers and facilities coming with 2.3.x.
2016-05-02 23:01:28 +02:00

44 lines
1.2 KiB
Bash

#
# Common variables
#
# Baikal version
VERSION=0.4.4
# Baikal source archive checksum
BAIKAL_SOURCE_SHA256="cced612353862bce532ed458eda0675b5e1e5790f92969bf13992c6567943efc"
# Remote URL to fetch Baikal source archive
BAIKAL_SOURCE_URL="https://github.com/fruux/Baikal/releases/download/${VERSION}/baikal-${VERSION}.zip"
# App package root directory should be the parent folder
PKGDIR=$(cd ../; pwd)
#
# Common helpers
#
# Source app helpers
source /usr/share/yunohost/helpers
# Download and extract Baikal sources to the given directory
# usage: extract_baikal DESTDIR
extract_baikal() {
local DESTDIR=$1
local bk_archive="${DESTDIR}/baikal.zip"
# wget -q -O "$bk_archive" "$BAIKAL_SOURCE_URL" \
cp /home/admin/baikal.zip "$bk_archive" \
|| ynh_die "Unable to download Baikal archive"
echo "$BAIKAL_SOURCE_SHA256 $bk_archive" | sha256sum -c >/dev/null \
|| ynh_die "Invalid checksum of downloaded archive"
unzip -q "$bk_archive" -d "$DESTDIR" \
|| ynh_die "Unable to extract Baikal archive"
mv "${DESTDIR}/baikal/"* "$DESTDIR"
rm -rf "$bk_archive" "${DESTDIR}/baikal"
# apply patches
(cd "$DESTDIR" \
&& for p in ${PKGDIR}/patches/*.patch; do patch -p1 < $p; done) \
|| die "Unable to apply patches to Baikal"
}