#!/usr/bin/env bash ### # Installs and sets up database for given system. ## # Import utils script. . $(dirname ${0})/utils.sh # Stop on error. set -e ### # Script entry point. ## function main () { echo "" echo "Please enter OS type:" echo -e " ${text_cyan}1${text_reset}) Arch Linux" echo -e " ${text_cyan}2${text_reset}) Ubuntu" echo -e " ${text_cyan}3${text_reset}) Other" echo "" read user_input # Handle user input. if [[ ${user_input} == 1 ]] then # Handle for Arch Linux. # Handle for MariaDB install. echo "Starting MariaDB install for Arch Linux." echo -e "To continue, press ${text_cyan}enter${text_reset}. Otherwise, hit ${text_cyan}ctrl+c${text_reset} to cancel." read echo -e "${text_blue}Starting MariaDB installation.${text_reset}" sudo ./install_mysql.sh --os arch --db mariadb echo -e "${text_green}MariaDB installation complete.${text_reset}" elif [[ ${user_input} == 2 ]] then # Handle for Ubuntu. echo "Choose a DB type to install:" echo -e " ${text_cyan}1${text_reset}) MySQL" echo -e " ${text_cyan}2${text_reset}) MariaDB" echo "" read user_input # Handle user input. if [[ ${user_input} == 1 ]] then # Handle for MySQL install. echo "Starting MySQL install for Ubuntu." echo -e "To continue, press ${text_cyan}enter${text_reset}. Otherwise, hit ${text_cyan}ctrl+c${text_reset} to cancel." read echo -e "${text_blue}Starting MySQL installation.${text_reset}" sudo ./install_mysql.sh --os ubuntu --db mysql echo -e "${text_green}MySQL installation complete.${text_reset}" elif [[ ${user_input} == 2 ]] then # Handle for MariaDB install. echo "Starting MariaDB install for Ubuntu." echo -e "To continue, press ${text_cyan}enter${text_reset}. Otherwise, hit ${text_cyan}ctrl+c${text_reset} to cancel." read echo -e "${text_blue}Starting MariaDB installation.${text_reset}" sudo ./install_mysql.sh --os ubuntu --db mariadb echo -e "${text_green}MariaDB installation complete.${text_reset}" else echo -e "${text_orange}Unknown option entered.${text_reset}" fi else # Handle for all other OS types. echo -e "${text_orange}Other OS types are currently unsupported.${text_reset}" fi } main