diff --git a/scripts/_common.sh b/scripts/_common.sh index 7b2371f..a9695fc 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,8 @@ #================================================= # dependencies used by the app -pkg_dependencies="php7.3-curl php7.3-dom php7.3-gd php7.3-json php7.3-mbstring php7.3-pdo-mysql php7.3-tokenizer php7.3-zip" +pkg_dependencies="" +extra_pkg_dependencies="php7.3-curl php7.3-dom php7.3-gd php7.3-json php7.3-mbstring php7.3-pdo-mysql php7.3-tokenizer php7.3-zip" # Version numbers php_version="7.3" diff --git a/scripts/install b/scripts/install index 363c3ce..3922b21 100644 --- a/scripts/install +++ b/scripts/install @@ -81,20 +81,23 @@ ynh_app_setting_set $app bazaar_extension $bazaar_extension #================================================= # STANDARD MODIFICATIONS +#================================================= +# INSTALL PHP +#================================================= + +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + ynh_print_info --message="Installing php${php_version}..." + ynh_install_php --phpversion="${php_version}" --package="$extra_pkg_dependencies" +fi + #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 +ynh_print_info --message="Installing dependencies..." -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - Remove the variable "pkg_dependencies" in _common.sh -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - -ynh_install_php --phpversion=${php_version} --package="$pkg_dependencies" +ynh_install_app_dependencies "$pkg_dependencies" #=================================================== # CREATE DEDICATED USER diff --git a/scripts/remove b/scripts/remove index 267cc8f..d7f783e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,7 +41,9 @@ ynh_script_progression --message="Removing dependencies..." --time --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies -ynh_remove_php +if [ "$(lsb_release --codename --short)" != "buster" ]; then + ynh_remove_php +fi #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index a7dba46..88b3dfe 100644 --- a/scripts/restore +++ b/scripts/restore @@ -74,6 +74,17 @@ chown -R $app: $final_path chown -R $app:www-data $final_path/storage chmod -R 0775 $final_path +#================================================= +# INSTALL PHP +#================================================= + +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + ynh_print_info --message="Installing php${php_version}..." + ynh_install_php --phpversion="${php_version}" --package="$extra_pkg_dependencies" +fi + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -88,7 +99,7 @@ ynh_restore_file --origin_path="/etc/php/${php_version}/fpm/pool.d/$app.conf" ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 # Define and install dependencies -ynh_install_php --phpversion=${php_version} --package="$pkg_dependencies" +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # RESTORE THE MYSQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 0ac957f..55fb671 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -138,12 +138,23 @@ fi # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# UPGRADE PHP7.3 +#================================================= + +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + ynh_print_info --message="Upgrading php${php_version}..." + ynh_install_php --phpversion="${php_version}" --package="$extra_pkg_dependencies" +fi + #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +ynh_print_info --message="Upgrading dependencies..." -ynh_install_php --phpversion=${php_version} --package="$pkg_dependencies" +ynh_install_app_dependencies "$pkg_dependencies" #================================================= # CREATE DEDICATED USER