From aa7733a9accc47988a3a6732058fa0554e090b29 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Mon, 3 Jul 2017 15:05:22 +0200 Subject: [PATCH] [add] install Enigma plugin or not --- check_process | 1 + manifest.json | 9 +++++++++ scripts/backup | 1 + scripts/install | 8 ++++++++ scripts/restore | 1 + scripts/upgrade | 16 ++++++++++++++++ 6 files changed, 36 insertions(+) diff --git a/check_process b/check_process index b6daece..4713f8a 100644 --- a/check_process +++ b/check_process @@ -4,6 +4,7 @@ domain="domain.tld" (DOMAIN) path="/path" (PATH) with_carddav=1 + with_enigma=1 ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/manifest.json b/manifest.json index 44a52d0..7be80fa 100644 --- a/manifest.json +++ b/manifest.json @@ -51,6 +51,15 @@ "fr": "Installer le plugin de synchronisation CardDAV ?" }, "default": false + }, + { + "name": "with_enigma", + "type": "boolean", + "ask": { + "en": "Install Enigma encrypt message plugin?", + "fr": "Installer le plugin de chiffrement des messages Enigma ?" + }, + "default": false } ] } diff --git a/scripts/backup b/scripts/backup index fa50dd7..a763873 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,6 +13,7 @@ app=$YNH_APP_INSTANCE_NAME 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 diff --git a/scripts/install b/scripts/install index b2dd992..93f43c7 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,7 @@ dbpass=$(ynh_string_random) ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path 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 @@ -81,6 +82,13 @@ if [[ $with_carddav -eq 1 ]]; then || 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" \ + && installed_plugins+=" 'enigma'," \ + || echo "Unable to install Enigma plugin" >&2 +fi + # Update Roundcube configuration sudo sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \ "${final_path}/config/config.inc.php" diff --git a/scripts/restore b/scripts/restore index 75c17c8..6f6ccc1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME 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 diff --git a/scripts/upgrade b/scripts/upgrade index ca1ac79..89e8ce9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,6 +21,7 @@ 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 @@ -97,6 +98,21 @@ if [[ $with_carddav -eq 1 ]]; then || echo "Unable to install CardDAV plugin" >&2 fi +# Guess with_enigma value if empty +if [[ -z "${with_enigma:-}" ]]; then + [[ -f "${final_path}/plugins/enigma/config.inc.php" ]] \ + && with_enigma=1 \ + || with_enigma=0 + ynh_app_setting_set "$app" with_enigma "$with_enigma" +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" \ + && installed_plugins+=" 'enigma'," \ + || echo "Unable to install Enigma plugin" >&2 +fi + # Update Roundcube configuration sudo sed -i "s#^\s*// installed plugins#&\n ${installed_plugins}#" \ "$rc_conf"