2015-01-28 07:21:27 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-06-04 10:50:35 +02:00
|
|
|
# See comments in install script
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Source YunoHost helpers
|
|
|
|
. /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)
|
2015-01-28 07:21:27 +01:00
|
|
|
|
|
|
|
# Remove trailing "/" for next commands
|
|
|
|
path=${path%/}
|
|
|
|
|
|
|
|
# Copy files to the right place
|
|
|
|
version=$(cat upstream_version)
|
2016-06-04 10:50:35 +02:00
|
|
|
final_path=/var/www/$app
|
2015-01-28 07:21:27 +01:00
|
|
|
sudo rm -rf $final_path
|
|
|
|
sudo mkdir -p $final_path
|
|
|
|
echo "Downloading phpLDAPadmin $version..."
|
|
|
|
sudo wget -O ../phpLDAPadmin.tar.gz http://sourceforge.net/projects/phpldapadmin/files/phpldapadmin-php5/$version/phpldapadmin-$version.tgz/download > /dev/null 2>&1
|
|
|
|
echo "Extracting to $final_path..."
|
|
|
|
sudo tar xvzf ../phpLDAPadmin.tar.gz -C .. > /dev/null 2>&1
|
2016-06-04 10:50:35 +02:00
|
|
|
sudo cp -ra ../phpldapadmin-$version/. $final_path
|
|
|
|
|
|
|
|
# Patch 1.2.3 for Jessie (correct bug php 5.5)
|
|
|
|
sudo wget -O PhpLdapAdmin-1.2.3_patch.tar.gz http://www.jouvinio.net/wiki/images/f/f0/PhpLdapAdmin-1.2.3_patch.tar.gz > /dev/null 2>&1
|
|
|
|
sudo tar -C $final_path/lib/ -xzvf PhpLdapAdmin-1.2.3_patch.tar.gz
|
2015-01-28 07:21:27 +01:00
|
|
|
|
|
|
|
# Configuration
|
|
|
|
echo "Configuring application..."
|
|
|
|
sudo cp ../conf/config.php $final_path/config/
|
|
|
|
|
2016-06-04 10:50:35 +02:00
|
|
|
sudo yunohost app addaccess $app -u $admin
|
|
|
|
sudo yunohost app setting $app admin -v $admin
|
2015-01-28 07:21:27 +01:00
|
|
|
|
|
|
|
# Files owned by root, www-data can just read
|
|
|
|
echo "Setting permission..."
|
|
|
|
sudo chown -R root: $final_path
|
|
|
|
sudo find $final_path -type f | xargs sudo chmod 644
|
|
|
|
sudo find $final_path -type d | xargs sudo chmod 755
|
|
|
|
# config.php contains sensitive data, restrict its access
|
|
|
|
sudo chown root:www-data $final_path/config/config.php
|
|
|
|
sudo chmod 640 $final_path/config/config.php
|
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
echo "Setting up nginx configuration..."
|
|
|
|
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
|
|
|
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
|
|
|
nginxconf=/etc/nginx/conf.d/$domain.d/phpldapadmin.conf
|
|
|
|
sudo cp ../conf/nginx.conf $nginxconf
|
|
|
|
sudo chown root: $nginxconf
|
|
|
|
sudo chmod 600 $nginxconf
|
|
|
|
|
|
|
|
sudo service nginx reload
|
2016-06-04 10:50:35 +02:00
|
|
|
#sudo yunohost app ssowatconf
|