PhpUpdater: Fixed mistake and cleaned up promts

This commit is contained in:
2022-01-20 14:40:33 +01:00
parent 296a68dc2e
commit 459d61b348

View File

@@ -16,7 +16,6 @@ elif [ "$shortdist" = "deb10" ]|| [ "$shortdist" = "deb11" ]; then
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'`
@@ -30,17 +29,16 @@ msg () {
fi
}
msg "Current php version: $phpver"
if [ $IMODE = n ]; then
# Legacy/Main Menu
PKGD="debconf-apt-progress -- apt purge -y"
#Menu
if (whiptail --title "Set new php version?" --yesno "Install php version $RepoVersion ?" 8 78); then
if (whiptail --title "Php Upgrader" --yesno " Current php version is $phpver, and $RepoVersion the is latest available version" --yes-button "Yes, upgrade to this version" --no-button "No, i want to choose" 8 100); then
newphpver=$RepoVersion
else
newphpver=$(whiptail --inputbox "Please enter the version to install" --nocancel --title "Custom" 8 39 3>&1 1>&2 2>&3)
newphpver=$(whiptail --inputbox "Please enter the version to install" --nocancel --title "Php Upgrader" 8 50 3>&1 1>&2 2>&3)
fi
fi
@@ -50,7 +48,7 @@ if [ $IMODE = l ]; then
#Menu
while true; do
read -p "Set phpversion to version $RepoVersion ? -> yes/no?" yn
read -p "Current php version is $phpver, and $RepoVersion the is latest available version -> Yes, upgrade to this version/No, i want to choose? " yn
case $yn in
[Yy]* ) newphpver=$RepoVersion
break;;
@@ -95,7 +93,7 @@ if [ $IMODE = l ]; then
if [ $IMODE = n ]; then
#Purge
if (whiptail --title "Set new php version?" --yesno "Remove php $phpver ?" 8 78); then
if (whiptail --title "Php Upgrader" --yesno "Remove old php version ($phpver) ?" 8 78); then
PhpPurge=1
$PKGP -y $phpPkgName*
else
@@ -108,7 +106,7 @@ fi
if [ $IMODE = l ]; then
#Purge
while true; do
read -p "Remove php $phpver ? -> yes/no?" yn
read -p "Remove old php version ($phpver) ? -> yes/no?" yn
case $yn in
[Yy]* ) PhpPurge=1 ; $PKGP $phpPkgName*
break;;