1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00

Fix install+upgrade and refactoring

This commit is contained in:
Maniack Crudelis 2017-08-26 03:24:41 +02:00
parent 404b7a8ac5
commit 269500433b
10 changed files with 613 additions and 547 deletions

View file

@ -1,5 +1,4 @@
;; Test complet
auto_remove=1
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
@ -15,22 +14,22 @@
upgrade=1
backup_restore=1
multi_instance=1
wrong_user=1
wrong_path=1
incorrect_path=1
corrupt_source=0
fail_download_source=0
port_already_use=0
final_path_already_use=0
change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Niveau 4 à 1, mais c'est à confirmé par le mainteneur de l'application.
# https://github.com/YunoHost-Apps/roundcube_ynh/blob/master/conf/config.inc.php#L103-L118
Level 4=1
Level 5=auto
# https://github.com/YunoHost-Apps/roundcube_ynh/issues/10
Level 5=1
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options
Email=
Notification=none

View file

@ -10,8 +10,8 @@
"license": "GPL-3",
"version": "1.3.0",
"maintainer": {
"name": "-",
"email": "-"
"name": "YunoHost Contributors",
"email": "apps@yunohost.org"
},
"multi_instance": true,
"services": [
@ -20,7 +20,7 @@
"mysql"
],
"requirements": {
"yunohost": ">= 2.4.0"
"yunohost": ">= 2.6.4"
},
"arguments": {
"install" : [

View file

@ -1,35 +0,0 @@
--- a/bin/installto.sh
+++ b/bin/installto.sh
@@ -38,13 +38,15 @@ if (!preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)/', $iniset, $m))
$oldversion = $m[1];
-if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>='))
+if (version_compare(version_parse($oldversion), version_parse(RCMAIL_VERSION), '>=') && !opts['force'])
rcube::raise_error("Installation at target location is up-to-date!", false, true);
-echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
-$input = trim(fgets(STDIN));
+if (!opts['accept']) {
+ echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
+ $input = trim(fgets(STDIN));
+}
-if (strtolower($input) == 'y') {
+if ($opts['accept'] || strtolower($input) == 'y') {
echo "Copying files to target location...";
// Save a copy of original .htaccess file (#1490623)
@@ -99,7 +101,11 @@ if (strtolower($input) == 'y') {
}
echo "Running update script at target...\n";
- system("cd $target_dir && php bin/update.sh --version=$oldversion");
+ $command = "cd $target_dir && php bin/update.sh --version=$oldversion";
+ if ($opts['accept']) {
+ $command .= " --accept";
+ }
+ system($command);
echo "All done.\n";
}
else {

View file

@ -1,87 +1,66 @@
#
# Common variables
#
# =============================================================================
# COMMON VARIABLES
# =============================================================================
# Package dependencies
PKG_DEPENDENCIES="php5-cli php5-common php5-intl php5-json php5-mcrypt php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 php-net-smtp php-net-socket php-crypt-gpg php-net-ldap2 php-net-ldap3"
pkg_dependencies="php5-cli php5-common php5-intl php5-json php5-mcrypt php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 php-net-smtp php-net-socket php-crypt-gpg php-net-ldap2 php-net-ldap3"
# App package root directory should be the parent folder
PKGDIR=$(cd ../; pwd)
# Plugins version
contextmenu_version=2.3
automatic_addressbook_version=v0.4.3
carddav_version=2.0.4
QUIET () { # Redirect standard out into /dev/null
$@ > /dev/null
}
WARNING () { # Writes on the error channel to go into warning.
eval "$@" >&2
}
#
# Common helpers
#
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval $@
else
# use sudo twice to be root and be allowed to use another user
sudo sudo -u "$USER" $@
fi
}
# =============================================================================
# COMMON ROUNDCUBE FUNCTIONS
# =============================================================================
# Execute a composer command from a given directory
# usage: composer_exec AS_USER WORKDIR COMMAND [ARG ...]
# usage: composer_exec workdir COMMAND [ARG ...]
exec_composer() {
local AS_USER=$1
local WORKDIR=$2
shift 2
local workdir=$1
shift 1
exec_as "$AS_USER" COMPOSER_HOME="${WORKDIR}/.composer" \
php "${WORKDIR}/composer.phar" $@ \
-d "${WORKDIR}" --quiet --no-interaction
COMPOSER_HOME="${workdir}/.composer" \
php "${workdir}/composer.phar" $@ \
-d "${workdir}" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
# usage: init_composer DESTDIR [AS_USER]
# usage: init_composer destdir
init_composer() {
local DESTDIR=$1
local AS_USER=${2:-admin}
local destdir=$1
# install composer
curl -sS https://getcomposer.org/installer \
| exec_as "$AS_USER" COMPOSER_HOME="${DESTDIR}/.composer" \
php -- --quiet --install-dir="$DESTDIR" \
| COMPOSER_HOME="${destdir}/.composer" \
php -- --quiet --install-dir="$destdir" \
|| ynh_die "Unable to install Composer"
# install composer.json
exec_as "$AS_USER" \
cp "${DESTDIR}/composer.json-dist" "${DESTDIR}/composer.json"
cp "${destdir}/composer.json-dist" "${destdir}/composer.json"
# update dependencies to create composer.lock
exec_composer "$AS_USER" "$DESTDIR" install --no-dev \
exec_composer "$destdir" install --no-dev \
|| ynh_die "Unable to update Roundcube core dependencies"
}
# Install and configure CardDAV plugin for Roundcube
# usage: install_carddav DESTDIR [AS_USER]
# usage: install_carddav destdir
# https://plugins.roundcube.net/packages/roundcube/carddav
install_carddav() {
local DESTDIR=$1
local AS_USER=${2:-admin}
local destdir=$1
local carddav_config="${DESTDIR}/plugins/carddav/config.inc.php"
local carddav_tmp_config="${PKGDIR}/conf/carddav.config.inc.php"
local carddav_config="${destdir}/plugins/carddav/config.inc.php"
local carddav_tmp_config="../conf/carddav.config.inc.php"
exec_composer "$AS_USER" "$DESTDIR" require \
"roundcube/carddav dev-master"
exec_composer "$destdir" require \
"roundcube/carddav $carddav_version"
# Look for installed and supported CardDAV servers
for carddav_app in "owncloud" "baikal"; do
local app_id=$(sudo yunohost app list --installed -f "$carddav_app" \
local app_id=$(yunohost app list --installed -f "$carddav_app" \
--output-as json | grep -Po '"id":[ ]?"\K.*?(?=")' | head -1)
[[ -z "$app_id" ]] || {
# Retrieve app settings and enable relevant preset
@ -96,210 +75,149 @@ install_carddav() {
done
# Copy plugin the configuration file
sudo cp "$carddav_tmp_config" "$carddav_config"
sudo chown "${AS_USER}:" "$carddav_config"
cp "$carddav_tmp_config" "$carddav_config"
}
# Normalize the url path syntax
# Handle the slash at the beginning of path and its absence at ending
# Return a normalized url path
# =============================================================================
# YUNOHOST 2.7 FORTHCOMING HELPERS
# =============================================================================
# Create a dedicated nginx config
#
# example: url_path=$(ynh_normalize_url_path $url_path)
# ynh_normalize_url_path example -> /example
# ynh_normalize_url_path /example -> /example
# ynh_normalize_url_path /example/ -> /example
# ynh_normalize_url_path / -> /
# This will use a template in ../conf/nginx.conf
# __PATH__ by $path_url
# __DOMAIN__ by $domain
# __PORT__ by $port
# __NAME__ by $app
# __FINALPATH__ by $final_path
#
# usage: ynh_normalize_url_path path_to_normalize
# | arg: url_path_to_normalize - URL path to normalize before using it
ynh_normalize_url_path () {
path_url=$1
test -n "$path_url" || ynh_die "ynh_normalize_url_path expect a URL path as first argument and received nothing."
if [ "${path_url:0:1}" != "/" ]; then # If the first character is not a /
path_url="/$path_url" # Add / at begin of path variable
fi
if [ "${path_url:${#path_url}-1}" == "/" ] && [ ${#path_url} -gt 1 ]; then # If the last character is a / and that not the only character.
path_url="${path_url:0:${#path_url}-1}" # Delete the last character
fi
echo $path_url
# usage: ynh_add_nginx_config
ynh_add_nginx_config () {
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalnginxconf"
sudo cp ../conf/nginx.conf "$finalnginxconf"
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
# Substitute in a nginx config file only if the variable is not empty
if test -n "${path_url:-}"; then
ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf"
fi
if test -n "${domain:-}"; then
ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf"
fi
if test -n "${port:-}"; then
ynh_replace_string "__PORT__" "$port" "$finalnginxconf"
fi
if test -n "${app:-}"; then
ynh_replace_string "__NAME__" "$app" "$finalnginxconf"
fi
if test -n "${final_path:-}"; then
ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf"
fi
ynh_store_file_checksum "$finalnginxconf"
sudo systemctl reload nginx
}
# Add config nginx
ynh_nginx_config () {
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_compare_checksum_config "$finalnginxconf" 1
sudo cp ../conf/nginx.conf "$finalnginxconf"
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
# Substitute in a nginx config file only if the variable is not empty
if test -n "${path:-}"; then
ynh_substitute_char "__PATH__" "$path" "$finalnginxconf"
fi
if test -n "${domain:-}"; then
ynh_substitute_char "__DOMAIN__" "$domain" "$finalnginxconf"
fi
if test -n "${port:-}"; then
ynh_substitute_char "__PORT__" "$port" "$finalnginxconf"
fi
if test -n "${app:-}"; then
ynh_substitute_char "__NAME__" "$app" "$finalnginxconf"
fi
if test -n "${final_path:-}"; then
ynh_substitute_char "__FINALPATH__" "$final_path" "$finalnginxconf"
fi
ynh_store_checksum_config "$finalnginxconf"
sudo systemctl reload nginx
}
# Remove config nginx
# Remove the dedicated nginx config
#
# usage: ynh_remove_nginx_config
ynh_remove_nginx_config () {
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
sudo systemctl reload nginx
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
sudo systemctl reload nginx
}
ynh_fpm_config () {
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
ynh_compare_checksum_config "$finalphpconf" 1
sudo cp ../conf/php-fpm.conf "$finalphpconf"
ynh_substitute_char "__NAMETOCHANGE__" "$app" "$finalphpconf"
ynh_substitute_char "__FINALPATH__" "$final_path" "$finalphpconf"
ynh_substitute_char "__USER__" "$app" "$finalphpconf"
sudo chown root: "$finalphpconf"
ynh_store_checksum_config "$finalphpconf"
# Create a dedicated php-fpm config
#
# usage: ynh_add_fpm_config
ynh_add_fpm_config () {
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalphpconf"
sudo cp ../conf/php-fpm.conf "$finalphpconf"
ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
ynh_replace_string "__USER__" "$app" "$finalphpconf"
sudo chown root: "$finalphpconf"
ynh_store_file_checksum "$finalphpconf"
if [ -e "../conf/php-fpm.ini" ]
then
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
ynh_compare_checksum_config "$finalphpini" 1
sudo cp ../conf/php-fpm.ini "$finalphpini"
sudo chown root: "$finalphpini"
ynh_store_checksum_config "$finalphpini"
fi
if [ -e "../conf/php-fpm.ini" ]
then
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
ynh_backup_if_checksum_is_different "$finalphpini"
sudo cp ../conf/php-fpm.ini "$finalphpini"
sudo chown root: "$finalphpini"
ynh_store_file_checksum "$finalphpini"
fi
sudo systemctl reload php5-fpm
sudo systemctl reload php5-fpm
}
# Remove the dedicated php-fpm config
#
# usage: ynh_remove_fpm_config
ynh_remove_fpm_config () {
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini"
sudo systemctl reload php5-fpm
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1
sudo systemctl reload php5-fpm
}
ynh_compare_checksum_config () {
current_config_file=$1
compress_backup=${2:-0} # If $2 is empty, compress_backup will set at 0
config_file_checksum=checksum_${current_config_file//[\/ ]/_} # Replace all '/' and ' ' by '_'
checksum_value=$(ynh_app_setting_get $app $config_file_checksum)
if [ -n "$checksum_value" ]
then # Proceed only if a value was stocked into the app config
if ! echo "$checksum_value $current_config_file" | md5sum -c --status
then # If the checksum is now different
backup_config_file="$current_config_file.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')"
if [ compress_backup -eq 1 ]
then
sudo tar --create --gzip --file "$backup_config_file.tar.gz" "$current_config_file" # Backup the current config file and compress
backup_config_file="$backup_config_file.tar.gz"
else
sudo cp -a "$current_config_file" "$backup_config_file" # Backup the current config file
fi
echo "Config file $current_config_file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_config_file" >&2
echo "$backup_config_file" # Return the name of the backup file
fi
fi
}
# Substitute a string by another in a file
# Restore a previous backup if the upgrade process failed
#
# usage: ynh_substitute_char string_to_find replace_string file_to_analyse
# | arg: string_to_find - String to replace in the file
# | arg: replace_string - New string that will replace
# | arg: file_to_analyse - File where the string will be replaced.
ynh_substitute_char () {
delimit=@
match_char=${1//${delimit}/"\\${delimit}"} # Escape the delimiter if it's in the string.
replace_char=${2//${delimit}/"\\${delimit}"}
workfile=$3
sudo sed --in-place "s${delimit}${match_char}${delimit}${replace_char}${delimit}g" "$workfile"
}
ynh_store_checksum_config () {
config_file_checksum=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
ynh_app_setting_set $app $config_file_checksum $(sudo md5sum "$1" | cut -d' ' -f1)
}
ynh_backup_fail_upgrade () {
WARNING echo "Upgrade failed."
app_bck=${app//_/-} # Replace all '_' by '-'
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$backup_number; then # Vérifie l'existence de l'archive avant de supprimer l'application et de restaurer
sudo yunohost app remove $app # Supprime l'application avant de la restaurer.
sudo yunohost backup restore --ignore-hooks $app_bck-pre-upgrade$backup_number --apps $app --force # Restore the backup if upgrade failed
ynh_die "The app was restored to the way it was before the failed upgrade."
fi
}
ynh_backup_before_upgrade () { # Backup the current version of the app, restore it if the upgrade fails
backup_number=1
old_backup_number=2
app_bck=${app//_/-} # Replace all '_' by '-'
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade1; then # Vérifie l'existence d'une archive déjà numéroté à 1.
backup_number=2 # Et passe le numéro de l'archive à 2
old_backup_number=1
fi
sudo yunohost backup create --ignore-hooks --apps $app --name $app_bck-pre-upgrade$backup_number # Créer un backup différent de celui existant.
if [ "$?" -eq 0 ]; then # Si le backup est un succès, supprime l'archive précédente.
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$old_backup_number; then # Vérifie l'existence de l'ancienne archive avant de la supprimer, pour éviter une erreur.
QUIET sudo yunohost backup delete $app_bck-pre-upgrade$old_backup_number
fi
else # Si le backup a échoué
ynh_die "Backup failed, the upgrade process was aborted."
fi
}
# Manage a fail of the script
#
# Print a warning to inform that the script was failed
# Execute the ynh_clean_setup function if used in the app script
#
# usage of ynh_clean_setup function
# This function provide a way to clean some residual of installation that not managed by remove script.
# To use it, simply add in your script:
# usage:
# ynh_backup_before_upgrade
# ynh_clean_setup () {
# instructions...
# ynh_restore_upgradebackup
# }
# This function is optionnal.
# ynh_abort_if_errors
#
# Usage: ynh_exit_properly is used only by the helper ynh_check_error.
# You must not use it directly.
ynh_exit_properly () {
exit_code=$?
if [ "$exit_code" -eq 0 ]; then
ynh_die # Exit without error if the script ended correctly
fi
trap '' EXIT # Ignore new exit signals
set +eu # Do not exit anymore if a command fail or if a variable is empty
echo -e "!!\n $app's script has encountered an error. Its execution was cancelled.\n!!" >&2
if type -t ynh_clean_setup > /dev/null; then # Check if the function exist in the app script.
ynh_clean_setup # Call the function to do specific cleaning for the app.
fi
ynh_die # Exit with error status
ynh_restore_upgradebackup () {
echo "Upgrade failed." >&2
app_bck=${app//_/-} # Replace all '_' by '-'
# Check if an existing backup can be found before removing and restoring the application.
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$backup_number
then
# Remove the application then restore it
sudo yunohost app remove $app
# Restore the backup
sudo yunohost backup restore --ignore-system $app_bck-pre-upgrade$backup_number --apps $app --force
ynh_die "The app was restored to the way it was before the failed upgrade."
fi
}
# Exit if an error occurs during the execution of the script.
# Make a backup in case of failed upgrade
#
# Stop immediatly the execution if an error occured or if a empty variable is used.
# The execution of the script is derivate to ynh_exit_properly function before exit.
# usage:
# ynh_backup_before_upgrade
# ynh_clean_setup () {
# ynh_restore_upgradebackup
# }
# ynh_abort_if_errors
#
# Usage: ynh_abort_if_errors
ynh_abort_if_errors () {
set -eu # Exit if a command fail, and if a variable is used unset.
trap ynh_exit_properly EXIT # Capturing exit signals on shell script
}
ynh_backup_before_upgrade () {
backup_number=1
old_backup_number=2
app_bck=${app//_/-} # Replace all '_' by '-'
# Check if a backup already exists with the prefix 1
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade1
then
# Prefix becomes 2 to preserve the previous backup
backup_number=2
old_backup_number=1
fi
# Create backup
sudo yunohost backup create --ignore-system --apps $app --name $app_bck-pre-upgrade$backup_number
if [ "$?" -eq 0 ]
then
# If the backup succeeded, remove the previous backup
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$old_backup_number
then
# Remove the previous backup only if it exists
sudo yunohost backup delete $app_bck-pre-upgrade$old_backup_number > /dev/null
fi
else
ynh_die "Backup failed, the upgrade process was aborted."
fi
}

View file

@ -1,32 +1,59 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
#=================================================
# GENERIC START
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit on command errors and treat access to unset variables as an error
set -eu
# Get multi-instances specific variables
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
# Source app helpers
. /usr/share/yunohost/helpers
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
with_carddav=$(ynh_app_setting_get "$app" with_carddav)
with_enigma=$(ynh_app_setting_get "$app" with_enigma)
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
dbname=$app
dbuser=$app
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
# Copy the app files
finalpath="/var/www/$app"
ynh_backup "$finalpath" "sources"
ynh_backup "$final_path" "${YNH_APP_BACKUP_DIR}$final_path"
# Copy the nginx conf files
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
# Copy the php-fpm conf files
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-${app}.ini" "php-fpm.ini"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
# Dump the database
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/pool.d/$app.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/conf.d/20-$app.ini"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_mysql_dump_db "$db_name" > db.sql

View file

@ -1,118 +1,189 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source app helpers
source ./_common.sh
source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
path_url=$YNH_APP_ARG_PATH
with_carddav=$YNH_APP_ARG_WITH_CARDDAV
with_enigma=$YNH_APP_ARG_WITH_ENIGMA
# Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
app=$YNH_APP_INSTANCE_NAME
# Set app specific variables
dbname=$app
dbuser=$app
# Generate random DES key & password
deskey=$(ynh_string_random 24)
dbpass=$(ynh_string_random)
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
# Save app settings
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path
ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app with_carddav $with_carddav
ynh_app_setting_set $app with_enigma $with_enigma
# Check destination directory
final_path=/var/www/$app
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
# FIXME: jessie-backports is needed for php-net-ldap3
# jessie-backports is needed for php-net-ldap3
grep -q -R 'jessie-backports' /etc/apt/sources.list{,.d} || {
echo "deb http://httpredir.debian.org/debian jessie-backports main" \
| sudo tee -a /etc/apt/sources.list.d/backports.list >/dev/null
| tee -a /etc/apt/sources.list.d/backports.list >/dev/null
}
# Install dependencies
ynh_install_app_dependencies "$PKG_DEPENDENCIES"
ynh_install_app_dependencies "$pkg_dependencies"
# Create system user dedicace for this app
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
ynh_mysql_setup_db $db_name $db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
# Create a system user
ynh_system_user_create $app
# Create final_path directory and install app inside
sudo mkdir -p $final_path
ynh_setup_source "${final_path}"
# Change owner by admin for execute composer
sudo chown -R admin: "${final_path}"
init_composer "${final_path}"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
# Initialize database
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" \
# Create a dedicated php-fpm config
ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
init_composer "$final_path"
#=================================================
# INITIALIZE DATABASE
#=================================================
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" \
< "${final_path}/SQL/mysql.initial.sql"
# Copy and set Roundcube configuration
#=================================================
# CONFIGURE ROUNDCUBE
#=================================================
rc_conf="${final_path}/config/config.inc.php"
cp ../conf/config.inc.php "$rc_conf"
ynh_substitute_char "#DESKEY#" "$deskey" "$rc_conf"
ynh_substitute_char "#DBUSER#" "$dbuser" "$rc_conf"
ynh_substitute_char "#DBPASS#" "$dbpass" "$rc_conf"
ynh_substitute_char "#DBNAME#" "$dbname" "$rc_conf"
# Install files and set permissions
sudo mkdir -p "${final_path}/logs" "${final_path}/temp"
ynh_replace_string "#DESKEY#" "$(ynh_string_random 24)" "$rc_conf"
ynh_replace_string "#DBUSER#" "$db_name" "$rc_conf"
ynh_replace_string "#DBPASS#" "$db_pwd" "$rc_conf"
ynh_replace_string "#DBNAME#" "$db_name" "$rc_conf"
# Install additional plugins
exec_composer admin "$final_path" require \
"johndoh/contextmenu dev-master" \
"sblaisot/automatic_addressbook dev-master"
#=================================================
# INSTALL ADDITIONAL PLUGINS
#=================================================
# Create logs and temp directories
mkdir -p "${final_path}/logs" "${final_path}/temp"
# Install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu
exec_composer "$final_path" require \
"johndoh/contextmenu $contextmenu_version" \
"sblaisot/automatic_addressbook $automatic_addressbook_version"
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
# Install CardDAV plugin
if [[ $with_carddav -eq 1 ]]; then
install_carddav "$final_path" admin \
install_carddav "$final_path" \
&& installed_plugins+=" 'carddav'," \
|| echo "Unable to install CardDAV plugin" >&2
fi
# Install Enigma plugin
if [[ $with_enigma -eq 1 ]]; then
sudo cp -a "$final_path/plugins/enigma/config.inc.php.dist" "$final_path/plugins/enigma/config.inc.php" \
cp -a "$final_path/plugins/enigma/config.inc.php.dist" "$final_path/plugins/enigma/config.inc.php" \
&& installed_plugins+=" 'enigma'," \
|| echo "Unable to install Enigma plugin" >&2
fi
# Update Roundcube configuration
sudo sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \
#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \
"${final_path}/config/config.inc.php"
# Update javascript dependencies
pushd ${final_path}
sudo /usr/bin/php -q ./bin/install-jsdeps.sh
popd
(cd "${final_path}"
/usr/bin/php -q ./bin/install-jsdeps.sh)
# Change owner final_path directory
sudo chown -R root: "${final_path}"
sudo chown -R $app: "${final_path}/temp/" "${final_path}/logs/"
# Store the config file checksum into the app settings
ynh_store_file_checksum "${final_path}/config/config.inc.php"
# Modify Nginx configuration file and copy it to Nginx conf directory
ynh_nginx_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Create the php-fpm pool config
ynh_fpm_config
# Set permissions to app files
chown -R root: "$final_path"
chown -R $app: "${final_path}/temp/" "${final_path}/logs/"
# Save app settings
ynh_app_setting_set "$app" with_carddav "$with_carddav"
ynh_app_setting_set "$app" mysqlpwd "$dbpass"
#=================================================
# RELOAD NGINX
#=================================================
# Reload services
sudo systemctl restart php5-fpm
sudo systemctl reload nginx
systemctl reload nginx

View file

@ -1,7 +1,10 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -u
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get file fonction if not been to the current directory
@ -9,31 +12,68 @@ if [ ! -e _common.sh ]; then
sudo chmod a+rx _common.sh
fi
# Source app helpers
source ./_common.sh
source _common.sh
source /usr/share/yunohost/helpers
# Get multi-instances specific variables
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(ynh_app_setting_get "$app" domain)
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
# Drop MySQL database and user
dbname=$app
dbuser=$app
ynh_mysql_drop_db "$dbname" 2>&1 || true
ynh_mysql_drop_user "$dbuser" 2>&1 || true
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_secure_remove /var/www/$app
ynh_secure_remove /etc/nginx/conf.d/$domain.d/$app.conf
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Remove the app directory securely
ynh_secure_remove "/var/www/$app"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
ynh_system_user_delete $app
#=================================================
# SPECIFIC REMOVE
#=================================================
sudo systemctl reload nginx
# Remove app dependencies
ynh_remove_app_dependencies
# The following command is kept as a matter of transition with the previous way
# of managing dependencies
ynh_package_autoremove "roundcube-ynh-deps" || true
ynh_package_autoremove "roundcube-ynh-deps" || true
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
# Delete a system user
ynh_system_user_delete $app

View file

@ -1,79 +1,95 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
#=================================================
# GENERIC START
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit on command errors and treat access to unset variables as an error
set -eu
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get file fonction if not been to the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
# Loads the generic functions usually used in the script
source _common.sh
# Source app helpers
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
with_carddav=$(ynh_app_setting_get "$app" with_carddav)
with_enigma=$(ynh_app_setting_get "$app" with_enigma)
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
dbname=$app
dbuser=$app
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
# Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
# Check $final_path
final_path="/var/www/${app}"
if [ -d $final_path ]; then
ynh_die "There is already a directory: $final_path"
fi
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
# Check configuration files
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
if [ -f $nginx_conf ]; then
ynh_die "The NGINX configuration already exists at '${nginx_conf}'.
You should safely delete it before restoring this app."
fi
# Check configuration files php-fpm
phpfpm_conf="/etc/php5/fpm/pool.d/${app}.conf"
if [ -f $phpfpm_conf ]; then
ynh_die "The PHP FPM configuration already exists at '${phpfpm_conf}'.
You should safely delete it before restoring this app."
fi
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
phpfpm_ini="/etc/php5/fpm/conf.d/20-${app}.ini"
if [ -f $phpfpm_ini ]; then
ynh_die "The PHP FPM INI configuration already exists at '${phpfpm_ini}'.
You should safely delete it before restoring this app."
fi
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
# Create system user dedicace for this app
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_restore_file "$final_path"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
# Create the dedicated user (if not existing)
ynh_system_user_create $app
# Restore sources & data
sudo cp -a "./sources" $final_path
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Set permissions
sudo chown -R $app: $final_path
# Restore permissions on app files
chown -R root: "$final_path"
chown -R $app: "${final_path}/temp/" "${final_path}/logs/"
# Create and restore the database
ynh_mysql_create_db $dbname $dbuser $dbpass
ynh_mysql_connect_as $dbuser $dbpass $dbname < ./dump.sql
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
# Restore configuration files
sudo cp -a ./nginx.conf "${nginx_conf}"
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
# Restore php-fpm configuration files
sudo cp -a ./php-fpm.conf "${phpfpm_conf}"
sudo cp -a ./php-fpm.ini "${phpfpm_ini}"
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
# Reload service
sudo systemctl reload php5-fpm
sudo systemctl reload nginx
sudo yunohost app ssowatconf
systemctl reload php5-fpm
systemctl reload nginx

View file

@ -1,88 +1,145 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -eu
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get file fonction if not been to the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
fi
# Loads the generic functions usually used in the script
source _common.sh
# Source app helpers
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
path=${path%/}
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
with_carddav=$(ynh_app_setting_get "$app" with_carddav)
with_enigma=$(ynh_app_setting_get "$app" with_enigma)
dbname=$app
dbuser=$app
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name)
with_carddav=$(ynh_app_setting_get $app with_carddav)
with_enigma=$(ynh_app_setting_get $app with_enigma)
ynh_backup_before_upgrade # Backup the current version of the app
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_backup_before_upgrade # Backup the current version of the app
ynh_clean_setup () {
ynh_backup_fail_upgrade # restore it if the upgrade fails
ynh_restore_upgradebackup # restore it if the upgrade fails
}
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
# Init final_path, if ever it got deleted somehow
final_path=/var/www/$app
#=================================================
# CHECK THE PATH
#=================================================
# FIXME: jessie-backports is needed for php-net-ldap3
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
# jessie-backports is needed for php-net-ldap3
grep -q -R 'jessie-backports' /etc/apt/sources.list{,.d} || {
echo "deb http://httpredir.debian.org/debian jessie-backports main" \
| sudo tee -a /etc/apt/sources.list.d/backports.list >/dev/null
| tee -a /etc/apt/sources.list.d/backports.list >/dev/null
}
# Install dependencies
ynh_install_app_dependencies "$PKG_DEPENDENCIES"
ynh_install_app_dependencies "$pkg_dependencies"
# Create system user dedicace for this app
#=================================================
# CREATE DEDICATED USER
#=================================================
# Create a system user
ynh_system_user_create $app
# Create final_path directory and install app inside
sudo mkdir -p $final_path
ynh_setup_source "${final_path}"
# Change owner by admin for execute composer
sudo chown -R admin: "${final_path}"
# init_composer "${final_path}" admin
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Install the new Roundcube version
pushd "${final_path}"
sudo /usr/bin/php -q ./bin/installto.sh "${final_path}" || true
popd
# Get the current version of roundcube
oldversion=$(grep RCMAIL_VERSION "$final_path/program/include/iniset.php" | cut -d\' -f4)
# Generate a new random DES key
deskey=$(ynh_string_random 24)
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
# Create a dedicated php-fpm config
ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# INSTALL THE NEW ROUNDCUBE VERSION
#=================================================
# Verify the checksum and backup the file if it's different
ynh_store_file_checksum "${final_path}/config/config.inc.php"
# Get the new version of roundcube
newversion=$(grep RCMAIL_VERSION "$final_path/program/include/iniset.php" | cut -d\' -f4)
# Do the upgrade only if it's really needed
if [ "$newversion" != "$oldversion" ]
then
(cd "$final_path"
/usr/bin/php -q ./bin/installto.sh "${final_path}")
fi
#=================================================
# CONFIGURE ROUNDCUBE
#=================================================
# Copy and set Roundcube configuration
rc_conf="${final_path}/config/config.inc.php"
cp ../conf/config.inc.php "$rc_conf"
ynh_substitute_char "#DESKEY#" "$deskey" "$rc_conf"
ynh_substitute_char "#DBUSER#" "$dbuser" "$rc_conf"
ynh_substitute_char "#DBPASS#" "$dbpass" "$rc_conf"
ynh_substitute_char "#DBNAME#" "$dbname" "$rc_conf"
ynh_replace_string "#DESKEY#" "$(ynh_string_random 24)" "$rc_conf"
ynh_replace_string "#DBUSER#" "$db_name" "$rc_conf"
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_replace_string "#DBPASS#" "$db_pwd" "$rc_conf"
ynh_replace_string "#DBNAME#" "$db_name" "$rc_conf"
# Install files and set permissions
sudo mkdir -p "${final_path}/logs" "${final_path}/temp"
#=================================================
# UPDATE DEPENDENCIES WITH COMPOSER
#=================================================
# Check if dependencies need to be updated with composer
if [[ -f ${final_path}/composer.json ]]; then
exec_composer admin "${final_path}" update --no-dev --prefer-dist
exec_composer "${final_path}" update --no-dev --prefer-dist
else
init_composer "${final_path}" admin
init_composer "${final_path}"
fi
# Update or install additional plugins
exec_composer admin "${final_path}" update --no-dev --prefer-dist \
"johndoh/contextmenu dev-master" \
"sblaisot/automatic_addressbook dev-master"
#=================================================
# UPGRADE ADDITIONAL PLUGINS
#=================================================
# Create logs and temp directories
mkdir -p "${final_path}/logs" "${final_path}/temp"
# Update or install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu
exec_composer "${final_path}" update --no-dev --prefer-dist \
"johndoh/contextmenu $contextmenu_version" \
"sblaisot/automatic_addressbook $automatic_addressbook_version"
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
# Guess with_carddav value if empty
@ -95,7 +152,7 @@ fi
# Update or install CardDAV plugin
if [[ $with_carddav -eq 1 ]]; then
install_carddav "${final_path}" admin \
install_carddav "${final_path}" \
&& installed_plugins+=" 'carddav'," \
|| echo "Unable to install CardDAV plugin" >&2
fi
@ -115,24 +172,32 @@ if [[ $with_enigma -eq 1 ]]; then
|| echo "Unable to install Enigma plugin" >&2
fi
# Update Roundcube configuration
sudo sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \
#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \
"$rc_conf"
# Update javascript dependencies
pushd ${final_path}
sudo /usr/bin/php -q ./bin/install-jsdeps.sh
popd
( cd "${final_path}"
/usr/bin/php -q ./bin/install-jsdeps.sh)
# Owner user app
sudo chown -R root: "${final_path}"
sudo chown -R $app: "${final_path}/temp/" "${final_path}/logs/"
# Store the config file checksum into the app settings
ynh_store_file_checksum "${final_path}/config/config.inc.php"
# Modify Nginx configuration file and copy it to Nginx conf directory
ynh_nginx_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Create the php-fpm pool config
ynh_fpm_config
# Set permissions to app files
chown -R root: "$final_path"
chown -R $app: "${final_path}/temp/" "${final_path}/logs/"
# Reload services
sudo systemctl reload nginx
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx

View file

@ -1,35 +0,0 @@
{
"name": "roundcube/roundcubemail",
"description": "The Roundcube Webmail suite",
"license": "GPL-3.0+",
"repositories": [
{
"type": "composer",
"url": "https://plugins.roundcube.net/"
},
{
"type": "vcs",
"url": "https://git.kolab.org/diffusion/PNL/php-net_ldap.git"
}
],
"require": {
"php": ">=5.4.0",
"pear/pear-core-minimal": "~1.10.1",
"pear/net_socket": "~1.2.1",
"pear/auth_sasl": "~1.1.0",
"pear/net_idna2": "~0.2.0",
"pear/mail_mime": "~1.10.0",
"pear/net_smtp": "~1.7.1",
"pear/crypt_gpg": "~1.6.0",
"pear/net_sieve": "~1.4.0",
"roundcube/plugin-installer": "~0.1.6",
"endroid/qrcode": "~1.6.5"
},
"require-dev": {
"phpunit/phpunit": "~5.7.15"
},
"suggest": {
"pear/net_ldap2": "~2.2.0 required for connecting to LDAP",
"kolab/Net_LDAP3": "dev-master required for connecting to LDAP"
}
}