1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00
This commit is contained in:
Éric Gaspar 2024-05-21 14:06:08 +02:00
parent 322a2f038f
commit a399599a89
10 changed files with 12 additions and 439 deletions

View file

@ -1,16 +0,0 @@
$prefs['{baikal_id}'] = array(
// required attributes
'name' => '{baikal_id}',
'username' => '%u',
'password' => '%p',
'url' => '{baikal_url}/card.php/addressbooks/%u/',
// optional attributes
'active' => true,
'readonly' => false,
'refresh_time' => '00:05:00',
'fixed' => array('username', 'password'),
'hide' => false,
);

View file

@ -1,36 +0,0 @@
{
"name": "roundcube/roundcubemail",
"description": "The Roundcube Webmail suite",
"license": "GPL-3.0-or-later",
"repositories": [
{
"type": "composer",
"url": "https://plugins.roundcube.net"
}
],
"require": {
"php": ">=7.3.0",
"pear/pear-core-minimal": "~1.10.1",
"pear/auth_sasl": "~1.1.0",
"pear/mail_mime": "~1.10.0",
"pear/net_smtp": "~1.10.0",
"pear/crypt_gpg": "~1.6.3",
"pear/net_sieve": "~1.4.5",
"roundcube/plugin-installer": "~0.3.1",
"roundcube/rtf-html-php": "~2.1",
"roundcube/carddav": "~5.1.0",
"masterminds/html5": "~2.7.0",
"bacon/bacon-qr-code": "^2.0.0",
"guzzlehttp/guzzle": "^7.3.0",
"kolab/net_ldap3": "~1.1.4",
"sblaisot/automatic_addressbook": "~v0.4.3"
},
"suggest": {
"bjeavons/zxcvbn-php": "^1.0 required for Zxcvbn password strength driver"
},
"config": {
"allow-plugins": {
"roundcube/plugin-installer": true
}
}
}

View file

@ -1,77 +0,0 @@
<?php
// Enigma Plugin options
// --------------------
// A driver to use for PGP. Default: "gnupg".
$config['enigma_pgp_driver'] = 'gnupg';
// A driver to use for S/MIME. Default: "phpssl".
$config['enigma_smime_driver'] = 'phpssl';
// Enables logging of enigma operations (including Crypt_GPG debug info)
$config['enigma_debug'] = false;
// REQUIRED! Keys directory for all users.
// Must be writeable by PHP process, and not in the web server document root
$config['enigma_pgp_homedir'] = '__INSTALL_DIR__/plugins/enigma/home';
// Location of gpg binary. By default it will be auto-detected.
// This is also a way to force gpg2 use if there are both 1.x and 2.x on the system.
$config['enigma_pgp_binary'] = '';
// Location of gpg-agent binary. By default it will be auto-detected.
// It's used with GnuPG 2.x.
$config['enigma_pgp_agent'] = '';
// Location of gpgconf binary. By default it will be auto-detected.
// It's used with GnuPG >= 2.1.
$config['enigma_pgp_gpgconf'] = '';
// Name of the PGP symmetric cipher algorithm.
// Run gpg --version to see the list of supported algorithms
$config['enigma_pgp_cipher_algo'] = null;
// Name of the PGP digest (hash) algorithm.
// Run gpg --version to see the list of supported algorithms
$config['enigma_pgp_digest_algo'] = null;
// Enables multi-host environments support.
// Enable it if you have more than one HTTP server.
// Make sure all servers run the same GnuPG version and have time in sync.
// Keys will be stored in SQL database (make sure max_allowed_packet
// is big enough).
$config['enigma_multihost'] = false;
// Enables signatures verification feature.
$config['enigma_signatures'] = true;
// Enables messages decryption feature.
$config['enigma_decryption'] = true;
// Enables messages encryption and signing feature.
$config['enigma_encryption'] = true;
// Enable signing all messages by default
$config['enigma_sign_all'] = false;
// Enable encrypting all messages by default
$config['enigma_encrypt_all'] = false;
// Enable attaching a public key to all messages by default
$config['enigma_attach_pubkey'] = false;
// Default for how long to store private key passwords (in minutes).
// When set to 0 passwords will be stored for the whole session.
$config['enigma_password_time'] = 5;
// With this option you can lock composing options
// of the plugin forcing the user to use configured settings.
// The array accepts: 'sign', 'encrypt', 'pubkey'.
//
// For example, to force your users to sign every email,
// you should set:
// - enigma_sign_all = true
// - enigma_options_lock = array('sign')
// - dont_override = array('enigma_sign_all')
$config['enigma_options_lock'] = array();

View file

