diff --git a/data/helpers.d/apt b/data/helpers.d/apt index cea850f6e..3d06608ac 100644 --- a/data/helpers.d/apt +++ b/data/helpers.d/apt @@ -262,8 +262,6 @@ ynh_install_app_dependencies() { || ynh_die --message="Inconsistent php versions in dependencies ... found : $specific_php_version" dependencies+=", php${specific_php_version}, php${specific_php_version}-fpm, php${specific_php_version}-common" - - ynh_add_sury fi @@ -285,23 +283,6 @@ ynh_install_app_dependencies() { dependencies="$current_dependencies, $dependencies" fi - # - # Epic ugly hack to fix the goddamn dependency nightmare of sury - # Sponsored by the "Djeezusse Fokin Kraiste Why Do Adminsys Has To Be So Fucking Complicated I Should Go Grow Potatoes Instead Of This Shit" collective - # https://github.com/YunoHost/issues/issues/1407 - # - # If we require to install php dependency - if grep --quiet 'php' <<< "$dependencies"; then - # And we have packages from sury installed (7.0.33-10+weirdshiftafter instead of 7.0.33-0 on debian) - if dpkg --list | grep "php7.0" | grep --quiet --invert-match "7.0.33-0+deb9"; then - # And sury ain't already in sources.lists - if ! grep --recursive --quiet "^ *deb.*sury" /etc/apt/sources.list*; then - # Re-add sury - ynh_add_sury - fi - fi - fi - cat >/tmp/${dep_app}-ynh-deps.control <>"${pending_dir}/etc/apt/preferences.d/ban_packages" + # Add sury + mkdir -p ${pending_dir}/etc/apt/sources.list.d/ + echo "deb https://packages.sury.org/php/ $(ynh_get_debian_release) main" > "${pending_dir}/etc/apt/sources.list.d/extra_php_version.list" + } do_post_regen() { regen_conf_files=$1 + # Add sury key + # We do this only at the post regen and if the key doesn't already exists, because we don't want the regenconf to fuck everything up if the regenconf runs while the network is down + if [[ ! -s /etc/apt/trusted.gpg.d/extra_php_version.gpg ]] + then + wget --timeout 900 --quiet "https://packages.sury.org/php/apt.gpg" --output-document=- | gpg --dearmor >"/etc/apt/trusted.gpg.d/extra_php_version.gpg" + fi + # Make sure php7.3 is the default version when using php in cli update-alternatives --set php /usr/bin/php7.3 }