From 836261a0a2dc457039573774a95cc71e753b2156 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 9 Apr 2022 14:03:47 +0200 Subject: [PATCH] upgrade to upstream --- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/backup | 3 ++- scripts/install | 26 ++++++++++---------------- scripts/restore | 28 ++++++++++++---------------- 6 files changed, 28 insertions(+), 37 deletions(-) diff --git a/conf/app.src b/conf/app.src index 41b11ef..51b1440 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ampache/ampache/archive/5.1.1.tar.gz -SOURCE_SUM=7052e47d87df3289e45f759269ca7933e4a8fc49b4d873b60fe63721652beddd +SOURCE_URL=https://github.com/ampache/ampache/archive/5.2.1.tar.gz +SOURCE_SUM=2ae11e34da6cc436bb03fbb44b460cd1f4758bdd8024231a2a21dac87e60d40d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index f0cf5e6..fe8c5e1 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Web based audio/video streaming application", "fr": "Application de streaming audio et vidéo" }, - "version": "5.1.1~ynh1", + "version": "5.2.1~ynh1", "url": "http://ampache.org", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 389f1bc..859240a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ YNH_PHP_VERSION="8.0" # Composer version -YNH_COMPOSER_VERSION="2.1.3" +YNH_COMPOSER_VERSION="2.3.3" pkg_dependencies="libav-tools|ffmpeg php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-simplexml php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-ldap" diff --git a/scripts/backup b/scripts/backup index 59d0489..742dee5 100644 --- a/scripts/backup +++ b/scripts/backup @@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -49,7 +50,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index 4e0a2de..47fd492 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin_ampache -ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion #================================================= # STANDARD MODIFICATIONS @@ -85,6 +84,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -100,6 +103,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low +ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion #================================================= # SPECIFIC SETUP @@ -113,13 +117,16 @@ ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key ynh_add_config --template="../conf/ampache.cfg.php" --destination="$final_path/config/ampache.cfg.php" +chmod 600 $final_path/config/ampache.cfg.php +chown $app: $final_path/config/ampache.cfg.php + #================================================= # LOAD DEFAULT DATABASE #================================================= ynh_script_progression --message="Loading default database..." # Load default ampache database -ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$app < "$final_path/resources/sql/ampache.sql" +ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name < "$final_path/resources/sql/ampache.sql" #================================================= # INSTALL AMPACHE WITH COMPOSER @@ -158,23 +165,10 @@ ynh_script_progression --message="Loading admin database..." cp ../conf/admin.sql /tmp/ ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin_ampache" --target_file=/tmp/admin.sql -ynh_mysql_connect_as --user=$app --password="$db_pwd" --database=$app < /tmp/admin.sql +ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name < /tmp/admin.sql ynh_secure_remove --file=/tmp/admin.sql -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to ampache directory -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" -chmod 600 $final_path/config/ampache.cfg.php - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index 07b62d8..f732c0a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -28,6 +28,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -60,26 +61,11 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." - -# Restore permissions on app files chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" chmod 600 $final_path/config/ampache.cfg.php -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring PHP-FPM configuration..." - -ynh_restore_file --origin_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf" - -#================================================= -# SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -88,6 +74,16 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=30 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring PHP-FPM configuration..." + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config + #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -104,7 +100,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #=================================================