############################# # 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!"