This repository has been archived on 2023-05-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
MySQL-DEV/mysql-8.0.sh
2020-09-18 12:17:37 +00:00

124 lines
2.6 KiB
Bash

###########################
# MySQL 8.0 Installer #
###########################
##-----------------##
# Defining Vars #
##-----------------##
#Enforcing Legacy Mode
if [ -z ${OUTPUT+x} ]; then OUTPUT='/dev/tty' ; fi
if [ -z ${IMODE+x} ]; then IMODE=l ; fi
#OS Detect
dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release")
dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release")
echo "input: $dist $dist_ver"
if [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"18.04"* ]]; then
echo "Ubuntu 18.04 Detected"
PKGM="apt"
shortdist=ubu1804
elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then
echo "Ubuntu 20.04 Detected"
PKGM="apt"
shortdist=ubu2004
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
PKGM="apt"
echo "Debian 10 Detected"
shortdist=deb10
elif [[ "${dist}" == *"centos"* ]] && [[ "${dist_ver}" == *"8"* ]]; then
echo "Centos 8 Detected"
PKGM="dnf"
shortdist=cent8
else
echo "This os in not supported"
fi
unset dist_ver
unset dist
#Repo Vars
mrepo=https://git.bprieshof.nl/Work/MySQL-DEV
mbranch=master
###Select Module type
mtype=""$mrepo"/raw/branch/"$mbranch""
#SelfBuilding Vars
if [ -z ${PKGI+x} ]; then PKGI="${PKGM} install -y" ; fi
##---------------##
# Functions #
##---------------##
msg () {
echo "$1"
}
##--------------------------##
# 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"