diff --git a/conf/index.php b/conf/index.php deleted file mode 100644 index c8de97f..0000000 --- a/conf/index.php +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/scripts/_common.sh b/scripts/_common.sh index 2eda7f1..83b0876 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,14 +8,21 @@ VERSION="2.8.5" # Remote URL to fetch application source archive APPLICATION_SOURCE_URL="http://piwigo.org/download/dlcounter.php?code=${VERSION}" +# +# Common helpers +# + # Download and extract application sources to the given directory # usage: extract_application_to DESTDIR extract_application() { local DESTDIR=$1 - archive="${DESTDIR}/application.zip" + TMPDIR=$(mktemp -d) + chmod 755 $TMPDIR + archive="${TMPDIR}/application.zip" wget -q -O "$archive" "$APPLICATION_SOURCE_URL" \ -|| ynh_die "Unable to download application archive" - sudo unzip -qq "$archive" -d "$DESTDIR" \ + || 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" } \ No newline at end of file diff --git a/scripts/install b/scripts/install index ea94e17..2a77f77 100644 --- a/scripts/install +++ b/scripts/install @@ -3,6 +3,8 @@ # Exit on command errors and treat unset variables as an error set -eu +shopt -s extglob # sets extended pattern matching options in the bash shell + app=$YNH_APP_INSTANCE_NAME # Source local helpers @@ -38,16 +40,17 @@ extract_application .. # Copy source files src_path=/var/www/$app -sudo mkdir -p $src_path/upload -sudo cp -a ../piwigo/. $src_path +sudo mkdir $src_path +sudo cp -a ../!(upload|galleries) $src_path datapath=/home/yunohost.app/$app sudo mkdir -p $datapath sudo mkdir -p $datapath/galleries sudo mkdir -p $datapath/upload + sudo ln -sd $datapath/galleries $src_path/galleries +sudo cp -a ../galleries/* $src_path/galleries/ sudo ln -sd $datapath/upload $src_path/upload -sudo cp ../conf/index.php $src_path/galleries/index.php sudo cp -R ../plugins/Ldap_Login $src_path/plugins/Ldap_Login diff --git a/scripts/upgrade b/scripts/upgrade index 7fe4279..2841aa8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,7 +29,8 @@ extract_application .. # Copy source files src_path=/var/www/$app sudo mkdir -p $src_path -sudo cp -Raf ../piwigo/!(upload) $src_path +sudo cp -Raf ../!(upload|galleries) $src_path +sudo cp -Rap ../galleries/* $src_path/galleries/ datapath=/home/yunohost.app/$app