Upload files to ''

This commit is contained in:
Bram Prieshof
2020-01-09 15:00:58 +01:00
parent 5015379c32
commit c0ec1bee84
5 changed files with 281 additions and 0 deletions

110
MySQL-ModInst.sh Normal file
View File

@@ -0,0 +1,110 @@
#############################
# MySQL ModuleInstaller #
#############################
##-----------------##
# Defining Vars #
##-----------------##
#MySQL module specific Var
PHPMyadmin=1
phpmyadminver="4.9.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=""$repo"/raw/branch/"$branch""
#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"

1
apt.list Normal file
View File

@@ -0,0 +1 @@
mysql-server

47
conf.sh Normal file
View File

@@ -0,0 +1,47 @@
###Fetch Config
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
mbranch=master
if [ -z ${PHPMyadmin+x} ]; then echo 'Error $PHPMyadmin is not set, Setting default OFF' && PHPMyadmin=0;fi #check if Var is set
if [ -z ${phpmyadminver+x} ]; then echo 'Error $phpmyadminver is not set, Setting default' && phpmyadminver="4.9.2" ; fi #check if Var is set
systemctl stop mysql
rm /etc/mysql/mysql.conf.d/mysqld.cnf
wget -q -t7 "$repo"/raw/branch/"$branch"/config/MySQL/mysqld-V8.cnf -O /etc/mysql/mysql.conf.d/mysqld.cnf
systemctl start mysql
systemctl enable mysql
if [ $PHPMyadmin = 1 ]; then
mkdir -p /usr/share/phpmyadmin/
mkdir -p /etc/phpmyadmin
mkdir -p /var/lib/phpmyadmin/tmp/
wget -q -t7 https://files.phpmyadmin.net/phpMyAdmin/$phpmyadminver/phpMyAdmin-$phpmyadminver-all-languages.tar.gz -O /tmp/phpMyAdmin.tar.gz
tar xzf /tmp/phpMyAdmin.tar.gz -C /tmp/
mv /tmp/phpMyAdmin-$phpmyadminver-all-languages/* /usr/share/phpmyadmin
wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/vendor_config.php -O /usr/share/phpmyadmin/libraries/vendor_config.php
wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/config.footer.inc.php -O /etc/phpmyadmin/config.footer.inc.php
wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/config.header.inc.php -O /etc/phpmyadmin/config.header.inc.php
wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/config/phpmyadmin/config.inc.php -O /etc/phpmyadmin/config.inc.php
touch /var/lib/phpmyadmin/config.inc.php
touch /etc/phpmyadmin/config-db.php
chown -R www-data:www-data /var/lib/phpmyadmin/
blowsec=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo -e "<?php\n\n\$cfg['blowfish_secret'] = '$blowsec';\n\n?>" >> /var/lib/phpmyadmin/blowfish_secret.inc.php
mysql -u root --password="$password" < /usr/share/phpmyadmin/sql/create_tables.sql
fi
#Running Spesific WebPReconf
if curl --output /dev/null --silent --head --fail "$mrepo"/raw/branch/"$mbranch"/"$webserv"-conf.sh; then
source <(curl -s "$mrepo"/raw/branch/"$mbranch"/"$webserv"-conf.sh)
fi
unset mrepo
unset mbranch

96
mysql-8.0.sh Normal file
View File

@@ -0,0 +1,96 @@
###########################
# MySQL 8.0 Installer #
###########################
##-----------------##
# Defining Vars #
##-----------------##
#Enforcing Legacy Mode
if [ -z ${PKGM+x} ]; then PKGM="apt" ; fi
if [ -z ${OUTPUT+x} ]; then OUTPUT='/dev/tty' ; fi
if [ -z ${IMODE+x} ]; then IMODE=l ; fi
#Repo Vars
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
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"

27
preconf.sh Normal file
View File

@@ -0,0 +1,27 @@
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
mbranch=master
if [ -z ${DEBIAN_FRONTEND+x} ]; then echo 'env not set' ; else CurDebFrond="$DEBIAN_FRONTEND"; fi #checking and saving DEBIAN_FRONTEND
export DEBIAN_FRONTEND=noninteractive
if [ -z ${password+x} ]; then echo 'Error $password is not set'; fi
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-codename select bionic'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-distro select ubuntu'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/repo-url string http://repo.mysql.com/apt/'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-preview select '
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-product select Ok'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-server select mysql-8.0'
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/select-tools select '
debconf-set-selections <<< 'mysql-apt-config mysql-apt-config/unsupported-platform select abort'
debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password $password"
debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password $password"
debconf-set-selections <<< "mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)"
$PKGM update
wget -q -t7 https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb -O /tmp/mysql-apt-conf.deb
dpkg -i /tmp/mysql-apt-conf.deb > $OUTPUT 2>&1
if [ -z ${CurDebFrond+x} ]; then unset DEBIAN_FRONTEND ; else export DEBIAN_FRONTEND=$CurDebFrond; fi #Restore DEBIAN_FRONTEND
unset mrepo
unset mbranch