Submodule PHP-FPM: Added module only installer and fixed PhpUpdater for debian 12

This commit is contained in:
2023-07-02 21:37:51 +02:00
parent c272df8109
commit 6e7761effe
2 changed files with 178 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ]; then
apt update apt update
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.bprieshof.nl/Work/PKGRepoSetup/raw/branch/Main/Setup-Repo.sh |repo=php bash' && exit ; fi 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.bprieshof.nl/Work/PKGRepoSetup/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//'` 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 elif [ "$shortdist" = "deb10" ] || [ "$shortdist" = "deb11" ] || [ "$shortdist" = "deb12" ]; then
# Debian Php variable # Debian Php variable
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.bprieshof.nl/Work/PKGRepoSetup/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.bprieshof.nl/Work/PKGRepoSetup/raw/branch/Main/Setup-Repo.sh |repo=php bash' && exit ; fi
@@ -61,7 +61,7 @@ if [ $IMODE = l ]; then
fi fi
#Genereating vars for new php version #Genereating vars for new php version
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] || [ "$shortdist" = "deb11" ] ; then if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] || [ "$shortdist" = "deb11" ] || [ "$shortdist" = "deb12" ] ; then
# Debian/Ubunbtu Php variables # Debian/Ubunbtu Php variables
newphpPoolDir=/etc/php/${newphpver}/fpm/pool.d newphpPoolDir=/etc/php/${newphpver}/fpm/pool.d
newphpPkgName=php${newphpver} newphpPkgName=php${newphpver}

View File

@@ -0,0 +1,176 @@
#############################
# SingleModuleInstaller #
# For PHP-FPM #
#############################
##-----------------##
# Defining Vars #
##-----------------##
#SMI specific Vars
SMI_config=yes
SMI_ModuleName=php-fpm
#Enforcing Legacy Mode
APTMODE="apt"
OUTPUT='/dev/tty'
IMODE=l
#Web-V2 Vars
phpver=8.1
webserv=nginx
#PackageManager-config
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
PKGM="$APTMODE"
PKGUC="$PKGM update"
PKGUP="$PKGM upgrade -y"
PKGI="${PKGM} install -y --no-install-recommends"
PKGLIST="apt"
shortdist=ubu1804
elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then
PKGM="$APTMODE"
PKGUC="$PKGM update"
PKGUP="$PKGM upgrade -y"
PKGI="${PKGM} install -y --no-install-recommends"
PKGLIST="apt"
shortdist=ubu2004
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
PKGM="$APTMODE"
PKGUC="$PKGM update"
PKGUP="$PKGM upgrade -y"
PKGI="${PKGM} install -y --no-install-recommends"
PKGLIST="apt"
shortdist=deb10
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"11"* ]]; then
PKGM="$APTMODE"
PKGUC="$PKGM update"
PKGUP="$PKGM upgrade -y"
PKGI="${PKGM} install -y --no-install-recommends"
PKGLIST="apt"
shortdist=deb11
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"12"* ]]; then
PKGM="$APTMODE"
PKGUC="$PKGM update"
PKGUP="$PKGM upgrade -y"
PKGI="${PKGM} install -y --no-install-recommends"
PKGLIST="apt"
shortdist=deb12
elif [ "$(grep -oP '(?<=^PLATFORM_ID=).+' /etc/os-release | tr -d '"')" = "platform:el8" ]; then
PKGM="dnf"
PKGUC="$PKGM check-update --refresh"
PKGUP="$PKGM update -y"
PKGI="${PKGM} install --setopt=install_weak_deps=False --best -y"
PKGLIST="dnf"
shortdist=el8
else
echo "This os in not supported"
exit
fi
unset dist_ver dist APTMODE
#Repo Vars
repo=https://git.bprieshof.nl/Work_Archive/VPS-scripts_Web-V2
branch=main
branchtype=branch
###Select Module type
mtype=""$repo"/raw/"$branchtype"/"$branch"/SubModules/"$SMI_ModuleName""
#SelfBuilding Vars
PKGI="${PKGM} install -y"
##---------------##
# Functions #
##---------------##
msg () {
echo "$1"
}
#Checking if Config var has been set
if [ $SMI_config = no ]; then
msg " Script is not configured"
exit
fi
##-----------------##
# Storeing vars #
##-----------------##
mkdir -p /etc/WebV2
echo "InstDate=$(date "+%d-%B-%Y")" >> /etc/WebV2/mainvar.list
for storeme in PKGM PKGI PKGUC PKGUP PKGLIST OUTPUT IMODE shortdist repo branch branchtype shortdist phpver webserv; do
declare -p $storeme | cut -d ' ' -f 3- >> /etc/WebV2/mainvar.list
done
echo 'EnabledAons=('$SMI_ModuleName')' >> /etc/WebV2/selopts.list
##--------------------------##
# Installer-Requirements #
##--------------------------##
msg " Starting installer" 8 78
$PKGUC > $OUTPUT 2>&1
$PKGI curl > $OUTPUT 2>&1
##-------------------------##
# Generating APT list #
##-------------------------##
#Remove existing pkgList
rm -f /tmp/pkg.list
##--------------------##
# Pre-Requirements #
##--------------------##
msg " Preconfiguring"
curl --retry 7 --retry-delay 5 -s https://git.bprieshof.nl/Work/PKGRepoSetup/raw/branch/Main/Setup-Repo.sh |repo=init osrel=$shortdist bash > $OUTPUT 2>&1
$PKGUC
$PKGUP
##-------------------##
# Pre-configuring #
##-------------------##
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/preconf.sh)
fi
echo less >> /tmp/pkg.list
printf " " >>/tmp/pkg.list
##-------------##
# Installer #
##-------------##
$PKGUC
sed -i 's/PHPprefix/'$phpPkgName'/g' /tmp/pkg.list
cat /tmp/pkg.list | xargs $PKGI
##---------------##
# Configuring #
##---------------##
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/conf.sh)
fi
##-------##
# end #
##-------##
msg " Done!"