Files
VPS-scripts_MariaDB/conf.sh
2020-04-23 11:27:01 +02:00

48 lines
2.1 KiB
Bash

###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="5.0.2" ; fi #check if Var is set
systemctl stop mysql
rm /etc/mysql/mysql.conf.d/mysqld.cnf
wget -q -t7 "$mrepo"/raw/branch/"$mbranch"/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