1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/shaarli_ynh.git synced 2024-09-03 20:26:10 +02:00
shaarli_ynh/scripts/_common.sh

30 lines
1.1 KiB
Bash
Raw Normal View History

2017-02-19 23:16:01 +01:00
#
# Common helpers
#
2017-06-17 12:20:09 +02:00
2017-02-19 23:16:01 +01:00
# Download and extract Shaarli sources to the given directory
# usage: extract_shaarli DESTDIR [AS_USER]
extract_shaarli() {
local AS_USER=${6:-$USER}
# Retrieve and extract Shaarli tarball
sh_tarball="/tmp/shaarli.tar.gz"
rm -f "$sh_tarball"
wget -q -O "$sh_tarball" "$SHAARLI_SOURCE_URL" \
|| ynh_die "Unable to download Shaarli tarball"
echo "$SHAARLI_SOURCE_SHA256 $sh_tarball" | sha256sum -c >/dev/null \
|| ynh_die "Invalid checksum of downloaded tarball"
sudo tar xf "$sh_tarball" -C "$final_path" --strip-components 1 \
|| ynh_die "Unable to extract Shaarli tarball"
rm -f "$sh_tarball"
wget -q -O "$sh_tarball" "$SHAARLI_SOURCE_URL" \
|| ynh_die "Unable to download Shaarli tarball"
echo "$SHAARLI_SOURCE_SHA256 $sh_tarball" | sha256sum -c >/dev/null \
|| ynh_die "Invalid checksum of downloaded tarball"
sudo tar xf "$sh_tarball" -C "$final_path" --strip-components 1 \
|| ynh_die "Unable to extract Shaarli tarball"
sudo chown -R www-data: $final_path
}