From bbd91b4e9ae1ed959d1b8fb1d984e87bf1e6b4d1 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 27 Aug 2021 15:21:18 +0200 Subject: [PATCH] Mod:php-fpm update script new version detection Updated detection for latested php version in repo for deb based now using apt package list repo file instead of apt list command --- PhpUpdater.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PhpUpdater.sh b/PhpUpdater.sh index a44e017..f8188b2 100644 --- a/PhpUpdater.sh +++ b/PhpUpdater.sh @@ -6,9 +6,17 @@ source /etc/ICTM/mainvar.list if [ -z $shortdist ] ; then source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/MicroOSDetect.sh) ; fi if [ ! -f "/etc/ICTM/phpvar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GeneratePhplist.sh) ; fi source /etc/ICTM/phpvar.list -if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ]|| [ "$shortdist" = "deb11" ] ; then +if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ]; then + # Ubuntu Php variable apt update - RepoVersion=`apt list |grep php | grep deb.sury.org| cut -f1 -d"-"| tail -1 |sed 's/php//'` + if ! ls /var/lib/apt/lists/ppa.launchpad.net_ondrej_php*_Packages > /dev/null 2>&1 ; then echo 'PHP(Sury) repo not installed' && echo 'Install using: curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=php bash' && exit ; fi + RepoVersion=`grep -h '^Package: php' /var/lib/apt/lists/ppa.launchpad.net_ondrej_php*_Packages | cut -f1 -d"-" | sort | tail -1| sed -e 's/Package: php//'` +elif [ "$shortdist" = "deb10" ]|| [ "$shortdist" = "deb11" ]; then + # Debian Php variable + apt update + if ! ls /var/lib/apt/lists/packages.sury.org_php*_Packages > /dev/null 2>&1 ; then echo 'PHP(Sury) repo not installed' && echo 'Install using: curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=php bash' && exit ; fi + RepoVersion=`grep -h '^Package: php' /var/lib/apt/lists/packages.sury.org*_Packages| cut -f1 -d"-" | sort | tail -1| sed -e 's/Package: php//'` +fi elif [ "$shortdist" = "el8" ]; then dnf check-update --refresh RepoVersion=`dnf list php* | awk '{print $1; }' | cut -f1 -d"-"| tail -1 |sed 's/php//' | sed 's/./&./1'` @@ -32,7 +40,7 @@ if [ $IMODE = n ]; then if (whiptail --title "Set new php version?" --yesno "Install php version $RepoVersion ?" 8 78); then newphpver=$RepoVersion else - newphpver=$(whiptail --inputbox "Please enter the version to install" --title "Custom" 8 39 3>&1 1>&2 2>&3) + newphpver=$(whiptail --inputbox "Please enter the version to install" --nocancel --title "Custom" 8 39 3>&1 1>&2 2>&3) fi fi