Files
VPS-scripts_MariaDB/MySQL-ModInst.sh

111 lines
2.0 KiB
Bash

#############################
# MySQL ModuleInstaller #
#############################
##-----------------##
# Defining Vars #
##-----------------##
#MySQL module specific Var
PHPMyadmin=1
phpmyadminver="5.0.2"
#SMI specific Vars
SMI_config=no
#Enforcing Legacy Mode
PKGM="apt"
OUTPUT='/dev/tty'
IMODE=l
#Web-V2 Vars
password=TestP@ssword123
#Repo Vars
repo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
branch=master
###Select Module type
mtype=""$mrepo"/raw/branch/"$mbranch""
#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
##--------------------------##
# Installer-Requirements #
##--------------------------##
msg "Starting installer." 8 78
$PKGM update > $OUTPUT 2>&1
$PKGI curl > $OUTPUT 2>&1
##-------------------------##
# Generating APT list #
##-------------------------##
#Webserver specific aptList
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/apt.list; then
curl "$mtype"/apt.list >>/tmp/apt.list
fi
##--------------------##
# Pre-Requirements #
##--------------------##
msg "Preconfiguring."
$PKGI software-properties-common gnupg > $OUTPUT 2>&1
$PKGM update
$PKGM upgrade -y
##-------------------##
# 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
##-------------##
# Installer #
##-------------##
$PKGM update
sed -i 's/PHPver/'$phpver'/g' /tmp/apt.list
cat /tmp/apt.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"