@ -1,16 +0,0 @@
$prefs['{nextcloud_id}'] = array(
// required attributes
'name' => '{nextcloud_id}',
'username' => '%u',
'password' => '%p',
'url' => '{nextcloud_url}/remote.php/dav/addressbooks/users/%u/contacts/',
// optional attributes
'active' => true,
'readonly' => false,
'refresh_time' => '00:05:00',
'fixed' => array('username', 'password'),
'hide' => false,
);

View file

@ -49,12 +49,6 @@ ram.runtime = "50M"
choices = ["de_DE", "en_GB", "fr_FR", "it_IT"]
default = "fr_FR"
[install.with_carddav]
ask.en = "Install CardDAV synchronization plugin?"
ask.fr = "Installer le plugin de synchronisation CardDAV ?"
type = "boolean"
default = false
[resources]
[resources.sources.main]
url = "https://github.com/roundcube/roundcubemail/releases/download/1.6.7/roundcubemail-1.6.7-complete.tar.gz"
@ -72,15 +66,15 @@ ram.runtime = "50M"
packages = [
"mariadb-server",
"php-pear",
"php8.2-ldap",
"php8.2-mysql",
"php8.2-cli",
"php8.2-intl",
"php8.2-zip",
"php8.2-gd",
"php8.2-mbstring",
"php8.2-dom",
"php8.2-curl",
"php8.3-ldap",
"php8.3-mysql",
"php8.3-cli",
"php8.3-intl",
"php8.3-zip",
"php8.3-gd",
"php8.3-mbstring",
"php8.3-dom",
"php8.3-curl",
]
[resources.database]

View file

