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

Update upgrade

This commit is contained in:
Éric Gaspar 2024-05-21 12:56:43 +02:00
parent 57e8d5c04e
commit e48cd535d2

View file

@ -9,12 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -64,13 +58,10 @@ fi
# Get the current version of roundcube # Get the current version of roundcube
oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4) oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
if [ "$upgrade_type" == "UPGRADE_APP" ] ynh_script_progression --message="Upgrading source files..." --weight=3
then
ynh_script_progression --message="Upgrading source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src # 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"
fi
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
@ -91,60 +82,57 @@ ynh_add_nginx_config
#================================================= #=================================================
# CONFIGURE ROUNDCUBE # CONFIGURE ROUNDCUBE
#================================================= #=================================================
ynh_script_progression --message="Reconfiguring $app..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] 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 then
ynh_script_progression --message="Reconfiguring Roundcube..." --weight=1
deskey=$(ynh_string_random --length=24)
ynh_add_config --template="../conf/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" ynh_exec_warn_less ynh_composer_exec --commands="update"
# Update plugin-installer for Composer version 2.0 # Update plugin-installer for Composer version 2.0
ynh_exec_warn_less ynh_composer_exec --commands="require roundcube/plugin-installer:>=0.2.0" ynh_exec_warn_less ynh_composer_exec --commands="require roundcube/plugin-installer:>=0.2.0"
else else
# Install composer.json # Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json" cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
fi fi
#================================================= #=================================================
# UPGRADE ADDITIONAL PLUGINS # UPGRADE ADDITIONAL PLUGINS
#================================================= #=================================================
ynh_script_progression --message="Upgrading additional plugins..." --weight=30 ynh_script_progression --message="Upgrading additional plugins..." --weight=30
# Create logs and temp directories # Create logs and temp directories
mkdir -p "$install_dir/"{logs,temp} mkdir -p "$install_dir/"{logs,temp}
# Install net_LDAP # Install net_LDAP
ynh_composer_exec --commands="require kolab/net_ldap3" ynh_composer_exec --commands="require kolab/net_ldap3"
# Update or install contextmenu and automatic_addressbook plugins # Update or install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook # https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu # https://plugins.roundcube.net/packages/johndoh/contextmenu
ynh_composer_exec --commands="update --no-dev --prefer-dist \ ynh_composer_exec --commands="update --no-dev --prefer-dist \
johndoh/contextmenu $contextmenu_version \ johndoh/contextmenu $contextmenu_version \
sblaisot/automatic_addressbook $automatic_addressbook_version" sblaisot/automatic_addressbook $automatic_addressbook_version"
installed_plugins+=" 'contextmenu', 'automatic_addressbook'," installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php" ynh_add_config --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home" mkdir -p "$install_dir/plugins/enigma/home"
chown -R $app:$app "$install_dir/plugins/enigma/home" chown -R $app:$app "$install_dir/plugins/enigma/home"
# Update or install CardDAV plugin # Update or install CardDAV plugin
if [ $with_carddav -eq 1 ] if [ $with_carddav -eq 1 ]
then then
ynh_composer_exec --commands="require roundcube/carddav $carddav_version --with-all-dependencies" ynh_composer_exec --commands="require roundcube/carddav $carddav_version --with-all-dependencies"
carddav_tmp_config="../conf/carddav.config.inc.php" carddav_tmp_config="../conf/carddav.config.inc.php"
@ -176,17 +164,17 @@ then
then then
installed_plugins+=" 'carddav'," installed_plugins+=" 'carddav',"
fi fi
fi fi
#================================================= #=================================================
# UPDATE ROUNDCUBE CONFIGURATION # UPDATE ROUNDCUBE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Updating $app configuration..." --weight=4 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" ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php"
# Update JavaScript dependencies # Update JavaScript dependencies
pushd "$install_dir" pushd "$install_dir"
COMPOSER_ALLOW_SUPERUSER=1 "php$phpversion" ./bin/update.sh --version="?" -y <<< "" COMPOSER_ALLOW_SUPERUSER=1 "php$phpversion" ./bin/update.sh --version="?" -y <<< ""
# Store the config file checksum into the app settings # Store the config file checksum into the app settings
@ -201,8 +189,7 @@ then
ynh_script_progression --message="Updating $app core..." --weight=4 ynh_script_progression --message="Updating $app core..." --weight=4
COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn "php$phpversion" ./bin/update.sh --version=$oldversion -y COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn "php$phpversion" ./bin/update.sh --version=$oldversion -y
popd popd
fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT