From bb0acc63133a4a64eb0cafb16c403cf8578c3ca5 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Fri, 28 May 2021 07:58:36 +0530 Subject: [PATCH] Fix extension setup --- src/scripts/common.sh | 5 ++--- src/scripts/linux.sh | 6 +----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/scripts/common.sh b/src/scripts/common.sh index f6003438..1f48038f 100644 --- a/src/scripts/common.sh +++ b/src/scripts/common.sh @@ -127,9 +127,8 @@ enable_cache_extension() { # Function to enable existing extensions. enable_extension() { - if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then - sudo phpenmod -v "$version" "$1" >/dev/null 2>&1 - fi + modules_dir="/var/lib/php/modules/$version" + [ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete if [ -d /tmp/extcache/"$1" ]; then enable_cache_extension "$1" "$2" elif ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index def4df7e..afc149b1 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -63,9 +63,7 @@ delete_extension() { extension=$1 disable_extension "$extension" sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1 - if [ "${runner:?}" = "self-hosted" ]; then - $apt_remove "php-$extension" "php$version-$extension" >/dev/null 2>&1 || true - fi + sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status } # Function to disable and delete extensions. @@ -74,7 +72,6 @@ remove_extension() { if check_extension "$extension"; then if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1 - echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1 fi delete_extension "$extension" (! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") || @@ -270,7 +267,6 @@ version=$1 dist=$2 debconf_fix="DEBIAN_FRONTEND=noninteractive" apt_install="sudo $debconf_fix apt-fast install -y" -apt_remove="sudo $debconf_fix apt-fast remove -y" scripts="${dist}"/../src/scripts # shellcheck source=.