2016-11-26 16:25:18 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
|
|
|
|
2017-01-03 18:32:00 +01:00
|
|
|
shopt -s extglob # sets extended pattern matching options in the bash shell
|
|
|
|
|
2016-11-26 16:25:18 +01:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2017-01-03 18:32:00 +01:00
|
|
|
# Source local helpers
|
|
|
|
source ./_common.sh
|
|
|
|
|
2016-11-26 16:25:18 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Retrieve app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
path=$(ynh_app_setting_get "$app" path)
|
|
|
|
admin=$(ynh_app_setting_get "$app" admin)
|
|
|
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
|
|
language=$(ynh_app_setting_get "$app" language)
|
|
|
|
|
2017-01-28 12:42:43 +01:00
|
|
|
# Fix path if needed
|
|
|
|
path=$(fix_path $path)
|
|
|
|
|
2017-01-03 18:32:00 +01:00
|
|
|
# Download and extract application
|
|
|
|
extract_application ..
|
2016-12-27 14:41:45 +01:00
|
|
|
|
2016-11-26 16:25:18 +01:00
|
|
|
# Copy source files
|
|
|
|
src_path=/var/www/$app
|
|
|
|
sudo mkdir -p $src_path
|
2017-01-08 14:16:28 +01:00
|
|
|
sudo cp -Raf ../!(upload|galleries) $src_path
|
|
|
|
sudo cp -Rap ../galleries/* $src_path/galleries/
|
2016-11-26 16:25:18 +01:00
|
|
|
|
|
|
|
datapath=/home/yunohost.app/$app
|
|
|
|
|
|
|
|
sudo chown -R www-data:www-data $src_path
|
|
|
|
sudo chown -R www-data:www-data $datapath
|
|
|
|
sudo chmod 777 $src_path/_data
|
|
|
|
sudo chmod 777 $src_path/upload
|
|
|
|
sudo chmod 755 -R $src_path/galleries
|
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
nginx_conf=../conf/nginx.conf
|
2017-01-28 12:42:43 +01:00
|
|
|
sed -i "s@YNH_WWW_PATH@${path}@g" $nginx_conf
|
2016-11-26 16:25:18 +01:00
|
|
|
sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
|
|
|
|
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
|
|
|
|
# Set permissions and reload nginx (needed at this stage for the PHP piwigo installation process)
|
|
|
|
sudo service nginx reload
|
2016-12-30 17:32:19 +01:00
|
|
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
2016-11-26 16:25:18 +01:00
|
|
|
sudo yunohost app ssowatconf
|
|
|
|
|
|
|
|
#activate ldap plugin
|
|
|
|
#mysql -u $dbuser -p$dbpass $dbname -e "INSERT INTO plugins (id,state,version) VALUES ('Ldap_Login','active','1.1');"
|
|
|
|
|
|
|
|
#protect URIs if private
|
|
|
|
if [ $is_public -eq 0 ];
|
|
|
|
then
|
2016-12-30 17:32:19 +01:00
|
|
|
ynh_app_setting_delete "$app" unprotected_uris
|
|
|
|
ynh_app_setting_set "$app" protected_uris "/"
|
2016-11-26 16:25:18 +01:00
|
|
|
fi
|