From 982222a4ab46c6a51ec55f7c517d361aae57fec0 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Thu, 19 Oct 2017 11:33:09 +0200 Subject: [PATCH] Use ynh_setup_source --- conf/app.src | 4 ++++ scripts/_common.sh | 25 +------------------------ scripts/install | 2 +- scripts/upgrade | 2 +- 4 files changed, 7 insertions(+), 26 deletions(-) create mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..b22c84c --- /dev/null +++ b/conf/app.src @@ -0,0 +1,4 @@ +SOURCE_URL=https://github.com/kanboard/kanboard/releases/download/v1.0.41/kanboard-1.0.41.zip +SOURCE_SUM=825885960c65f7817d9fc34ca5ac8c36ef637ed285bcdb2bf3f5569bf64c9ff2 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip diff --git a/scripts/_common.sh b/scripts/_common.sh index 8d9086b..e1c9af8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,28 +1,5 @@ +#!/bin/bash # # Common variables # -# Application version -VERSION="1.0.41" - -# Remote URL to fetch application source archive -APPLICATION_SOURCE_URL="https://kanboard.net/kanboard-${VERSION}.zip" - -# -# Common helpers -# - -# Download and extract application sources to the given directory -# usage: extract_application_to DESTDIR -extract_application() { - local DESTDIR=$1 - TMPDIR=$(mktemp -d) - chmod 755 $TMPDIR - archive="${TMPDIR}/application.zip" - wget -q -O "$archive" "$APPLICATION_SOURCE_URL" \ - || ynh_die "Unable to download application archive" - unzip -qq "$archive" -d "$TMPDIR" \ - || ynh_die "Unable to extract application archive" - rm "$archive" - sudo rsync -a "$TMPDIR"/*/* "$DESTDIR" -} diff --git a/scripts/install b/scripts/install index c1cc5d0..f3db401 100644 --- a/scripts/install +++ b/scripts/install @@ -45,7 +45,7 @@ ynh_app_setting_set $app mysqlpwd $dbpass ynh_app_setting_set $app adminusername $admin ynh_app_setting_set $app is_public $is_public -extract_application "$DESTDIR" +ynh_setup_source "$DESTDIR" # Copy and edit config.php sudo cp ../conf/config.php ${DESTDIR} diff --git a/scripts/upgrade b/scripts/upgrade index f0f8bde..33952bb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,7 +39,7 @@ sudo rm -rf /var/lib/php5/session/* # Move old app dir sudo mv ${DESTDIR} ${DESTDIR}.old -extract_application "$DESTDIR" +ynh_setup_source "$DESTDIR" # restore data sudo cp -a ${DESTDIR}.old/data ${DESTDIR}