Prepared php updater for EL
This commit is contained in:
@@ -6,11 +6,15 @@ if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then
|
||||
|
||||
source /etc/ICTM/selopts.list
|
||||
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 [ $webserv != nginx_nonphp ]; then
|
||||
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then echo 'Php var list missing,Please run /Scipts/GeneratePhplist from the repo ' && exit ; 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
|
||||
fi
|
||||
if [ -f "/etc/ICTM/apachevar.list" ] ; then source /etc/ICTM/apachevar.list; fi
|
||||
if [ $webserv = apache ]; then
|
||||
if [ ! -f "/etc/ICTM/apachevar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GenerateApacheList.sh) ; fi
|
||||
source /etc/ICTM/apachevar.list
|
||||
fi
|
||||
rm /tmp/pkg.list > $OUTPUT 2>&1
|
||||
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
||||
|
||||
|
||||
@@ -10,11 +10,15 @@ if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then
|
||||
|
||||
source /etc/ICTM/selopts.list
|
||||
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 [ $webserv != nginx_nonphp ]; then
|
||||
if [ ! -f "/etc/ICTM/phpvar.list" ] ; then echo 'Php var list missing,Please run /Scipts/GeneratePhplist from the repo ' && exit ; 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
|
||||
fi
|
||||
if [ -f "/etc/ICTM/apachevar.list" ] ; then source /etc/ICTM/apachevar.list; fi
|
||||
if [ $webserv = apache ]; then
|
||||
if [ ! -f "/etc/ICTM/apachevar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GenerateApacheList.sh) ; fi
|
||||
source /etc/ICTM/apachevar.list
|
||||
fi
|
||||
rm /tmp/pkg.list
|
||||
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
for f in /etc/apache2/sites-available/*; do
|
||||
if [ ! -f "/etc/ICTM/apachevar.list" ] ; then bash <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/Scripts/GenerateApacheList.sh) ; fi
|
||||
source /etc/ICTM/apachevar.list
|
||||
|
||||
for f in $apacheConfDir/sites-available/*; do
|
||||
if [ $IMODE = n ] && [ $PhpPurge = 0 ]; then
|
||||
if (whiptail --title "Update apache config ?" --yesno "Update php version in apache site: ${f##*/} ?" 8 78); then
|
||||
sed -i "s/$phpver/$newphpver/" $f
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
if [ ! -f "/etc/ICTM/selopts.list" ] || [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
||||
|
||||
PKGI="${PKGM} install -y --no-install-recommends"
|
||||
rm /tmp/pkg.list
|
||||
#Getting variables
|
||||
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
|
||||
PPAversion=`apt list php | egrep -o "([0-9]{1,}.)+[0-9]{1,}" | cut -c 3-` && PPAversion=`echo $PPAversion | awk '{print $1; }' | cut -f1 -d"+"`
|
||||
|
||||
msg () {
|
||||
@@ -60,11 +64,33 @@ if [ $IMODE = l ]; then
|
||||
esac
|
||||
done
|
||||
|
||||
#Genereating vars for new php version
|
||||
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
||||
# Debian/Ubunbtu Php variables
|
||||
newphpPoolDir=/etc/php/${newphpver}/fpm/pool.d
|
||||
newphpPkgName=php${newphpver}
|
||||
newphpMainConf=/etc/php/${newphpver}/fpm/php.ini
|
||||
newphpFPMService=php${newphpver}-fpm
|
||||
elif [ "$shortdist" = "el8" ]; then
|
||||
# Centos Php variable
|
||||
phpPoolDir=/etc/opt/remi/php${newphpver//.}/php-fpm.d/
|
||||
newphpPkgName=php${newphpver//.}-php
|
||||
newphpMainConf=/etc/opt/remi/php${newphpver//.}/php.ini
|
||||
newphpFPMService=php${newphpver//.}-php-fpm
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#Install
|
||||
apt list --installed | less | grep php$phpver | cut -f1 -d"/" | sed "s/$phpver/$newphpver/" | xargs $PKGI
|
||||
apt list --installed | less | grep php$phpver | cut -f1 -d"/" | sed "s/$phpver/$newphpver/" > /tmp/pkg.list
|
||||
if [ ${newphpver//.} -ge 80 ] && [ ${newphpver//.} -lt 90 ]; then
|
||||
sed -i -e "s/php${newphpver//}-xmlrpc//g" -e "s/php${newphpver//}-json//g" /tmp/pkg.list
|
||||
fi
|
||||
cat /tmp/pkg.list | xargs $PKGI
|
||||
|
||||
#Config
|
||||
cp /etc/php/$phpver/fpm/pool.d/* /etc/php/$newphpver/fpm/pool.d/
|
||||
systemctl stop $newphpFPMService
|
||||
cp $phpPoolDir/* $newphpPoolDir
|
||||
|
||||
#Purge
|
||||
while true; do
|
||||
@@ -79,13 +105,21 @@ if [ $IMODE = l ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
for f in /etc/php/$newphpver/fpm/pool.d/*; do
|
||||
for f in $phpPoolDir/*; do
|
||||
sed -i "s/$phpver/$newphpver/" $f
|
||||
done
|
||||
systemctl reload php$newphpver-fpm
|
||||
|
||||
systemctl start $newphpFPMService
|
||||
systemctl enable $newphpFPMService
|
||||
|
||||
|
||||
sed -i "/phpver/c\phpver=\"$newphpver\"" /etc/ICTM/mainvar.list
|
||||
|
||||
mv /etc/ICTM/phpvar.list /etc/ICTM/phpvar"$phpver".list
|
||||
for storeme in newphpPoolDir newphpPkgName newphpMainConf newphpFPMService; do
|
||||
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/phpvar.list
|
||||
done
|
||||
|
||||
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/phpupdate-handeler.sh; then
|
||||
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/CoreModules/"$webserv"/phpupdate-handeler.sh)
|
||||
fi
|
||||
19
Scripts/GenerateApacheList.sh
Normal file
19
Scripts/GenerateApacheList.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
if [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
||||
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 [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
||||
# Debian/Ubunbtu apache variables
|
||||
apacheConfDir=/etc/apache2
|
||||
apacheService=apache2
|
||||
|
||||
elif [ "$shortdist" = "el8" ]; then
|
||||
# Centos Php variable
|
||||
apacheConfDir=/etc/httpd
|
||||
apacheService=httpd
|
||||
fi
|
||||
|
||||
#Storing vars to config
|
||||
for storeme in apacheService apacheConfDir; do
|
||||
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/apachevar.list
|
||||
done
|
||||
@@ -1,4 +1,6 @@
|
||||
if [ ! -f "/etc/ICTM/mainvar.list" ] ; then echo 'This system is not yet setup, please run the main installer first' && exit ; fi
|
||||
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 [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
||||
# Debian/Ubunbtu Php variables
|
||||
|
||||
14
Scripts/MicroOSDetect.sh
Normal file
14
Scripts/MicroOSDetect.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release")
|
||||
dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release")
|
||||
|
||||
if [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"18.04"* ]]; then
|
||||
shortdist=ubu1804
|
||||
elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then
|
||||
shortdist=ubu2004
|
||||
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
|
||||
shortdist=deb10
|
||||
elif [[ "${dist}" == *"centos"* ]] && [[ "${dist_ver}" == *"8"* ]]; then
|
||||
shortdist=el8
|
||||
else
|
||||
echo "This os in known"
|
||||
fi
|
||||
Reference in New Issue
Block a user