ReWriten MySQL Module for MariaDB
This commit is contained in:
142
MariaDB-ModInst.sh
Normal file
142
MariaDB-ModInst.sh
Normal file
@@ -0,0 +1,142 @@
|
||||
#############################
|
||||
# MySQL ModuleInstaller #
|
||||
#############################
|
||||
|
||||
|
||||
##-----------------##
|
||||
# Defining Vars #
|
||||
##-----------------##
|
||||
|
||||
#MySQL module specific Var
|
||||
PHPMyadmin=1
|
||||
phpmyadminver="5.0.2"
|
||||
|
||||
#SMI specific Vars
|
||||
SMI_config=no
|
||||
|
||||
#Enforcing Legacy Mode
|
||||
APTMODE="apt"
|
||||
OUTPUT='/dev/tty'
|
||||
IMODE=l
|
||||
|
||||
#Web-V2 Vars
|
||||
password=TestP@ssword123
|
||||
|
||||
#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"
|
||||
PKGI="${PKGM} install -y --no-install-recommends"
|
||||
PKGLIST="apt.pkg.list"
|
||||
shortdist=ubu1804
|
||||
elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then
|
||||
PKGM="$APTMODE"
|
||||
PKGI="${PKGM} install -y --no-install-recommends"
|
||||
PKGLIST="apt.pkg.list"
|
||||
shortdist=ubu2004
|
||||
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
|
||||
PKGM="$APTMODE"
|
||||
PKGI="${PKGM} install -y --no-install-recommends"
|
||||
PKGLIST="apt.pkg.list"
|
||||
shortdist=deb10
|
||||
elif [[ "${dist}" == *"centos"* ]] && [[ "${dist_ver}" == *"8"* ]]; then
|
||||
PKGM="dnf"
|
||||
PKGI="${PKGM} install --setopt=install_weak_deps=False --best -y"
|
||||
PKGLIST="dnf.pkg.list"
|
||||
shortdist=el8
|
||||
else
|
||||
echo "This OS is not supported"
|
||||
exit
|
||||
fi
|
||||
|
||||
unset dist_ver dist APTMODE
|
||||
|
||||
|
||||
#Repo Vars
|
||||
repo=https://git.ictmaatwerk.com/VPS-scripts/MariaDB
|
||||
branch=master
|
||||
|
||||
###Select Module type
|
||||
mtype=""$repo"/raw/branch/"$branch""
|
||||
|
||||
|
||||
##---------------##
|
||||
# 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
|
||||
$PKGI curl > $OUTPUT 2>&1
|
||||
|
||||
|
||||
|
||||
##-------------------------##
|
||||
# Generating APT list #
|
||||
##-------------------------##
|
||||
#Remove existing pkgList
|
||||
rm -f /tmp/pkg.list
|
||||
|
||||
#General pkgList
|
||||
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/generic.pkg.list; then
|
||||
curl "$mtype"/generic.pkg.list >>/tmp/pkg.list
|
||||
fi
|
||||
|
||||
|
||||
##--------------------##
|
||||
# Pre-Requirements #
|
||||
##--------------------##
|
||||
|
||||
msg "Preconfiguring."
|
||||
$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)
|
||||
printf " " >>/tmp/pkg.list
|
||||
fi
|
||||
|
||||
##-------------##
|
||||
# Installer #
|
||||
##-------------##
|
||||
|
||||
$PKGM update
|
||||
sed -i 's/PHPver/'$phpver'/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"
|
||||
Reference in New Issue
Block a user