Files
Misc-Scripts/install-mysqlbu.sh

50 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Wrapper script for install, for easier execution via URL.
source /dev/stdin <<< "$(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/colors.inc)"
source /dev/stdin <<< "$(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/default.inc)"
if type apt &>/dev/null; then
ATYPE="apt"
elif type apt-get &>/dev/null; then
ATYPE="apt-get"
elif type yum &>/dev/null; then
ATYPE="yum"
else
ATYPE="unknown"
exit 1
fi
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
else APTFUNC="${ATYPE}"
fi
echo ""
echo -e "${CS[color,LightGreen]}MySQL-BU Installation Script${CS[color,Default]}"
cd /tmp
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
do_with_root dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
do_with_root percona-release enable-only tools release
do_with_root $APTFUNC update
do_with_root $APTFUNC -y install wget curl git percona-xtrabackup-24
do_with_root set -eu
do_with_root git clone https://git.schroedercity.com/voltron/MySQL-BU.git /opt/mysqlbu
do_with_root ln -s /opt/mysqlbu/run.sh /usr/local/bin/mysqlbu
echo -e "BACKUP_PATH='/var/lib/mysql-backups/'
MYSQLUSER='root'
MYSQLPASS='Dc\$@54115'
MYSQLCFG='/etc/mysql/my.cnf'
BACKUPSTOKEEP=3
" > /opt/mysqlbu/settings.conf
echo ""
echo -e "${CS[color,LightYellow]}MySQL-BU has been Installed${CS[color,Default]}"
echo ""
echo -e "To run backups, use the command: ${CS[color,Green]}mysqlbu${CS[color,Default]}"
echo ""
echo ""
exit 0