diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..3878db1 --- /dev/null +++ b/conf/app.src @@ -0,0 +1,4 @@ +SOURCE_URL=https://github.com/adobo/agendav/releases/download/2.0.0/agendav-2.0.0.tar.gz +SOURCE_SUM=142e8d9ea0e3e6feacd1523c5cabc834fe8bc3e9dbae03034089758b9c3abb92 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz diff --git a/scripts/_common.sh b/scripts/_common.sh index 5e0f815..f3afb88 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,19 +1,8 @@ +#!/bin/bash # # Common variables # -# AgenDAV version -VERSION="2.0.0" - -# Source tarball checksum -SOURCE_SHA256="142e8d9ea0e3e6feacd1523c5cabc834fe8bc3e9dbae03034089758b9c3abb92" - -# 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 @@ -28,27 +17,4 @@ declare -A LANGUAGES=( # 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" -} diff --git a/scripts/install b/scripts/install index c90863c..f444aeb 100644 --- a/scripts/install +++ b/scripts/install @@ -49,12 +49,11 @@ else fi # Install dependencies -ynh_package_is_installed "php5-cli" \ - || ynh_package_install "php5-cli" +ynh_install_app_dependencies "php5-cli" # Create tmp directory and fetch app inside TMPDIR=$(mktemp -d) -extract_agendav "$TMPDIR" +ynh_setup_source "$TMPDIR" # Generate random password and encryption key dbpass=$(ynh_string_random) diff --git a/scripts/remove b/scripts/remove index a2e4b3d..b209a6f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -23,6 +23,9 @@ rm -rf "/var/www/${app}" "/var/log/${app}" rm -f "/etc/php5/fpm/pool.d/${app}.conf" [[ -n $domain ]] && rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf" +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + # Reload services service php5-fpm restart || true service nginx reload || true diff --git a/scripts/restore b/scripts/restore index 98befe9..e56308b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,9 +14,6 @@ app="$YNH_APP_INSTANCE_NAME" dbname=$app dbuser=$app -# Source app helpers -source /usr/share/yunohost/helpers - # Retrieve old app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) @@ -25,6 +22,9 @@ dbpass=$(ynh_app_setting_get "$app" mysqlpwd) # Check web path availability ynh_webpath_available "$domain" "$path" +# Install dependencies +ynh_install_app_dependencies "php5-cli" + # Check destination directory DESTDIR="/var/www/$app" [[ -d $DESTDIR ]] && ynh_die \ diff --git a/scripts/upgrade b/scripts/upgrade index 17ce37a..25019f6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,12 +54,11 @@ else fi # Install dependencies -ynh_package_is_installed "php5-cli" \ - || ynh_package_install "php5-cli" +ynh_install_app_dependencies "php5-cli" # Create tmp directory and fetch app inside TMPDIR=$(mktemp -d) -extract_agendav "$TMPDIR" +ynh_setup_source "$TMPDIR" # Copy and set AgenDAV configuration conf_path="${TMPDIR}/web/config/settings.php" diff --git a/patches/00-add-http-auth.patch b/sources/patches/app-00-add-http-auth.patch similarity index 100% rename from patches/00-add-http-auth.patch rename to sources/patches/app-00-add-http-auth.patch