@ -4,14 +4,6 @@
# COMMON VARIABLES
#=================================================
# Composer version
YNH_COMPOSER_VERSION=2.7.6
# Plugins version
contextmenu_version=3.3.1
automatic_addressbook_version=v0.4.3
carddav_version=5.1.0
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -9,23 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
fpm_footprint="low"
fpm_free_footprint=0
fpm_usage="low"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -46,20 +29,7 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
ynh_add_nginx_config
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
ynh_script_progression --message="Installing Roundcube with Composer..." --weight=30
# Install composer.json
ynh_add_config --template="$install_dir/composer.json-dist" --destination="$install_dir/composer.json"
# Install composer
ynh_install_composer
ynh_add_fpm_config
#=================================================
# INITIALIZE DATABASE
@ -76,84 +46,6 @@ ynh_script_progression --message="Configuring $app..." --weight=2
deskey=$(ynh_string_random --length=24)
ynh_add_config --template="config.inc.php" --destination="$install_dir/config/config.inc.php"
#=================================================
# INSTALL ADDITIONAL PLUGINS
#=================================================
ynh_script_progression --message="Installing additional plugins..." --weight=60
# Create logs and temp directories
mkdir -p "$install_dir/"{logs,temp}
# Install net_LDAP
export COMPOSER_ALLOW_SUPERUSER=1
ynh_composer_exec --commands="require kolab/net_ldap3"
# Install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu
ynh_composer_exec --commands="require \
johndoh/contextmenu $contextmenu_version \
sblaisot/automatic_addressbook $automatic_addressbook_version"
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home"
chown -R $app:www-data "$install_dir/plugins/enigma/home"
# Install CardDAV plugin
if [ $with_carddav -eq 1 ]
then
ynh_composer_exec --commands="require roundcube/carddav $carddav_version --with-all-dependencies"
carddav_tmp_config="../conf/carddav.config.inc.php"
carddav_server=0
# Copy the plugin configuration file
cp $install_dir/plugins/carddav/config.inc.php{.dist,}
# Look for installed and supported CardDAV servers
for carddav_app in "nextcloud" "baikal"
do
carddav_app_ids=$(yunohost app list | grep "id: $carddav_app" | grep -Po 'id: \K(.*)' || echo "")
for carddav_app_id in $carddav_app_ids
do
carddav_server=1
# Append preset configuration to the config file
cat "../conf/${carddav_app}.inc.php" >> $install_dir/plugins/carddav/config.inc.php
# Retrieve app settings and enable relevant preset
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
carddav_url="https://${carddav_domain}${carddav_path%/}"
ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php"
done
done
# Do not actualy add the cardDAV plugin if there's no cardDAV server available...
if [ $carddav_server -eq 1 ]
then
installed_plugins+=" 'carddav',"
fi
fi
#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
ynh_script_progression --message="Updating Roundcube configuration..." --weight=3
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php"
# Update javascript dependencies
(cd "$install_dir"
/usr/bin/php$phpversion -q ./bin/install-jsdeps.sh -v ?)
# Store the config file checksum into the app settings
ynh_store_file_checksum --file="$install_dir/config/config.inc.php"
chmod 400 "$install_dir/config/config.inc.php"
chown $app:$app "$install_dir/config/config.inc.php"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,59 +9,15 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If with_carddav doesn't exist, create it
if [ -z "${with_carddav:-}" ]; then
if [ -f "$install_dir/plugins/carddav/config.inc.php" ]
then
with_carddav=1
else
with_carddav=0
fi
ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav
fi
# If language doesn't exist, create it
if [ -z "${language:-}" ]; then
language="en_GB"
ynh_app_setting_set --app=$app --key=language --value=$language
fi
# If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=low
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "${fpm_free_footprint:-}" ]; then
fpm_free_footprint=0
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then
fpm_usage=low
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Get the current version of roundcube
oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir" --keep="config/config.inc.php"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -72,125 +28,11 @@ chown -R $app:www-data "$install_dir"
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# CONFIGURE ROUNDCUBE
#=================================================
ynh_script_progression --message="Reconfiguring $app..." --weight=1
deskey=$(ynh_string_random --length=24)
ynh_add_config --template="config.inc.php" --destination="$install_dir/config/config.inc.php"
#=================================================
# UPDATE DEPENDENCIES WITH COMPOSER
#=================================================
ynh_script_progression --message="Updating dependencies with Composer..." --weight=30
# Upgrade composer itself
ynh_install_composer
# Check if dependencies need to be updated with Composer
if [ -f "$install_dir/composer.json" ]
then
ynh_exec_warn_less ynh_composer_exec --commands="update"
# Update plugin-installer for Composer version 2.0
ynh_exec_warn_less ynh_composer_exec --commands="require roundcube/plugin-installer:>=0.2.0"
else
# Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
fi
#=================================================
# UPGRADE ADDITIONAL PLUGINS
#=================================================
ynh_script_progression --message="Upgrading additional plugins..." --weight=30
# Create logs and temp directories
mkdir -p "$install_dir/"{logs,temp}
# Install net_LDAP
ynh_composer_exec --commands="require kolab/net_ldap3"
# Update or install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu
ynh_composer_exec --commands="update --no-dev --prefer-dist \
johndoh/contextmenu $contextmenu_version \
sblaisot/automatic_addressbook $automatic_addressbook_version"
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
ynh_add_config --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home"
chown -R $app:$app "$install_dir/plugins/enigma/home"
# Update or install CardDAV plugin
if [ $with_carddav -eq 1 ]
then
ynh_composer_exec --commands="require roundcube/carddav $carddav_version --with-all-dependencies"
carddav_tmp_config="../conf/carddav.config.inc.php"
carddav_server=0
# Copy the plugin configuration file
cp $install_dir/plugins/carddav/config.inc.php{.dist,}
# Look for installed and supported CardDAV servers
for carddav_app in "nextcloud" "baikal"
do
carddav_app_ids=$(yunohost app list | grep "id: $carddav_app" | grep -Po 'id: \K(.*)' || echo "")
for carddav_app_id in $carddav_app_ids
do
carddav_server=1
# Append preset configuration to the config file
cat "../conf/${carddav_app}.inc.php" >> $install_dir/plugins/carddav/config.inc.php
# Retrieve app settings and enable relevant preset
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
carddav_url="https://${carddav_domain}${carddav_path%/}"
ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php"
done
done
# Do not actually add the carddav plugin if there's no carddav server available...
if [ $carddav_server -eq 1 ]
then
installed_plugins+=" 'carddav',"
fi
fi
#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
ynh_script_progression --message="Updating $app configuration..." --weight=4
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php"
# Update JavaScript dependencies
pushd "$install_dir"
COMPOSER_ALLOW_SUPERUSER=1 "php$phpversion" ./bin/update.sh --version="?" -y <<< ""
# Store the config file checksum into the app settings
ynh_store_file_checksum --file="$install_dir/config/config.inc.php"
chmod 400 "$install_dir/config/config.inc.php"
chown $app:$app "$install_dir/config/config.inc.php"
#=================================================
# UPDATE ROUNDCUBE CORE
#=================================================
ynh_script_progression --message="Updating $app core..." --weight=4
COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn "php$phpversion" ./bin/update.sh --version=$oldversion -y
popd
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,7 +9,5 @@ test_format = 1.0
# -------------------------------
args.language = "en_GB"
args.with_carddav = 1
test_upgrade_from.255335f9e9a001d5abec7192f07d168e30b3c3fb.name = "1.6.0~ynh3"