1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/phpldapadmin_ynh.git synced 2024-09-03 19:56:45 +02:00

Update script pour YNH v2.4

This commit is contained in:
root 2016-06-04 08:50:35 +00:00
parent 6eefac5081
commit fe654eefa8
3 changed files with 45 additions and 32 deletions

View file

@ -1,46 +1,41 @@
#!/bin/bash #!/bin/bash
# Retrieve arguments # Retrieve arguments
domain=$1 app=$YNH_APP_INSTANCE_NAME
path=$2 domain=$YNH_APP_ARG_DOMAIN
admin=$3 path=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
versionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}') # Source YunoHost helpers
. /usr/share/yunohost/helpers
# Save app settings
ynh_app_setting_set "$app" admin "$admin"
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a phpldapadmin sudo yunohost app checkurl "${domain}${path}" -a "$app" || ynh_die "Path not available: ${domain}${path}"
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Check that admin user is an existing account
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
if [[ ! $? -eq 0 ]]; then
echo "Error : the chosen admin user does not exist"
exit 1
fi
# Copy files to the right place # Copy files to the right place
version=$(cat upstream_version) version=$(cat upstream_version)
final_path=/var/www/phpldapadmin final_path=/var/www/$app
sudo rm -rf $final_path sudo rm -rf $final_path
sudo mkdir -p $final_path sudo mkdir -p $final_path
echo "Downloading phpLDAPadmin $version..." 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 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..." echo "Extracting to $final_path..."
sudo tar xvzf ../phpLDAPadmin.tar.gz -C .. > /dev/null 2>&1 sudo tar xvzf ../phpLDAPadmin.tar.gz -C .. > /dev/null 2>&1
sudo cp -r ../phpldapadmin-$version/* $final_path sudo cp -ar ../phpldapadmin-$version/. $final_path
# Patch 1.2.3 for Jessie (correct bug php 5.5) # Patch 1.2.3 for Jessie (correct bug php 5.5)
[ "$versionname" == "jessie" ] && [ "$version" == "1.2.3" ] && sudo wget http://www.jouvinio.net/wiki/images/f/f0/PhpLdapAdmin-1.2.3_patch.tar.gz 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
[ "$versionname" == "jessie" ] && [ "$version" == "1.2.3" ] && sudo tar -C $final_path/lib/ -xzvf PhpLdapAdmin-1.2.3_patch.tar.gz sudo tar -C $final_path/lib/ -xzvf PhpLdapAdmin-1.2.3_patch.tar.gz
# Configuration # Configuration
echo "Configuring application..." echo "Configuring application..."
sudo cp ../conf/config.php $final_path/config/ sudo cp ../conf/config.php $final_path/config/
sudo yunohost app addaccess phpldapadmin -u $admin sudo yunohost app addaccess $app -u $admin
sudo yunohost app setting phpldapadmin admin -v $admin sudo yunohost app setting $app admin -v $admin
# Files owned by root, www-data can just read # Files owned by root, www-data can just read
echo "Setting permission..." echo "Setting permission..."
@ -61,4 +56,4 @@ sudo chown root: $nginxconf
sudo chmod 600 $nginxconf sudo chmod 600 $nginxconf
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf #sudo yunohost app ssowatconf

View file

@ -1,7 +1,15 @@
#!/bin/bash #!/bin/bash
domain=$(sudo yunohost app setting phpldapadmin domain) # 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)
# Remove conf and app
sudo rm -rf /var/www/phpldapadmin sudo rm -rf /var/www/phpldapadmin
sudo rm -f /etc/nginx/conf.d/$domain.d/phpldapadmin.conf sudo rm -f /etc/nginx/conf.d/$domain.d/phpldapadmin.conf

View file

@ -1,30 +1,40 @@
#!/bin/bash #!/bin/bash
# Retrieve arguments # See comments in install script
domain=$(sudo yunohost app setting phpldapadmin domain) app=$YNH_APP_INSTANCE_NAME
path=$(sudo yunohost app setting phpldapadmin path)
admin=$(sudo yunohost app setting phpldapadmin admin) # 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)
# Remove trailing "/" for next commands # Remove trailing "/" for next commands
path=${path%/} path=${path%/}
# Copy files to the right place # Copy files to the right place
version=$(cat upstream_version) version=$(cat upstream_version)
final_path=/var/www/phpldapadmin final_path=/var/www/$app
sudo rm -rf $final_path sudo rm -rf $final_path
sudo mkdir -p $final_path sudo mkdir -p $final_path
echo "Downloading phpLDAPadmin $version..." 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 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..." echo "Extracting to $final_path..."
sudo tar xvzf ../phpLDAPadmin.tar.gz -C .. > /dev/null 2>&1 sudo tar xvzf ../phpLDAPadmin.tar.gz -C .. > /dev/null 2>&1
sudo cp -r ../phpldapadmin-$version/* $final_path 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
# Configuration # Configuration
echo "Configuring application..." echo "Configuring application..."
sudo cp ../conf/config.php $final_path/config/ sudo cp ../conf/config.php $final_path/config/
sudo yunohost app addaccess phpldapadmin -u $admin sudo yunohost app addaccess $app -u $admin
sudo yunohost app setting phpldapadmin admin -v $admin sudo yunohost app setting $app admin -v $admin
# Files owned by root, www-data can just read # Files owned by root, www-data can just read
echo "Setting permission..." echo "Setting permission..."
@ -45,4 +55,4 @@ sudo chown root: $nginxconf
sudo chmod 600 $nginxconf sudo chmod 600 $nginxconf
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf #sudo yunohost app ssowatconf