diff --git a/linux/getmangos.sh b/linux/getmangos.sh old mode 100644 new mode 100755 index ae1defce..1aeef3c9 --- a/linux/getmangos.sh +++ b/linux/getmangos.sh @@ -2,6 +2,7 @@ ############################################################################### # MaNGOS Build Automation Script # # Written By: Ryan Ashley # +# Updated By: Cedric Servais # # Copyright (c) 2014-2016 MaNGOS Project # # https://getmangos.eu/ # # # @@ -23,15 +24,17 @@ # Global variables DLGAPP="whiptail" VERSION="0" +ROOTPATH="$HOME" SRCPATH="$HOME/mangos/src" INSTPATH="$HOME/mangos" DB_PREFIX="zero" +USER="mangos" P_DEBUG="0" P_STD_MALLOC="1" P_ACE_EXTERNAL="1" P_PGRESQL="0" P_TOOLS="0" -P_SD2="1" +P_SD3="1" P_ELUNA="1" @@ -48,7 +51,16 @@ function UseDialog() fi } - +# Function to test if the user is root or not +function CheckRoot() +{ + if [ "$(id -u)" != "0" ]; then + Log "This script can only be used as root!" 1 + exit 1 + else + Log "User is root, check passed" 0 + fi +} # Function to detect the repos function DetectLocalRepo() @@ -176,6 +188,7 @@ function GetRelease() 2 "Wrath of The Lich King" \ 3 "Cataclysm" \ 4 "Mists of Pandaria" \ + 5 "Warlords of Draenor" \ 3>&2 2>&1 1>&3) # Exit if cancelled @@ -187,35 +200,39 @@ function GetRelease() # Set some defaults based on the release case "$VERSION" in 0) - SRCPATH="$HOME/zero/src" - INSTPATH="$HOME/zero" + SRCPATH="$ROOTPATH/zero/src" + INSTPATH="$ROOTPATH/zero" DB_PREFIX="zero" ;; 1) - SRCPATH="$HOME/one/src" - INSTPATH="$HOME/one" + SRCPATH="$ROOTPATH/one/src" + INSTPATH="$ROOTPATH/one" DB_PREFIX="one" ;; 2) - SRCPATH="$HOME/two/src" - INSTPATH="$HOME/two" + SRCPATH="$ROOTPATH/two/src" + INSTPATH="$ROOTPATH/two" DB_PREFIX="two" ;; 3) - SRCPATH="$HOME/three/src" - INSTPATH="$HOME/three" + SRCPATH="$ROOTPATH/three/src" + INSTPATH="$ROOTPATH/three" DB_PREFIX="three" ;; 4) - SRCPATH="$HOME/four/src" - INSTPATH="$HOME/four" + SRCPATH="$ROOTPATH/four/src" + INSTPATH="$ROOTPATH/four" DB_PREFIX="four" ;; - + 5) + SRCPATH="$ROOTPATH/five/src" + INSTPATH="$ROOTPATH/fice" + DB_PREFIX="five" + ;; *) Log "Error: Unknown version selected!" 1 exit 1 @@ -226,7 +243,62 @@ function GetRelease() DetectLocalRepo } - +# Function to setup the technical user +function GetUser() +{ + local TMPUSER="$USER" + + # Set the user + TMPUSER=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User to run Mangos" \ + --inputbox "Default: $USER" 8 60 3>&2 2>&1 1>&3) + + # Exit if cancelled + if [ $? -ne 0 ]; then + Log "User selection was cancelled. No changes have been made to your system." 1 + exit 0 + fi + + # Change the user only if it was modified + if [ ! -z "$TMPUSER" ]; then + USER="$TMPUSER" + fi + + # Validate user + id $USER > /dev/null 2>&1 + if [ $? -ne 0 ]; then + Log "Creating user: $USER" 1 + useradd -m -d /home/$USER $USER > /dev/null 2>&1 + + if [ $? -ne 0 ]; then + Log "Error: Failed to create the specified user!" 1 + exit 1 + fi + + usermod -L $USER > /dev/null 2>&1 + else + # User already exist, asking to keep the user + $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User already exist" \ + --yesno "Would you like to keep the user \"$USER\"?" 8 60 + + if [ $? -ne 0 ]; then + Log "Removing user: $USER" 1 + userdel -r $USER > /dev/null 2>&1 + + Log "Creating user: $USER" 1 + useradd -m -d /home/$USER $USER > /dev/null 2>&1 + + if [ $? -ne 0 ]; then + Log "Error: Failed to create the specified user!" 1 + exit 1 + fi + + usermod -L $USER > /dev/null 2>&1 + fi + fi + + ROOTPATH="/home/"$USER + Log "User: $USER" 0 +} # Function to get the source and installation paths function GetPaths() @@ -366,7 +438,7 @@ function GetPaths() function GetMangos() { local CLONE="0" - local BRANCH="master" + local BRANCH="" CLONE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Clone or update MaNGOS" \ --menu "Would you like to clone, update, or continue?" 0 0 3 \ @@ -384,18 +456,55 @@ function GetMangos() # Clone from scratch if selected if [[ $CLONE = *0* ]]; then # Pull a different branch? - BRANCH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Branch" \ - --inputbox "Default: master" 8 60 3>&2 2>&1 1>&3) + case "$VERSION" in + 0) + releases=$(curl -s 'https://api.github.com/repos/mangoszero/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ') + ;; + 1) + releases=$(curl -s 'https://api.github.com/repos/mangosone/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ') + ;; + 2) + releases=$(curl -s 'https://api.github.com/repos/mangostwo/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ') + ;; + 3) + releases=$(curl -s 'https://api.github.com/repos/mangosthree/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ') + ;; + 4) + releases=$(curl -s 'https://api.github.com/repos/mangosfour/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ') + ;; + *) + Log "Error: Unknown version to select branch" 1 + ;; + esac + + COUNTER=1 + RADIOLIST="" # variable where we will keep the list entries for radiolist dialog + for i in $releases; do + if [ $COUNTER -eq 1 ]; then + RADIOLIST="$RADIOLIST $COUNTER $i on " + BRANCH=$i + else + RADIOLIST="$RADIOLIST $COUNTER $i off " + fi + let COUNTER=COUNTER+1 + done + + TMPBRANCH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Branch" \ + --radiolist "Default: $BRANCH" 0 0 $COUNTER \ + $RADIOLIST \ + 3>&2 2>&1 1>&3) # Exit if cancelled if [ $? -ne 0 ]; then Log "Branch selection cancelled. Only the install and source paths have been created." 1 exit 0 fi + + BRANCH=$(echo $releases | awk '{print $'$TMPBRANCH'}') # Set the branch if [ -z "$BRANCH" ]; then - BRANCH="master" + BRANCH="$releases | awk '{print $1}'" fi # Clone the selected version @@ -476,7 +585,7 @@ function GetBuildOptions() 3 "Use External ACE Libraries" On \ 4 "Use PostgreSQL Instead Of MySQL/MariaDB" Off \ 5 "Build Client Tools" Off \ - 6 "Use SD2" On \ + 6 "Use SD3" On \ 7 "Use Eluna" On \ 3>&2 2>&1 1>&3) @@ -520,11 +629,11 @@ function GetBuildOptions() P_TOOLS="0" fi - # See if SD2 will be used + # See if SD3 will be used if [[ $OPTIONS == *6* ]]; then - P_SD2="1" + P_SD3="1" else - P_SD2="0" + P_SD3="0" fi # See if Eluna will be used @@ -535,8 +644,8 @@ function GetBuildOptions() fi # Verify that at least one scripting library is enabled - if [ $P_SD2 -eq 0 ] && [ $P_ELUNA -eq 0 ]; then - Log "Error: You must enable either SD2, Eluna, or both to build MaNGOS!" 1 + if [ $P_SD3 -eq 0 ] && [ $P_ELUNA -eq 0 ]; then + Log "Error: You must enable either SD3, Eluna, or both to build MaNGOS!" 1 exit 1 fi } @@ -580,7 +689,7 @@ function BuildMaNGOS() # Attempt to configure and build MaNGOS Log "Building MaNGOS..." 0 cd "$SRCPATH/server/linux" - cmake .. -DDEBUG=$P_DEBUG -DUSE_STD_MALLOC=$P_STD_MALLOC -DACE_USE_EXTERNAL=$P_ACE_EXTERNAL -DPOSTGRESQL=$P_PGRESQL -DBUILD_TOOLS=$P_TOOLS -DSCRIPT_LIB_ELUNA=$P_ELUNA -DSCRIPT_LIB_SD2=$P_SD2 -DCMAKE_INSTALL_PREFIX="$INSTPATH" + cmake .. -DDEBUG=$P_DEBUG -DUSE_STD_MALLOC=$P_STD_MALLOC -DACE_USE_EXTERNAL=$P_ACE_EXTERNAL -DPOSTGRESQL=$P_PGRESQL -DBUILD_TOOLS=$P_TOOLS -DSCRIPT_LIB_ELUNA=$P_ELUNA -DSCRIPT_LIB_SD3=$P_SD3 -DCMAKE_INSTALL_PREFIX="$INSTPATH" make # Check for an error @@ -622,11 +731,9 @@ function InstallMaNGOS() fi } - - # Function to apply database updates function UpdateDatabases() -{ +{ local DB_HOST="$1" local DB_USER="$2" local DB_UPW="$3" @@ -634,81 +741,55 @@ function UpdateDatabases() local DB_WORLD="$5" local DB_TOONS="$6" - # Loop through the character directories - for pDir in $SRCPATH/database/Character/Updates/Rel* ; do - # Verify the item returned is a directory - if [ -d "$pDir" ]; then - # Now loop through all SQL files for the release - for pFile in $pDir/*.sql; do - # Verify the item is a real, existing file - if [ ! -f "$pFile" ]; then - continue - fi - - # Attempt to apply the update - mysql -h $DB_HOST -u $DB_USER -p$DB_UPW $DB_TOONS < "$pFile" > /dev/null 2>&1 - - # Notify the user of which updates were and were not applied - if [ $? -ne 0 ]; then - Log "Database update \"$pFile\" was not applied!" 0 - else - Log "Database update \"$pFile\" was successfully applied!" 0 - fi - done + # Loop through the character files + for pFile in $(ls $SRCPATH/database/Character/Updates/*.sql); do + if [ ! -f "$pFile" ]; then + continue fi + # Attempt to apply the update + mysql --login-path=local -q -s $DB_TOONS < "$pFile" > /dev/null 2>&1 + + # Notify the user of which updates were and were not applied + if [ $? -ne 0 ]; then + Log "Database update \"$pFile\" was not applied!" 0 + else + Log "Database update \"$pFile\" was successfully applied!" 0 + fi done - # Loop through the realm directories - for pDir in $SRCPATH/database/Realm/Updates/Rel* ; do - # Verify the item returned is a directory - if [ -d "$pDir" ]; then - # Now loop through all SQL files for the release - for pFile in $pDir/*.sql; do - # Verify the item is a real, existing file - if [ ! -f "$pFile" ]; then - continue - fi - - # Attempt to apply the update - mysql -h $DB_HOST -u $DB_USER -p$DB_UPW $DB_REALM < "$pFile" > /dev/null 2>&1 - - # Notify the user of which updates were and were not applied - if [ $? -ne 0 ]; then - Log "Database update \"$pFile\" was not applied!" 0 - else - Log "Database update \"$pFile\" was successfully applied!" 0 - fi - done + # Loop through the realm files + for pFile in $(ls $SRCPATH/database/Realm/Updates/*.sql); do + if [ ! -f "$pFile" ]; then + continue fi + # Attempt to apply the update + mysql --login-path=local -q -s $DB_REALM < "$pFile" > /dev/null 2>&1 + + # Notify the user of which updates were and were not applied + if [ $? -ne 0 ]; then + Log "Database update \"$pFile\" was not applied!" 0 + else + Log "Database update \"$pFile\" was successfully applied!" 0 + fi done - # Loop through the world directories - for pDir in $SRCPATH/database/World/Updates/Rel* ; do - # Verify the item returned is a directory - if [ -d "$pDir" ]; then - # Now loop through all SQL files for the release - for pFile in $pDir/*.sql; do - # Verify the item is a real, existing file - if [ ! -f "$pFile" ]; then - continue - fi - - # Attempt to apply the update - mysql -h $DB_HOST -u $DB_USER -p$DB_UPW $DB_WORLD < "$pFile" > /dev/null 2>&1 - - # Notify the user of which updates were and were not applied - if [ $? -ne 0 ]; then - Log "Database update \"$pFile\" was not applied!" 0 - else - Log "Database update \"$pFile\" was successfully applied!" 0 - fi - done + # Loop through the world files + for pFile in $(ls $SRCPATH/database/World/Updates/*.sql); do + if [ ! -f "$pFile" ]; then + continue fi + # Attempt to apply the update + mysql --login-path=local -q -s $DB_WORLD < "$pFile" > /dev/null 2>&1 + + # Notify the user of which updates were and were not applied + if [ $? -ne 0 ]; then + Log "Database update \"$pFile\" was not applied!" 0 + else + Log "Database update \"$pFile\" was successfully applied!" 0 + fi done } - - # Function to install or reinstall the databases function InstallDatabases() { @@ -720,7 +801,7 @@ function InstallDatabases() local DB_TOONS="$6" # First create the realm database structure - mysql -h $DB_HOST -u $DB_USER -p$DB_UPW $DB_REALM < $SRCPATH/database/Realm/Setup/realmdLoadDB.sql + mysql --login-path=local -q -s $DB_REALM < $SRCPATH/database/Realm/Setup/realmdLoadDB.sql # Check for success if [ $? -ne 0 ]; then @@ -729,7 +810,7 @@ function InstallDatabases() fi # Now create the characters database structure - mysql -h $DB_HOST -u $DB_USER -p$DB_UPW $DB_TOONS < $SRCPATH/database/Character/Setup/characterLoadDB.sql + mysql --login-path=local -q -s $DB_TOONS < $SRCPATH/database/Character/Setup/characterLoadDB.sql # Check for success if [ $? -ne 0 ]; then @@ -738,7 +819,7 @@ function InstallDatabases() fi # Next create the world database structure - mysql -h $DB_HOST -u $DB_USER -p$DB_UPW $DB_TOONS < $SRCPATH/database/World/Setup/mangosLoadDB.sql + mysql --login-path=local -q -s $DB_WORLD < $SRCPATH/database/World/Setup/mangosdLoadDB.sql # Check for success if [ $? -ne 0 ]; then @@ -749,31 +830,28 @@ function InstallDatabases() # Finally, loop through and build the world database database for fFile in $SRCPATH/database/World/Setup/FullDB/*.sql; do # Attempt to execute the SQL file - mysql -h $DB_HOST -u $DB_USER -p$DB_UPW $DB_WORLD < $fFile + mysql --login-path=local -q -s $DB_WORLD < $fFile # Check for success if [ $? -ne 0 ]; then Log "There was an error processing \"$fFile\" during database creation!" 1 return 1 fi - done + done # Now apply any updates - UpdateDatabases $DB_HOST $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS + UpdateDatabases $DB_HOST $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS } - - # Function to install or update the MySQL/MariaDB databases function HandleDatabases() { local DBMODE="0" local DB_TMP="0" - local DB_USER="zero" - local DB_UPW="zero" - local DB_ADMIN="root" - local DB_APW="root" + local DB_USER="mangos" + local DB_UPW="mangos" local DB_HOST="localhost" + local DB_PORT="3306" local DBSEL="3" local DB_REALM="_realm" local DB_WORLD="_world" @@ -799,36 +877,6 @@ function HandleDatabases() return 0 fi - # Get the database user username - DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Username" \ - --inputbox "Default: $DB_PREFIX" 8 60 3>&2 2>&1 1>&3) - - # Exit if cancelled - if [ $? -ne 0 ]; then - Log "DB user name entry cancelled. No modifications have been made to your databases." 1 - return 0 - fi - - # Set the user username if one was specified - if [ ! -z "$DB_TMP" ]; then - DB_USER="$DB_TMP" - fi - - # Get the database user password - DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Password" \ - --passwordbox "Default: $DB_PREFIX" 8 60 3>&2 2>&1 1>&3) - - # Exit if cancelled - if [ $? -ne 0 ]; then - Log "DB user PW entry cancelled. No modifications have been made to your databases." 1 - return 0 - fi - - # Set the user password if one was specified - if [ ! -z "$DB_TMP" ]; then - DB_UPW="$DB_TMP" - fi - # Get the database hostname or IP address DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Hostname Or IP Address" \ --inputbox "Default: localhost" 0 0 3>&2 2>&1 1>&3) @@ -844,20 +892,68 @@ function HandleDatabases() DB_HOST="$DB_TMP" fi + # Get the database port + DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database port" \ + --inputbox "Default: 3306" 0 0 3>&2 2>&1 1>&3) + + # Exit if cancelled + if [ $? -ne 0 ]; then + Log "DB port entry cancelled. No modifications have been made to your databases." 1 + return 0 + fi + + # Set the port number if one was specified + if [ ! -z "$DB_TMP" ]; then + DB_PORT="$DB_TMP" + fi + + # Get the database user username + DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Username" \ + --inputbox "Default: $DB_USER" 8 60 3>&2 2>&1 1>&3) + + # Exit if cancelled + if [ $? -ne 0 ]; then + Log "DB user name entry cancelled. No modifications have been made to your databases." 1 + return 0 + fi + + # Set the user username if one was specified + if [ ! -z "$DB_TMP" ]; then + DB_USER="$DB_TMP" + fi + + # Get the database user password + DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Password" \ + --passwordbox "Default: $DB_UPW" 8 60 3>&2 2>&1 1>&3) + + # Exit if cancelled + if [ $? -ne 0 ]; then + Log "DB user PW entry cancelled. No modifications have been made to your databases." 1 + return 0 + fi + + # Set the user password if one was specified + if [ ! -z "$DB_TMP" ]; then + DB_UPW="$DB_TMP" + fi + + printf "Confirm your MySQL password\t, " + mysql_config_editor set --login-path=local --host=$DB_HOST --port=$DB_PORT --user=$DB_USER --password --skip-warn + # Setup database names based on release DB_REALM="$DB_PREFIX$DB_REALM" DB_WORLD="$DB_PREFIX$DB_WORLD" DB_TOONS="$DB_PREFIX$DB_TOONS" # Install fresh databases if requested - if [ "$DBMODE" = "0" ]; then + if [ "$DBMODE" = "0" ]; then # Ask which databases to install/reinstall DBSEL=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Databases" \ --checklist "Select which databases should be (re)installed" 0 60 4 \ 0 "(Re)Install Realm Database" On \ 1 "(Re)Install World Database" On \ 2 "(Re)Install Characters Database" On \ - 3 "(Re)Create MaNGOS DB User" On \ + 3 "Update the realmlist" On \ 3>&2 2>&1 1>&3) # Exit if cancelled @@ -866,72 +962,23 @@ function HandleDatabases() return 0 fi - # Get the database admin username - DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Administrator Username" \ - --inputbox "Default: root" 8 60 3>&2 2>&1 1>&3) - - # Exit if cancelled - if [ $? -ne 0 ]; then - Log "DB admin entry cancelled. No modifications have been made to your databases." - return 0 - fi - - # Set the admin username if one was specified - if [ ! -z "$DB_TMP" ]; then - DB_ADMIN="$DB_TMP" - fi - - # Get the database admin password - DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Administrator Password" \ - --passwordbox "Default: root" 8 60 3>&2 2>&1 1>&3) - - # Exit if cancelled - if [ $? -ne 0 ]; then - Log "DB admin PW entry cancelled. No modifications have been made to your databases." - return 0 - fi - - # Set the admin password if one was specified - if [ ! -z "$DB_TMP" ]; then - DB_APW="$DB_TMP" - fi - - # Create the SQL file - echo "-- This file was was auto-generated by getmangos.sh" > ./getmangos.sql - # Remove and create the realm DB if selected if [[ $DBSEL == *0* ]]; then - echo "DROP DATABASE IF EXISTS \`$DB_REALM\`;" >> ./getmangos.sql - echo "CREATE DATABASE \`$DB_REALM\` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" >> ./getmangos.sql + mysql --login-path=local -q -s -e "DROP DATABASE IF EXISTS $DB_REALM;" + mysql --login-path=local -q -s -e "CREATE DATABASE $DB_REALM;" fi # Remove and create the world DB if selected if [[ $DBSEL == *1* ]]; then - echo "DROP DATABASE IF EXISTS \`$DB_WORLD\`;" >> ./getmangos.sql - echo "CREATE DATABASE \`$DB_WORLD\` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" >> ./getmangos.sql + mysql --login-path=local -q -s -e "DROP DATABASE IF EXISTS $DB_WORLD;" + mysql --login-path=local -q -s -e "CREATE DATABASE $DB_WORLD;" fi - + # Remove and create the character DB if selected - if [[ $DBSEL == *2* ]]; then - echo "DROP DATABASE IF EXISTS \`$DB_TOONS\`;" >> ./getmangos.sql - echo "CREATE DATABASE \`$DB_TOONS\` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" >> ./getmangos.sql - fi - - # Remove and create the MaNGOS DB user if selected - if [[ $DBEL == *3* ]]; then - # Create the user with no privileges if it does not exist and drop it - echo "GRANT USAGE ON *.* TO '$DB_USER'@'localhost';" >> ./getmangos.sql - echo "DROP USER '$DB_USER'@'localhost';" >> ./getmangos.sql - - # Create the database user - echo "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_UPW';" >> ./getmangos.sql - echo "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES ON \`$DB_REALM\`.* TO '$DB_USER'@'localhost';" >> ./getmangos.sql - echo "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES ON \`$DB_WORLD\`.* TO '$DB_USER'@'localhost';" >> ./getmangos.sql - echo "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES ON \`$DB_TOONS\`.* TO '$DB_USER'@'localhost';" >> ./getmangos.sql - fi - - # Execute the SQL file - mysql -h $DB_HOST -u $DB_ADMIN -p$DB_APW < ./getmangos.sql + if [[ $DBSEL == *2* ]]; then + mysql --login-path=local -q -s -e "DROP DATABASE IF EXISTS $DB_TOONS;" + mysql --login-path=local -q -s -e "CREATE DATABASE $DB_TOONS;" + fi # Validate success if [ $? -ne 0 ]; then @@ -939,20 +986,206 @@ function HandleDatabases() return 1 fi - # Clean up the temporary SQL file - rm -f ./getmangos.sql - # Finally, populate the databases InstallDatabases $DB_HOST $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS + + # Updating the realmlist + if [[ $DBSEL == *3* ]]; then + mysql --login-path=local -q -s $DB_REALM < $SRCPATH/database/Tools/updateRealm.sql + fi fi # Update the databases if requested - if [ "$DBMODE" = "1" ]; then + if [ "$DBMODE" = "1" ]; then UpdateDatabases $DB_HOST $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS fi } +# Function helper to extract resources (mmaps, vmaps, dbc, ...) from the game +function ExtractResources +{ + INSTGAMEPATH=$(dirname $(find /home -name "WoW.exe" 2>>/dev/null)) + GAMEPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "WoW Game Path" \ + --inputbox "Please, provide the path to your game directory. Default: $INSTGAMEPATH" 8 60 3>&2 2>&1 1>&3) + + if [ -z "$GAMEPATH" ]; then + GAMEPATH="$INSTGAMEPATH" + fi + + if [ ! -d "$GAMEPATH" ]; then + Log "There is no game at this location" 1 + exit 1 + fi + + ACTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \ + --checklist "Please select the extractions to perform" 0 70 3 \ + 1 "DBC and Maps" On \ + 2 "Vmaps" On \ + 3 "Mmaps" On \ + 3>&2 2>&1 1>&3) + + if [ ! -d "$INSTPATH/bin/tools" ]; then + Log "The mangos server is not build, cannot extract data" 1 + exit 1 + fi + + if [[ $ACTIONS == *1* ]]; then + if [ -d "$GAMEPATH/dbc" ]; then + $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "DBC and Maps were already generated" \ + --yesno "Do you want to generate them again?" 8 60 + + # Check the user's answer + if [ $? -eq 0 ]; then + Log "Deleting DBC and Maps previously generated." 1 + rm -rf $GAMEPATH/dbc + rm -rf $GAMEPATH/maps + + Log "Copying DBC and Maps extractor" 0 + rm -f "$GAMEPATH/map-extractor" + cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH" + + Log "Extracting DBC and Maps" 0 + cd $GAMEPATH + ./map-extractor + + if [ $? -eq 0 ]; then + Log "DBC and Maps are extracted" 0 + Log "Copying DBC and Maps files to installation directory" 0 + cp -R "$GAMEPATH/dbc" "$INSTPATH/bin" + cp -R "$GAMEPATH/maps" "$INSTPATH/bin" + rm -rf "$GAMEPATH/map-extractor" + Log "Changing ownership of the extracted directories" + chown -R $USER:$USER "$INSTPATH" + else + Log "There was an issue while extracting DBC and Maps!" 1 + rm -rf "$GAMEPATH/map-extractor" + rm -rf "$GAMEPATH/dbc" + rm -rf "$GAMEPATH/maps" + exit 1 + fi + else + Log "Copying DBC and Maps files to installation directory" 0 + cp -R "$GAMEPATH/dbc" "$INSTPATH/bin" + cp -R "$GAMEPATH/maps" "$INSTPATH/bin" + fi + fi + + + fi + + if [[ $ACTIONS == *2* ]]; then + if [ -d "$GAMEPATH/vmaps" ]; then + $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "VMaps were already generated" \ + --yesno "Do you want to generate them again?" 8 60 + + # Check the user's answer + if [ $? -eq 0 ]; then + Log "Deleting VMaps previously generated." 1 + rm -rf $GAMEPATH/vmaps + Log "Copying VMaps extractor" 0 + rm -f "$GAMEPATH/vmap-extractor" + cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH" + + Log "Extracting VMaps" 0 + cd $GAMEPATH + # Make sure there is no previous vmaps generation that cause issue. + rm -rf Buildings + ./vmap-extractor + + if [ $? -eq 0 ]; then + Log "VMaps are extracted" 0 + Log "Copying VMaps files to installation directory" 0 + cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin" + rm -rf "$GAMEPATH/vmap-extractor" + Log "Changing ownership of the extracted directories" + chown -R $USER:$USER "$INSTPATH" + else + Log "There was an issue while extracting VMaps!" 1 + rm -rf "$GAMEPATH/vmap-extractor" + rm -rf "$GAMEPATH/vmaps" + exit 1 + fi + else + Log "Copying VMaps files to installation directory" 0 + cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin" + fi + fi + fi + + if [[ $ACTIONS == *3* ]]; then + if [ ! -d "$GAMEPATH/maps" ]; then + Log "Error: maps files must be created to be able to generate MMaps!" 1 + exit 1 + fi + + if [ -d "$GAMEPATH/mmaps" ]; then + $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "MMaps were already generated" \ + --yesno "Do you want to generate them again?" 8 60 + + # Check the user's answer + if [ $? -eq 0 ]; then + Log "Deleting MMaps previously generated." 1 + rm -rf $GAMEPATH/mmaps + + Log "Copying MMaps extractor" 0 + rm -f "$GAMEPATH/MoveMapGen.sh" + cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH" + cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH" + cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH" + cp "$INSTPATH/bin/tools/movemap-generator" "$GAMEPATH" + + CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \ + --inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3) + + # User cancelled his choice, set default to 1. + if [ $? -ne 0 ]; then + Log "User selection was cancelled. Max CPU set to 1." 1 + CPU=1 + fi + + if [ -z "$CPU" ]; then + Log "User didn't gave any value. Max CPU set to 1." 1 + CPU=1 + fi + + if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then + Log "User entered invalid value. Max CPU set to 1." 1 + CPU=1 + fi + + Log "Extracting MMaps" 0 + cd $GAMEPATH + # Making sure we can execute the script + chmod 700 MoveMapGen.sh + ./MoveMapGen.sh $CPU + + if [ $? -eq 0 ]; then + Log "MMaps are extracted" 0 + Log "Copying MMaps files to installation directory" 0 + cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin" + rm -rf "$GAMEPATH/MoveMapGen.sh" + rm -rf "$GAMEPATH/offmesh.txt" + rm -rf "$GAMEPATH/mmap_excluded.txt" + rm -rf "$GAMEPATH/movemap-generator" + Log "Changing ownership of the extracted directories" + chown -R $USER:$USER "$INSTPATH" + else + Log "There was an issue while extracting MMaps!" 1 + rm -rf "$GAMEPATH/MoveMapGen.sh" + rm -rf "$GAMEPATH/mmaps" + rm -rf "$GAMEPATH/offmesh.txt" + rm -rf "$GAMEPATH/mmap_excluded.txt" + rm -rf "$GAMEPATH/movemap-generator" + exit 1 + fi + else + Log "Copying MMaps files to installation directory" 0 + cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin" + fi + fi + fi +} # Function to create a Code::Blocks project function CreateCBProject @@ -973,21 +1206,26 @@ function CreateCBProject Log "+------------------------------------------------------------------------------+" 0 Log "| MaNGOS Configuration Script |" 0 Log "| Written By: Ryan Ashley |" 0 +Log "| Updated By: Cedric Servais |" 0 Log "+------------------------------------------------------------------------------+" 0 +# Check if user who is running this is root +CheckRoot + # Select which dialog to use UseDialog # Select which activities to do TASKS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \ - --checklist "Please select the tasks to perform" 0 56 7 \ + --checklist "Please select the tasks to perform" 0 70 8 \ 1 "Install Prerequisites" Off \ 2 "Set Download And Install Paths" On \ 3 "Clone Source Repositories" On \ 4 "Build MaNGOS" On \ 5 "Install MaNGOS" On \ 6 "Install Databases" Off \ - 7 "Create Code::Blocks Project File" Off \ + 7 "Extract Resources" Off \ + 8 "Create Code::Blocks Project File" Off \ 3>&2 2>&1 1>&3) # Verify that the options were selected @@ -1002,8 +1240,12 @@ if [[ $TASKS == *1* ]]; then fi # Select release and set paths? -if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *6* ]] || [[ $TASKS == *7* ]]; then - GetRelease +if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then + GetUser + GetRelease +fi + +if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *6* ]] || [[ $TASKS == *7* ]]; then GetPaths fi @@ -1024,16 +1266,25 @@ if [[ $TASKS == *5* ]]; then fi # Install databases? -if [[ $TASKS == *6* ]]; then +if [[ $TASKS == *6* ]]; then HandleDatabases fi -# Create C::B project? +# Extract resources from the game? if [[ $TASKS == *7* ]]; then + ExtractResources +fi + +# Create C::B project? +if [[ $TASKS == *8* ]]; then CreateCBProject fi - +# If one of these actions has been performed, then we know the user. +if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then + Log "Changing ownership of the extracted directories" + chown -R $USER:$USER "$INSTPATH" +fi # Display the end message echo diff --git a/linux/lazymangos.sh b/linux/lazymangos.sh deleted file mode 100755 index 4ebb48e7..00000000 --- a/linux/lazymangos.sh +++ /dev/null @@ -1,1037 +0,0 @@ -#!/bin/bash -######################## -# Copyright (C) 2015 - getMaNGOS (www.getMaNGOS.eu) -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -######################## -#LazyMaNGOS 0.3 -######################## -# -#Supported Cores: -# MaNGOS Zero -# MaNGOS One -# MaNGOS Two -# MaNGOS Three -# -#Supported Distro(s): -# Debian 6+ (ubuntu, linux mint) -# Redhat 5+ (CentOS, fedora) -# -# Written By: Faded (emudevs.com) -#(faded@getmangos.eu) -# Updated By: Warkdev/Talendrys (getmangos.eu) -######################## - -#------------------------------------------------------------------------------- -# WARNING: If you do not know what you are doing, do not edit below this line! -#------------------------------------------------------------------------------- -set -e -###### -#Binds -###### -# Colors # -RCol='\e[0m' # Reset -#Regular Bold Underline -Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; -Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; -Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; -Yel='\e[0;33m'; BYel='\e[1;33m'; UYel='\e[4;33m'; -Blu='\e[0;34m'; BBlu='\e[1;34m'; UBlu='\e[4;34m'; -Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; -Cya='\e[0;36m'; BCya='\e[1;36m'; UCya='\e[4;36m'; -Whi='\e[0;37m'; BWhi='\e[1;37m'; UWhi='\e[4;37m'; - -proccnt="$(grep -c ^processor /proc/cpuinfo)" -options="" - -############## -# General Vars -############## -VERSION="NONE" -RELEASE="NONE" - -########### -# Functions -########### -#Print Header -header () -{ - clear - echo -e "${BWhi}--------------------------------------" - echo -e "${BGre}When you're too lazy to do it yourself" - echo -e "${BCya} ┻━┻︵ \(°□°)/ ︵ ┻━┻" - echo -e "${BWhi}--------------------------------------" - echo -e "${BGre} LazyMaNGOS .03" - echo -e "${BWhi}--------------------------------------" - echo -e "${BWhi}${BYel} [www.getmangos.eu]-[www.emudevs.com]" - echo -e "${BWhi}--------------------------------------" - echo -e "${RCol}" -} - -choose_modules() -{ - echo -e "" - opt_list=9 - echo -e "${BWhi}------------------------" - echo -e "${BGre}Choose sub modules to include:" - echo -e "${BWhi}------------------------" - echo -e "${BCya}1. Eluna (only)" - echo -e "${BCya}2. SD3 (only)" - echo -e "${BCya}3. Player Bots (early development)" - echo -e "${BCya}4. Eluna + Player Bots" - echo -e "${BCya}5. SD3 + Player Bots" - echo -e "${BCya}6. Eluna + SD3 + Player Bots" - echo -e "${BCya}7. Eluna + SD3 (recommended)" - echo -e "${BCya}8. None" - echo -e "${BWhi}------------------------" - echo -e "Choose (1-8)" - echo -n "-> " - while [ $opt_list -eq 9 ]; do - read opt_list - if [ $opt_list -eq 1 ]; then - options="-DSCRIPT_LIB_ELUNA=1 -DSCRIPT_LIB_SD3=0" - echo -e "${BGre}Eluna (only) selected" - sleep 2 - else - if [ $opt_list -eq 2 ]; then - options="-DSCRIPT_LIB_SD3=1" - echo -e "${BGre}SD3 (only) selected" - sleep 2 - else - if [ $opt_list -eq 3 ]; then - options="-DPLAYERBOTS=1 -DSCRIPT_LIB_SD3=0" - echo -e "${BGre}Player Bots (only) selected" - sleep 2 - else - if [ $opt_list -eq 4 ]; then - options="-DSCRIPT_LIB_ELUNA=1 -DPLAYERBOTS=1 -DSCRIPT_LIB_SD3=0" - echo -e "${BGre}Eluna + Player Bots" - sleep 2 - else - if [ $opt_list -eq 5 ]; then - options="-DSCRIPT_LIB_SD3=1 -DPLAYERBOTS=1" - echo -e "${BGre}SD3 + Player Bots selected" - sleep 2 - else - if [ $opt_list -eq 6 ]; then - options="-DSCRIPT_LIB_ELUNA=1 -DSCRIPT_LIB_SD3=1 -DPLAYERBOTS=1" - echo -e "${BGre}Eluna + SD3 + Player Bots selected" - sleep 2 - else - if [ $opt_list -eq 7 ]; then - options="-DSCRIPT_LIB_ELUNA=1 -DSCRIPT_LIB_SD3=1" - echo -e "${BGre}Eluna + SD3 selected" - sleep 2 - else - if [ $opt_list -eq 8 ]; then - options="-DSCRIPT_LIB_SD3=0" - echo -e "${BGre}None selected" - sleep 2 - else - echo -e "" - echo -e "Error: Selection not recognized." - echo -e "" - sleep 1 - echo -e "Please choose which options to include:" - echo -e "${BWhi}------------------------" - echo -e "${BCya}1. Eluna (only)" - echo -e "${BCya}2. SD3 (only)" - echo -e "${BCya}3. Player Bots (early development)" - echo -e "${BCya}4. Eluna + Player Bots" - echo -e "${BCya}5. SD3 + Player Bots" - echo -e "${BCya}6. Eluna + SD3 + Player Bots" - echo -e "${BCya}7. Eluna + SD3 (recommended)" - echo -e "${BCya}8. None" - echo -e "${BWhi}------------------------" - echo -e "Choose (1-8)" - echo -n "-> " - opt_list=9 - fi - fi - fi - fi - fi - fi - fi - fi - done -} - -mysql_setup() -{ - if [ -f "/home/${user}/database/InstallDatabases.sh" ]; then - sudo su - $user -c "cd /home/${user}/database; ./InstallDatabases.sh -s -d" - else - echo -e "Database configuration SKIPPED - Cannot find the script to setup the database" - fi -} - -choose_release() -{ - releases=$(curl -s 'https://api.github.com/repos/mangos${version}/server/branches | grep "name" | awk 'BEGIN{FS="\""}{print $4} | tr '\n' ' ') - max=$(echo ${releases} | wc -w) - selected=$((${max}+1)) - while [ ${selected} -eq $((${max}+1))]; do - cpt=1 - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Please choose which branch" - echo -e "${BWhi}---------------------------" - for rel in ${releases} - do - echo -e "${BCya}${cpt}. ${rel}" - cpt=$((${cpt}+1)) - done - echo -e "${BWhi}---------------------------" - echo -e "Choose" - echo -n "-> " - read selected - if [ ${selected} -gt ${max} ]; then - selected=${max} - fi - done - RELEASE=$(echo ${releases} | awk '{PRINT '${selected}'}') -} - -mangos_install() -{ - sleep 1 - choice=5 - while [ $choice -eq 5 ]; do - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Please choose which version" - echo -e "${BWhi}---------------------------" - echo -e "${BCya}1. Install MaNGOS Zero" - echo -e "${BCya}2. Install MaNGOS One" - echo -e "${BCya}3. Install MaNGOS Two" - echo -e "${BCya}4. Install MaNGOS Three" - echo -e "${BWhi}---------------------------" - echo -e "Choose" - echo -n "-> " - read choice - case $choice in - 1) - VERSION="zero" - ;; - 2) - VERSION="one" - ;; - 3) - VERSION="two" - ;; - 4) - VERSION="three" - ;; - *) - VERSION="NONE" - RELEASE="NONE" - choice=5 - continue - ;; - esac - - choose_release - - if [ ! -d "../../server" ]; then - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Cloning $VERSION... " - echo -e "${BWhi}-------------------------" - sleep 1 - su -c "cd /home/$user/ && git clone --recursive -b ${RELEASE} https://github.com/mangos${VERSION}/server.git" -s /bin/bash $user - else - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying $VERSION... " - echo -e "${BWhi}-------------------------" - sleep 1 - cp -R ../../server /home/$user/ - chown -R $user:$user /home/$user/server - fi - - if [ ! -d "../../database" ]; then - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Cloning Database..." - echo -e "${BWhi}-------------------------" - su -c "cd /home/$user/ && git clone --recursive -b ${RELEASE} https://github.com/mangos${VERSION}/database.git" -s /bin/bash $user - else - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying Database... " - echo -e "${BWhi}-------------------------" - sleep 1 - cp -R ../../database /home/$user/ - chown -R $user:$user /home/$user/database - fi - echo -e "${BCya}Done" - echo -e "" - sleep 1 - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Preparing ${VERSION}..." - echo -e "${BWhi}-------------------------" - sleep 1 - - choose_modules - - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Running CMake..." - echo -e "${BWhi}-------------------------" - sleep 1 - su -c "mkdir /home/$user/server/build" -s /bin/bash $user - su -c "cd /home/$user/server/build && cmake /home/$user/server $options -DCMAKE_INSTALL_PREFIX=/home/$user/zero" -s /bin/bash $user - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Compiling ${VERSION}..." - echo -e "${BWhi}-------------------------" - sleep 1 - su -c "cd /home/$user/server/build && make -j $proccnt" -s /bin/bash $user - su -c "cd /home/$user/server/build && make install" -s /bin/bash $user - ########## - #Setup SQL - ########## - mysql_setup - - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Adding auto restart scripts" - echo -e "${BWhi}-------------------------" - echo -e "" - su -c "mkdir /home/${user}/${VERSION}/scripts" -s /bin/bash $user - echo "while true; do - cd /home/$user/${VERSION}/bin - ./realmd - wait - done" >> /home/$user/${VERSION}/scripts/realmd_check.sh - echo "SESSION='realmd' - DAEMON='screen -d -m -S $SESSION /home/$user/${VERSION}/scripts/realmd_check.sh' - screen -r $SESSION -ls -q 2>&1 >/dev/null - echo -e '' - echo 'Realmd has been launched into the background.' - echo -e '' - if [ $? -le 10 ]; then - echo 'Restarting $DAEMON' - $DAEMON - fi - wait" >> /home/$user/${VERSION}/realmd.sh - echo "while true; do - cd /home/$user/${VERSION}/bin - ./mangos - wait - done - " >> /home/$user/${VERSION}/scripts/mangos_check.sh - echo "SESSION='mangos' - DAEMON='screen -d -m -S $SESSION /home/$user/${VERSION}/scripts/mangos_check.sh' - screen -r $SESSION -ls -q 2>&1 >/dev/null - echo -e '' - echo 'Mangos World has been launched into the background.' - echo -e '' - if [ $? -le 10 ]; then - echo 'Restarting $DAEMON' - $DAEMON - fi - wait" >> /home/$user/${VERSION}/mangos.sh - echo " - ######################## - #LazyMaNGOS .03 ${VERSION} - ######################## - - Important Information - - Server Location: /home/$user/${VERSION} - Config Location: /home/$user/${VERSION}/etc - - - What to do next - - From here on out, ONLY run the server as $user - Edit your configuration files as needed. - Then enter the ${VERSION}/bin directory and run - ./realmd & - ./mangos & - & means it will run in the background. - - Option 2: - Use the auto scripts in /${VERSION}/ - run ./realmd.sh & ./mangos.sh - - Dont forget to add your realm to the realms - table in the realmd database. - - Support: www.emudevs.com | www.getmangos.eu - " >> /home/$user/Lazy-README - chown -R $user:$user /home/$user/* - su -c "chmod +x /home/$user/${VERSION}/*.sh" -s /bin/bash $user - - if [ -f /home/${user}/db.conf ]; then - realmdb=$(head -1 /home/${user}/db.conf | tail -1) - mangosdb=$(head -2 /home/${user}/db.conf | tail -1) - chardb=$(head -3 /home/${user}/db.conf | tail -1) - if [ -f /home/${user}/${VERSION}/etc/mangosd.conf.dist ]; then - sed 's/LoginDatabaseInfo.*/LoginDatabaseInfo\t = '"\"${realmdb}\""'/g' /home/${user}/${VERSION}/etc/mangosd.conf.dist > /home/${user}/${VERSION}/etc/mangosd.conf - sed 's/WorldDatabaseInfo.*/WorldDatabaseInfo\t = '"\"${mangosdb}\""'/g' /home/${user}/${VERSION}/etc/mangosd.conf > /home/${user}/${VERSION}/etc/mangosd.conf.dist - sed 's/CharacterDatabaseInfo.*/CharacterDatabaseInfo\t = '"\"${chardb}\""'/g' /home/${user}/${VERSION}/etc/mangosd.conf.dist > /home/${user}/${VERSION}/etc/mangosd.conf - rm -rf /home/${user}/${VERSION}/etc/mangosd.conf.dist - fi - - if [ -f /home/${user}/${VERSION}/etc/realmd.conf.dist ]; then - sed 's/LoginDatabaseInfo.*/LoginDatabaseInfo\t = '"\"${realmdb}\""'/g' /home/${user}/${VERSION}/etc/realmd.conf.dist > /home/${user}/${VERSION}/etc/realmd.conf - rm -rf /home/${user}/${VERSION}/etc/realmd.conf.dist - fi - chown ${user}:${user} /home/${user}/${VERSION}/etc/mangosd.conf - chown ${user}:${user} /home/${user}/${VERSION}/etc/realmd.conf - rm -rf /home/${user}/db.conf - else - su -c "mv /home/$user/${VERSION}/etc/mangosd.conf.dist /home/$user/${VERSION}/etc/mangosd.conf" -s /bin/bash $user - su -c "mv /home/$user/${VERSION}/etc/realmd.conf.dist /home/$user/${VERSION}/etc/realmd.conf" -s /bin/bash $user - fi - - su -c "mv /home/$user/${VERSION}/etc/ahbot.conf.dist /home/$user/${VERSION}/etc/ahbot.conf" -s /bin/bash $user - - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Auto Restart Scripts" - echo -e "${BGre} Created " - echo -e "${BGre}First run ./realmd then run ./mangos" - echo -e "${BGre}Both scripts located in /home/$user/${VERSION}/" - echo -e "${BWhi}-------------------------" - echo -e "" - echo -e "${BWhi}---------------------------------------" - echo -e "${BGre}LazyMaNGOS Complete" - echo -e "${BGre}Please view the README in /home/$user/" - echo -e "${BWhi}---------------------------------------" - echo -e "" - - echo -e "" - echo -e "${BWhi}Provide the path of your game directory" - read path - - if [ -d "${path}" ]; then - dir=$(basename ${path}) - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying Game... " - echo -e "${BWhi}-------------------------" - sleep 1 - mkdir /home/${user}/${VERSION}/game - cp -R ${path} /home/${user}/${VERSION}/game - chown -R ${user}:${user} /home/${user}/${VERSION}/game - rm -rf /home/${user}/${VERSION}/game/${dir}/Buildings - rm -rf /home/${user}/${VERSION}/game/${dir}/vmaps - rm -rf /home/${user}/${VERSION}/game/${dir}/mmaps - rm -rf /home/${user}/${VERSION}/game/${dir}/maps - rm -rf /home/${user}/${VERSION}/game/${dir}/dbc - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying Tools... " - echo -e "${BWhi}-------------------------" - sleep 1 - sudo su - ${user} -c "cp -R /home/${user}/${VERSION}/bin/tools/* /home/${user}/${VERSION}/game/${dir}" - sudo su - ${user} -c "cd /home/${user}/${VERSION}/game/${dir}; ./ExtractResources.sh" - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving dbc... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/${VERSION}/game/${dir}/dbc /home/${user}/${VERSION}/bin" - -<<<<<<< HEAD -======= - Support: www.emudevs.com | www.getmangos.eu - " >> /home/$user/Lazy-README - chown -R $user:$user /home/$user/* - su -c "chmod +x /home/$user/zero/*.sh" -s /bin/bash $user - - if [ -f /home/${user}/db.conf ]; then - realmdb=$(head -1 /home/${user}/db.conf | tail -1) - mangosdb=$(head -2 /home/${user}/db.conf | tail -1) - chardb=$(head -3 /home/${user}/db.conf | tail -1) - - if [ -f /home/${user}/zero/etc/mangosd.conf.dist ]; then - sed 's/LoginDatabaseInfo.*/LoginDatabaseInfo\t = '"\"${realmdb}\""'/g' /home/${user}/zero/etc/mangosd.conf.dist > /home/${user}/zero/etc/mangosd.conf - sed 's/WorldDatabaseInfo.*/WorldDatabaseInfo\t = '"\"${mangosdb}\""'/g' /home/${user}/zero/etc/mangosd.conf > /home/${user}/zero/etc/mangosd.conf.dist - sed 's/CharacterDatabaseInfo.*/CharacterDatabaseInfo\t = '"\"${chardb}\""'/g' /home/${user}/zero/etc/mangosd.conf.dist > /home/${user}/zero/etc/mangosd.conf - rm -rf /home/${user}/zero/etc/mangosd.conf.dist - fi - - if [ -f /home/${user}/zero/etc/realmd.conf.dist ]; then - sed 's/LoginDatabaseInfo.*/LoginDatabaseInfo\t = '"\"${realmdb}\""'/g' /home/${user}/zero/etc/realmd.conf.dist > /home/${user}/zero/etc/realmd.conf - rm -rf /home/${user}/zero/etc/realmd.conf.dist - fi - chown ${user}:${user} /home/${user}/zero/etc/mangosd.conf - chown ${user}:${user} /home/${user}/zero/etc/realmd.conf - rm -rf /home/${user}/db.conf - else - su -c "mv /home/$user/zero/etc/mangosd.conf.dist /home/$user/zero/etc/mangosd.conf" -s /bin/bash $user - su -c "mv /home/$user/zero/etc/realmd.conf.dist /home/$user/zero/etc/realmd.conf" -s /bin/bash $user - fi - - su -c "mv /home/$user/zero/etc/ahbot.conf.dist /home/$user/zero/etc/ahbot.conf" -s /bin/bash $user - ->>>>>>> c45144249d0948dd2c49f4195a07c802c6eeb738 - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving vmaps... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/${VERSION}/game/${dir}/vmaps /home/${user}/${VERSION}/bin" - - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving mmaps... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/${VERSION}/game/${dir}/mmaps /home/${user}/${VERSION}/bin" - - echo -e "" -<<<<<<< HEAD - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving maps... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/${VERSION}/game/${dir}/maps /home/${user}/${VERSION}/bin" - fi -======= - - echo -e "" - echo -e "${BWhi}Provide the path of your game directory" - read path - - if [ -d "${path}" ]; then - dir=$(basename ${path}) - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying Game... " - echo -e "${BWhi}-------------------------" - sleep 1 - mkdir /home/${user}/zero/game - cp -R ${path} /home/${user}/zero/game - chown -R ${user}:${user} /home/${user}/zero/game - rm -rf /home/${user}/zero/game/${dir}/Buildings - rm -rf /home/${user}/zero/game/${dir}/vmaps - rm -rf /home/${user}/zero/game/${dir}/mmaps - rm -rf /home/${user}/zero/game/${dir}/maps - rm -rf /home/${user}/zero/game/${dir}/dbc - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying Tools... " - echo -e "${BWhi}-------------------------" - sleep 1 - sudo su - ${user} -c "cp -R /home/${user}/zero/bin/tools/* /home/${user}/zero/game/${dir}" - sudo su - ${user} -c "cd /home/${user}/zero/game/${dir}; ./ExtractResources.sh" - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving dbc... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/zero/game/${dir}/dbc /home/${user}/zero/bin" - - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving vmaps... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/zero/game/${dir}/vmaps /home/${user}/zero/bin" - - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving mmaps... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/zero/game/${dir}/mmaps /home/${user}/zero/bin" - - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Moving maps... " - echo -e "${BWhi}-------------------------" - sudo su - ${user} -c "mv /home/${user}/zero/game/${dir}/maps /home/${user}/zero/bin" - fi - - exit - else - if [ $choice -eq 2 ]; then - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Preparing for MaNGOS One" - echo -e "${BWhi}---------------------------" - echo -e "" - sleep 2 - ###### - #CleanUp & Install - ###### - if [ ! -d "../../server" ]; then - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Cloning MaNGOS One... " - echo -e "${BWhi}-------------------------" - sleep 1 - su -c "cd /home/$user/ && git clone --recursive -b develop21 https://github.com/mangosone/server.git" -s /bin/bash $user - else - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying MaNGOS One... " - echo -e "${BWhi}-------------------------" - sleep 1 - cp -R ../../server /home/$user/ - chown -R $user:$user /home/$user/server - fi - if [ ! -d "../../database" ]; then - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Cloning Database..." - echo -e "${BWhi}-------------------------" - su -c "cd /home/$user/ && git clone --recursive -b develop21 https://github.com/mangosone/database.git" -s /bin/bash $user - else - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Copying Database... " - echo -e "${BWhi}-------------------------" - sleep 1 - cp -R ../../database /home/$user/ - chown -R $user:$user /home/$user/database - fi - echo -e "${BCya}Done" - echo -e "" - sleep 1 - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Preparing MaNGOS One..." - echo -e "${BWhi}-------------------------" - sleep 1 - ###### - #Get One Options - ###### - choose_modules - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Running CMake..." - echo -e "${BWhi}-------------------------" - sleep 1 - su -c "mkdir /home/$user/server/build" -s /bin/bash $user - su -c "cd /home/$user/server/build && cmake ../ $options -DCMAKE_INSTALL_PREFIX=/home/$user/one" -s /bin/bash $user - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Compiling MaNGOS One..." - echo -e "${BWhi}-------------------------" - sleep 1 - su -c "cd /home/$user/server/build && make -j $proccnt" -s /bin/bash $user - su -c "cd /home/$user/server/build && make install" -s /bin/bash $user - ########## - #Setup SQL - ########## - mysql_setup - - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Adding auto restart scripts" - echo -e "${BWhi}-------------------------" - echo -e "" - su -c "mkdir /home/$user/one/scripts" -s /bin/bash $user - echo "while true; do - cd /home/$user/one/bin - ./realmd - wait - done" >> /home/$user/one/scripts/realmd_check.sh - echo "SESSION='realmd' - DAEMON='screen -d -m -S $SESSION /home/$user/one/scripts/realmd_check.sh' - screen -r $SESSION -ls -q 2>&1 >/dev/null - echo -e '' - echo 'Realmd has been launched into the background.' - echo -e "" - if [ $? -le 10 ]; then - echo 'Restarting $DAEMON' - $DAEMON - fi - wait" >> /home/$user/one/realmd.sh - echo "while true; do - cd /home/$user/one/bin - ./mangos - wait - done - " >> /home/$user/one/scripts/mangos_check.sh - echo "SESSION='mangos' - DAEMON='screen -d -m -S $SESSION /home/$user/one/scripts/mangos_check.sh' - screen -r $SESSION -ls -q 2>&1 >/dev/null - echo -e '' - echo 'Mangos World has been launched into the background.' - echo -e '' - if [ $? -le 10 ]; then - echo 'Restarting $DAEMON' - $DAEMON - fi - wait" >> /home/$user/one/mangos.sh - echo " - ######################## - #LazyMaNGOS .03 One - ######################## - - Important Information - - Server Location: /home/$user/one - Config Location: /home/$user/one/etc - - - What to do next - - From here on out, ONLY run the server as $user - Edit your configuration files as needed. - Then enter the one/bin directory and run - ./realmd & - ./mangos & - & means it will run in the background. - - Option 2: - Use the auto scripts in /one/ - run ./realmd.sh & ./mangos.sh - - Dont forget to add your realm to the realms - table in the realmd database. - - Support: www.emudevs.com | www.getmangos.eu - " >> /home/$user/Lazy-README - chown -R $user:$user /home/$user/* - su -c "chmod +x /home/$user/one/*.sh" -s /bin/bash $user - - if [ -f /home/${user}/db.conf ]; then - realmdb=$(head -1 /home/${user}/db.conf | tail -1) - mangosdb=$(head -2 /home/${user}/db.conf | tail -1) - chardb=$(head -3 /home/${user}/db.conf | tail -1) - - if [ -f /home/${user}/one/etc/mangosd.conf.dist ]; then - sed 's/LoginDatabaseInfo.*/LoginDatabaseInfo\t = '"\"${realmdb}\""'/g' /home/${user}/one/etc/mangosd.conf.dist > /home/${user}/one/etc/mangosd.conf - sed 's/WorldDatabaseInfo.*/WorldDatabaseInfo\t = '"\"${mangosdb}\""'/g' /home/${user}/one/etc/mangosd.conf > /home/${user}/one/etc/mangosd.conf.dist - sed 's/CharacterDatabaseInfo.*/CharacterDatabaseInfo\t = '"\"${chardb}\""'/g' /home/${user}/one/etc/mangosd.conf.dist > /home/${user}/one/etc/mangosd.conf - rm -rf /home/${user}/one/etc/mangosd.conf.dist - fi - - if [ -f /home/${user}/one/etc/realmd.conf.dist ]; then - sed 's/LoginDatabaseInfo.*/LoginDatabaseInfo\t = '"\"${realmdb}\""'/g' /home/${user}/one/etc/realmd.conf.dist > /home/${user}/one/etc/realmd.conf - rm -rf /home/${user}/one/etc/realmd.conf.dist - fi - - chown ${user}:${user} /home/${user}/one/etc/mangosd.conf - chown ${user}:${user} /home/${user}/one/etc/realmd.conf - rm -rf /home/${user}/db.conf - else - su -c "mv /home/$user/one/etc/mangosd.conf.dist /home/$user/one/etc/mangosd.conf" -s /bin/bash $user - su -c "mv /home/$user/one/etc/realmd.conf.dist /home/$user/one/etc/realmd.conf" -s /bin/bash $user - fi - - su -c "mv /home/$user/one/etc/ahbot.conf.dist /home/$user/one/etc/ahbot.conf" -s /bin/bash $user - - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Auto Restart Scripts" - echo -e "${BGre} Created " - echo -e "${BGre}First run ./realmd then run ./mangos" - echo -e "${BGre}Both scripts located in /home/$user/one/" - echo -e "${BWhi}-------------------------" - echo -e "" - echo -e "${BWhi}---------------------------------------" - echo -e "${BGre}LazyMaNGOS Complete" - echo -e "${BGre}Please view the README in /home/$user/" - echo -e "${BWhi}---------------------------------------" - echo -e "" - exit - else - if [ $choice -eq 3 ]; then - echo "Sorry, MaNGOS Two is currently disabled on LazyMaNGOS." - exit 1 - else - if [ $choice -eq 4 ]; then - echo "Sorry, MaNGOS Three is currently disabled on LazyMaNGOS." - exit 1 - else - echo -e "" - echo -e "Error: Selection not recognized." - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Please choose which version" - echo -e "${BWhi}---------------------------" - echo -e "${BCya}1. Install MaNGOS Zero (Classic)" - echo -e "${BCya}2. Install MaNGOS One (TBC)" - echo -e "${BCya}3. (Disabled) Install MaNGOS Two (WotLK)" - echo -e "${BCya}3. (Disabled) Install MaNGOS Three (Cataclysm)" - echo -e "${BWhi}---------------------------" - echo -e "Choose (1 or 2)" - echo -n "-> " - choice=5 - fi - fi - fi - fi ->>>>>>> c45144249d0948dd2c49f4195a07c802c6eeb738 - done -} - -header - -echo -e "Preparing..." -sleep 2 - -###### -#Distro Check -###### -echo -e "${RCol}" -echo -e "${BWhi}-------------------------" -echo -e "${BGre}Checking OS... " -echo -e "${BWhi}-------------------------" -sleep 1 -file="/etc/debian_version" -if [ -f "$file" ]; then - distro="debian" - echo -e "${BGre}Debian Detected" - echo -e "${RCol}" -else - file="/etc/redhat-release" - if [ -f "$file" ]; then - distro="redhat" - echo -e "${BGre}Redhat Detected" - echo -e "${RCol}" - else - echo -e "${BRed}Unsupported OS Detected" - echo -e "${BYel}This script only supports Debian and Redhat based distros" - echo -e "${BYel}Exiting" - echo -e "${RCol}" - exit - fi -fi - -###### -#Root Check -###### -echo -e "${RCol}" -echo -e "${BWhi}-------------------------" -echo -e "${BGre}Checking if root... " -echo -e "${BWhi}-------------------------" -sleep 1 -if [ "$(id -u)" != "0" ]; then - echo -e "${BRed}This script can ONLY be ran as root!" 1>&2 - echo -e "${RCol}" - exit -else - echo -e "${BGre}user is root!" - echo -e "${RCol}" -fi - -################# -# Obtain Username -################# -echo -e "${RCol}" -echo -e "${BWhi}-------------------------" -echo -e "${BGre}Enter desired username (not one in use) " -echo -e "${BWhi}-------------------------" -echo -n "-> " -read user -sleep 1 - - -while [ $distro ]; do -######################## -# Debian Based Install # -######################## - if [ $distro = "debian" ]; then - #Prepare for all debian distros - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Preparing the server..." - echo -e "${BGre}This may take a moment." - echo -e "${BWhi}-------------------------" - sleep 1 - ###### - #Fetch Username & Password - ###### - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Adding username: $user ..." - echo -e "${BWhi}---------------------------" - sleep 1 - useradd -m -d /home/$user $user - usermod -L $user - sleep 1 - echo -e "" - echo -e "${BWhi}--------------------" - echo -e "${BGre}Checking for sudo..." - echo -e "${BWhi}--------------------" - sleep 1 - sudofile="/etc/sudoers" - if [ -f "$sudofile" ]; then - echo -e "" - echo -e "${BGre}Sudoers is installed." - echo -e "${BGre}Updating User..." - echo "$user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers - sleep 1 - echo "" - echo -e "${BGre}User '$user' has been added to sudoers." - echo -e "" - else - echo "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Sudoers is NOT installed." - echo -e "${BGre}Attempting to install..." - echo -e "${BWhi}-------------------------" - apt-get -y -qq install sudo - sleep 1 - echo -e "" - echo -e "${BGre}Making sure sudo exists..." - echo -e "" - if [ -f "$sudofile" ]; then - echo "$user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers - sleep 1 - echo -e "" - echo -e "${BGre}Sudo exists" - echo -e "${BGre}User '$user' has been added to sudoers." - echo -e "" - else - echo -e "${BRed}Still unable to locate sudo." - echo -e "${BGre}Please make sure /etc/sudoers exists" - echo -e "${BGre}Or contact the coder, (faded@getmangos.eu)." - fi - fi - ###### - #MaNGOS Prepare - ###### - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Preparing Dependencies" - echo -e "${BWhi}---------------------------" - echo -e "" - sleep 2 - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Installing cmake tools..." - echo -e "${BWhi}-------------------------" - sleep 1 - apt-get -y -qq install cmake - apt-get -y -qq install cmake-qt-gui - echo -e "${BCya}Done" - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Installing git and compilers..." - echo -e "${BWhi}-------------------------" - sleep 1 - apt-get -y -qq install git - apt-get -y -qq install g++ - apt-get -y -qq install gcc - apt-get -y -qq install make - apt-get -y -qq install autoconf - echo -e "${BCya}Done" - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Installing required libraries..." - echo -e "${BWhi}-------------------------" - sleep 1 - apt-get -y -qq install libace-ssl-dev - apt-get -y -qq install libace-dev - apt-get -y -qq install libbz2-dev - apt-get -y -qq install libmysql++-dev - apt-get -y -qq install libmysqlclient-dev - apt-get -y -qq install libssl-dev - apt-get -y -qq install zlib1g-dev - apt-get -y -qq install libtool - echo -e "${BCya}Done" - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Installing mysql..." - echo -e "${BWhi}-------------------------" - sleep 1 - apt-get -y -qq install mysql-client - apt-get -y -qq install mysql-common - apt-get -y -qq install mysql-server - echo -e "${BCya}Done" - echo -e "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Finishing up..." - echo -e "${BWhi}-------------------------" - sleep 1 - apt-get -y -qq install bash - apt-get -y -qq install screen - apt-get -y -qq install wget - echo -e "${BCya}Done" - echo -e "" - mangos_install - else - ######################## - # Redhat Based Install # - ######################## - if [ $distro = "redhat" ]; then - #Prepare for all debian distros - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Preparing the server..." - echo -e "${BGre}This may take a moment." - echo -e "${BWhi}-------------------------" - sleep 2 - ###### - #Fetch Username & Password - ###### - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Adding username: $user ..." - echo -e "${BWhi}---------------------------" - sleep 1 - useradd -m -d /home/$user $user - usermod -L $user - sleep 1 - echo -e "" - echo -e "${BWhi}--------------------" - echo -e "${BGre}Checking for sudo..." - echo -e "${BWhi}--------------------" - sleep 1 - sudofile="/etc/sudoers" - if [ -f "$sudofile" ]; then - echo -e "" - echo -e "${BGre}Sudoers is installed." - echo -e "${BGre}Updating User..." - echo "mangos ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers - sleep 1 - echo "" - echo -e "${BGre}User '$user' has been added to sudoers." - echo -e "" - else - echo "" - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Sudoers is NOT installed." - echo -e "${BGre}Attempting to install..." - echo -e "${BWhi}-------------------------" - yum -y -q install sudo - sleep 1 - echo -e "" - echo -e "${BGre}Making sure sudo exists..." - echo -e "" - if [ -f "$sudofile" ]; then - echo "$user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers - sleep 1 - echo -e "" - echo -e "${BGre}Sudo exists" - echo -e "${BGre}User '$user' has been added to sudoers." - echo -e "" - else - echo -e "${BRed}Still unable to locate sudo." - echo -e "${BGre}Please make sure /etc/sudoers exists" - echo -e "${BGre}Or contact the coder, (faded@getmangos.eu)." - fi - fi - ###### - #MaNGOS Prepare - ###### - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Preparing Dependencies" - echo -e "${BWhi}---------------------------" - echo -e "" - sleep 2 - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Installing Dependencies..." - echo -e "${BWhi}---------------------------" - yum -y -q install git cmake openssl bzip2* openssl-devel - yum -y -q groupinstall "Development Tools" - echo -e "${BCya}Done" - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Fetching & Installing MySQL..." - echo -e "${BWhi}---------------------------" - rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm - yum -y -q install mysql-community-server - echo -e "${BCya}Done" - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Restarting MySQL" - echo -e "${BWhi}---------------------------" - systemctl enable mysqld - systemctl start mysqld - yum -y -q install mysql-devel - echo -e "${BCya}Done" - echo -e "" - echo -e "${BWhi}---------------------------" - echo -e "${BGre}Launching Secure MySQL Config..." - echo -e "${BGre}Press enter for no password, set a password and say Y to all questions" - echo -e "${BWhi}---------------------------" - echo -e "" - sleep 6 - mysql_secure_installation - echo -e "${BWhi}-------------------------" - echo -e "${BGre}Finishing up..." - echo -e "${BWhi}-------------------------" - sleep 1 - mangos_install - fi -fi -done -#END