Advertisement
Guest User

Untitled

a guest
Apr 12th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. root_password="r00t"
  4.  
  5. debconf-set-selections <<< 'mysql-server mysql-server/root_password password $root_password'
  6. debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password $root_password'
  7.  
  8. echo "Installing requirements"
  9. apt-get install -y mysql-server build-essential gcc g++ automake git-core \
  10. autoconf make patch libmysql++-dev libtool \
  11. libssl-dev grep binutils zlibc libc6 libbz2-dev cmake subversion libboost-all-dev
  12.  
  13. echo "Adding mangos group and user"
  14. groupadd mangos
  15. useradd -m -d /home/mangos -c "MANGoS" -g mangos mangos
  16.  
  17. echo "Switching to mangos home dir"
  18. cd /home/mangos/
  19.  
  20. echo "Cloning cmangos classic"
  21. git clone git://github.com/cmangos/mangos-classic.git mangos
  22.  
  23. echo "Cloning classic ACID"
  24. git clone git://github.com/ACID-Scripts/Classic.git acid
  25.  
  26. echo "Cloning ClassicDB"
  27. git clone git://github.com/classicdb/database.git classicdb
  28.  
  29. echo "Creating build and run folders"
  30. mkdir build
  31. mkdir run
  32.  
  33. echo "Switching to build folder"
  34. cd /home/mangos/build
  35.  
  36. echo "Running cmake"
  37. cmake ../mangos -DCMAKE_INSTALL_PREFIX=\../run -DDEBUG=0
  38.  
  39. echo "Running make"
  40. make
  41.  
  42. echo "Running make install"
  43. make install
  44.  
  45. echo "Switching to run folder"
  46. cd /home/mangos/run
  47.  
  48. echo "Copying maps, dbc, vmaps and mmaps from restore_data/"
  49. cp -r /tmp/restore_data/maps .
  50. cp -r /tmp/restore_data/dbc .
  51. cp -r /tmp/restore_data/vmaps .
  52. cp -r /tmp/restore_data/mmaps .
  53.  
  54. # Restoring config files
  55.  
  56. if [[ -f /tmp/restore_data/mangosd.conf ]];
  57. then
  58. echo "Restoring mangosd.conf"
  59. cp /tmp/restore_data/mangosd.conf .
  60. else
  61. echo "Creating new mangosd.conf"
  62. cp /home/mangos/mangos/src/mangosd/mangosd.conf.dist.in ./mangosd.conf
  63. fi
  64.  
  65. if [[ -f /tmp/restore_data/realmd.conf ]];
  66. then
  67. echo "Restoring realmd.conf"
  68. cp /tmp/restore_data/realmd.conf .
  69. else
  70. echo "Creating new realmd.conf"
  71. cp /home/mangos/mangos/src/realmd/realmd.conf.dist.in ./realmd.conf
  72. fi
  73.  
  74. if [[ -f /tmp/restore_data/ahbot.conf ]];
  75. then
  76. echo "Restoring realmd.conf"
  77. cp /tmp/restore_data/ahbot.conf .
  78. else
  79. echo "Creating new realmd.conf"
  80. cp /home/mangos/mangos/src/realmd/ahbot.conf.dist.in ./ahbot.conf
  81. fi
  82.  
  83. # Restoring/Initializing Databases
  84.  
  85. echo "Initializing mangos DB"
  86. mysql -uroot -p$root_password mangos < /home/mangos/mangos/sql/base/mangos.sql
  87.  
  88. if [[ -f /tmp/restore_data/characters.sql ]];
  89. then
  90. echo "Restoring characters DB"
  91. mysql -uroot -p$root_password < /tmp/restore_data/characters.sql
  92. else
  93. echo "Initializing character DB"
  94. mysql -uroot -p$root_password characters < /home/mangos/mangos/sql/base/characters.sql
  95. fi
  96.  
  97.  
  98. if [[ -f /tmp/restore_data/realmd.sql ]];
  99. then
  100. echo "Restoring realmd DB"
  101. mysql -uroot -p$root_password < /tmp/restore_data/realmd.sql
  102. else
  103. echo "Initializing realmd DB"
  104. mysql -uroot -p$root_password characters < /home/mangos/mangos/sql/base/characters.sql
  105. fi
  106.  
  107.  
  108. if [[ -f /tmp/restore_data/user.sql ]];
  109. then
  110. echo "Restoring user table"
  111. mysql -uroot -p$root_password mysql < /tmp/restore_data/user.sql
  112. else
  113. echo "Initializing tables"
  114. mysql -uroot -p$root_password < /home/mangos/sql/create/db_create_mysql.sql
  115. fi
  116.  
  117. # Installing ClassicDB
  118.  
  119. echo "Switching to classicdb folder"
  120. cd /home/mangos/classicdb
  121.  
  122. echo "Executing classicdb's InstallFullDB.sh"
  123. ./InstallFullDB.sh
  124.  
  125. echo "Configuring InstallFullDB.conf"
  126. sed -i -e 's/CORE_PATH=""/CORE_PATH="/home/mangos/mangos"/g' InstallFullDB.conf
  127. sed -i -e 's/USERNAME="mangos"/USERNAME="root"/g' InstallFullDB.conf
  128. sed -i -e 's/PASSWORD="mangos"/PASSWORD="$root_password"/g' InstallFullDB.conf
  129.  
  130. # Filling ScriptDev2 data
  131.  
  132. echo "Filling ScriptDev2 data"
  133. mysql -uroot -p$root_password mangos < /home/mangos/mangos/sql/scriptdev2/scriptdev2.sql
  134.  
  135. # Filling ACID data
  136. mysql -uroot -p$root_password mangos < /home/mangos/acid/acid_classic.sql
  137.  
  138.  
  139. echo "Done!"
  140. echo "run realmd and mangosd with the user mangos to run the server!"
  141. echo "If this is a new installation create a user by typing:"
  142. echo "account create MyNewAccount MyPassword"
  143. echo "in the mangosd console"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement