Minor Changes

This commit is contained in:
earnolmartin 2020-02-20 12:15:31 -07:00
parent ceaf703741
commit 4da2fe1822
3 changed files with 128 additions and 0 deletions

View file

@ -159,6 +159,8 @@ function apacheUseFPM(){
a2dismod php7.0
a2dismod php7.1
a2dismod php7.2
a2dismod php7.3
a2dismod php7.4
# We need a newer version of Apache for this to work properly!
if [[ "$distro" == "ubuntu" && "$yrelease" -eq "16" && "$mrelease" == "04" ]] || [[ "$distro" == "debian" && "$yrelease" -eq "9" ]]; then
@ -2889,6 +2891,10 @@ function enablePHPFPMService(){
update-rc.d "php7.1-fpm" defaults
update-rc.d "php7.2-fpm" enable
update-rc.d "php7.2-fpm" defaults
update-rc.d "php7.3-fpm" enable
update-rc.d "php7.3-fpm" defaults
update-rc.d "php7.4-fpm" enable
update-rc.d "php7.4-fpm" defaults
systemctl daemon-reload
systemctl enable php5-fpm.service
@ -2896,6 +2902,8 @@ function enablePHPFPMService(){
systemctl enable php7.0-fpm.service
systemctl enable php7.1-fpm.service
systemctl enable php7.2-fpm.service
systemctl enable php7.3-fpm.service
systemctl enable php7.4-fpm.service
fi
}

View file

@ -100,6 +100,110 @@ function checkRoot(){
fi
}
function aptgetInstall(){
# Parameter $1 is a list of programs to install
# Parameter $2 is used to specify runlevel 1 in front of the command to prevent daemons from automatically starting (needed for amavisd-new)
if [ -n "$noapt" ] ; then # skip install
echo "skipping apt-get install for:$1"
return
fi
# first, try to install without any prompt, then if anything goes wrong, normal install..
cmd="apt-get -y --no-remove --allow-unauthenticated install $1"
if [ ! -z "$2" ]; then
cmd="RUNLEVEL=1 $cmd"
fi
# Run the command
sh -c "$cmd"
if [ $? -ne 0 ]; then
cmd="apt-get -y --allow-unauthenticated install $1"
if [ ! -z "$2" ]; then
cmd="RUNLEVEL=1 $cmd"
fi
sh -c "$cmd"
fi
PackageFailed="$?"
}
function checkDistro() {
# Get distro properly
if [ -e /etc/issue ]; then
distro=$( cat /etc/issue | awk '{ print $1 }' )
fi
if [ ! -z "$distro" ]; then
# Convert it to lowercase
distro=$( echo $distro | awk '{print tolower($0)}' )
fi
if [ -z "$distro" ] || [[ "$distro" != "ubuntu" && "$distro" != "debian" ]]; then
if [ -e /etc/os-release ]; then
distro=$( cat /etc/os-release | grep -o "^NAME=.*" | grep -o "[^NAME=\"].*[^\"]" )
fi
fi
# Assume Ubuntu
if [ -z "$distro" ]; then
distro="ubuntu"
else
# Convert it to lowercase
distro=$( echo $distro | awk '{print tolower($0)}' )
fi
# Get actual release version information
version=$( lsb_release -r | awk '{ print $2 }' )
if [ -z "$version" ]; then
version=$( cat /etc/issue | awk '{ print $2 }' )
fi
# Separate year and version
if [[ "$version" == *.* ]]; then
yrelease=$( echo "$version" | cut -d. -f1 )
mrelease=$( echo "$version" | cut -d. -f2 )
else
yrelease="$version"
mrelease="0"
fi
# Get 64-bit OS or 32-bit OS [used in vsftpd fix]
if [ $( uname -m ) == 'x86_64' ]; then
OSBits=64
else
OSBits=32
fi
# Another way to get the version number
# version=$(lsb_release -r | awk '{ print $2 }')
echo "Your distro is $distro runnning version $version."
if [ "$distro" != "debian" ]; then
echo "Your distros yearly release is $yrelease. Your distros monthly release is $mrelease."
fi
if [ "$distro" == "debian" ] && [ "$yrelease" -lt "8" ]; then
echo "Debian 7.x and lower are no longer supported."
exit
fi
}
function installInitialPrereqs(){
if [ "$distro" == "ubuntu" ]; then
add-apt-repository universe
fi
aptgetInstall software-properties-common
aptgetInstall wget
aptgetInstall subversion
aptgetInstall curl
}
###################
#### Main Code ####
###################
@ -108,9 +212,15 @@ clear
# Check for root
checkRoot
# Check OS
checkDistro
# Check for Apt-get availability
isAptGetInUseBySomething
# Install some pre-reqs
installInitialPrereqs
# Get parameters
for varCheck in "$@"
do

View file

@ -862,6 +862,8 @@ function apacheUseFPM(){
a2dismod php7.0
a2dismod php7.1
a2dismod php7.2
a2dismod php7.3
a2dismod php7.4
# We need a newer version of Apache for this to work properly!
if [[ "$distro" == "ubuntu" && "$yrelease" -eq "16" && "$mrelease" == "04" ]] || [[ "$distro" == "debian" && "$yrelease" -eq "9" ]]; then
@ -2500,6 +2502,8 @@ function managePHPFPMService(){
manageService "php7.0-fpm" "${fpmAction}"
manageService "php7.1-fpm" "${fpmAction}"
manageService "php7.2-fpm" "${fpmAction}"
manageService "php7.3-fpm" "${fpmAction}"
manageService "php7.4-fpm" "${fpmAction}"
fi
}
@ -2523,6 +2527,10 @@ function enablePHPFPMService(){
update-rc.d "php7.1-fpm" defaults
update-rc.d "php7.2-fpm" enable
update-rc.d "php7.2-fpm" defaults
update-rc.d "php7.3-fpm" enable
update-rc.d "php7.3-fpm" defaults
update-rc.d "php7.4-fpm" enable
update-rc.d "php7.4-fpm" defaults
systemctl daemon-reload
systemctl enable php5-fpm.service
@ -2530,6 +2538,8 @@ function enablePHPFPMService(){
systemctl enable php7.0-fpm.service
systemctl enable php7.1-fpm.service
systemctl enable php7.2-fpm.service
systemctl enable php7.3-fpm.service
systemctl enable php7.4-fpm.service
fi
}