Fix extension setup

This commit is contained in:
Shivam Mathur 2021-05-28 07:58:36 +05:30
parent 17fd1a694b
commit bb0acc6313
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 3 additions and 8 deletions

View File

@ -127,9 +127,8 @@ enable_cache_extension() {
# Function to enable existing extensions. # Function to enable existing extensions.
enable_extension() { enable_extension() {
if [ -e /tmp/setup_php_dismod ] && grep -q "$1" /tmp/setup_php_dismod; then modules_dir="/var/lib/php/modules/$version"
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1 [ -d "$modules_dir" ] && sudo find "$modules_dir" -path "*disabled*$1" -delete
fi
if [ -d /tmp/extcache/"$1" ]; then if [ -d /tmp/extcache/"$1" ]; then
enable_cache_extension "$1" "$2" enable_cache_extension "$1" "$2"
elif ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then elif ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then

View File

@ -63,9 +63,7 @@ delete_extension() {
extension=$1 extension=$1
disable_extension "$extension" disable_extension "$extension"
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1 sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
if [ "${runner:?}" = "self-hosted" ]; then sudo sed -i "/Package: php$version-$extension/,/^$/d" /var/lib/dpkg/status
$apt_remove "php-$extension" "php$version-$extension" >/dev/null 2>&1 || true
fi
} }
# Function to disable and delete extensions. # Function to disable and delete extensions.
@ -74,7 +72,6 @@ remove_extension() {
if check_extension "$extension"; then if check_extension "$extension"; then
if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then if [[ ! "$version" =~ ${old_versions:?} ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1 sudo phpdismod -v "$version" "$extension" >/dev/null 2>&1
echo "$extension" | sudo tee -a /tmp/setup_php_dismod >/dev/null 2>&1
fi fi
delete_extension "$extension" delete_extension "$extension"
(! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") || (! check_extension "$extension" && add_log "${tick:?}" ":$extension" "Removed") ||
@ -270,7 +267,6 @@ version=$1
dist=$2 dist=$2
debconf_fix="DEBIAN_FRONTEND=noninteractive" debconf_fix="DEBIAN_FRONTEND=noninteractive"
apt_install="sudo $debconf_fix apt-fast install -y" apt_install="sudo $debconf_fix apt-fast install -y"
apt_remove="sudo $debconf_fix apt-fast remove -y"
scripts="${dist}"/../src/scripts scripts="${dist}"/../src/scripts
# shellcheck source=. # shellcheck source=.