PhpUpdater: Fixed mistake and cleaned up promts
This commit is contained in:
@@ -16,7 +16,6 @@ elif [ "$shortdist" = "deb10" ]|| [ "$shortdist" = "deb11" ]; then
|
|||||||
apt update
|
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
|
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//'`
|
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
|
elif [ "$shortdist" = "el8" ]; then
|
||||||
dnf check-update --refresh
|
dnf check-update --refresh
|
||||||
RepoVersion=`dnf list php* | awk '{print $1; }' | cut -f1 -d"-"| tail -1 |sed 's/php//' | sed 's/./&./1'`
|
RepoVersion=`dnf list php* | awk '{print $1; }' | cut -f1 -d"-"| tail -1 |sed 's/php//' | sed 's/./&./1'`
|
||||||
@@ -30,17 +29,16 @@ msg () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
msg "Current php version: $phpver"
|
|
||||||
|
|
||||||
if [ $IMODE = n ]; then
|
if [ $IMODE = n ]; then
|
||||||
# Legacy/Main Menu
|
# Legacy/Main Menu
|
||||||
PKGD="debconf-apt-progress -- apt purge -y"
|
PKGD="debconf-apt-progress -- apt purge -y"
|
||||||
|
|
||||||
#Menu
|
#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
|
newphpver=$RepoVersion
|
||||||
else
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -50,7 +48,7 @@ if [ $IMODE = l ]; then
|
|||||||
|
|
||||||
#Menu
|
#Menu
|
||||||
while true; do
|
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
|
case $yn in
|
||||||
[Yy]* ) newphpver=$RepoVersion
|
[Yy]* ) newphpver=$RepoVersion
|
||||||
break;;
|
break;;
|
||||||
@@ -95,7 +93,7 @@ if [ $IMODE = l ]; then
|
|||||||
|
|
||||||
if [ $IMODE = n ]; then
|
if [ $IMODE = n ]; then
|
||||||
#Purge
|
#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
|
PhpPurge=1
|
||||||
$PKGP -y $phpPkgName*
|
$PKGP -y $phpPkgName*
|
||||||
else
|
else
|
||||||
@@ -108,7 +106,7 @@ fi
|
|||||||
if [ $IMODE = l ]; then
|
if [ $IMODE = l ]; then
|
||||||
#Purge
|
#Purge
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Remove php $phpver ? -> yes/no?" yn
|
read -p "Remove old php version ($phpver) ? -> yes/no?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) PhpPurge=1 ; $PKGP $phpPkgName*
|
[Yy]* ) PhpPurge=1 ; $PKGP $phpPkgName*
|
||||||
break;;
|
break;;
|
||||||
|
|||||||
Reference in New Issue
Block a user