Script clean up, enhancement

This commit is contained in:
Marwolf
2018-08-15 01:28:18 -04:00
parent 80720289b5
commit 8b5fb1804e
15 changed files with 146 additions and 89 deletions

129
Linux_Fetch_Updates_Production.sh Executable file
View File

@@ -0,0 +1,129 @@
#!/bin/bash
source .env
# Check for any updates to the game server
cd Game
echo "Pulling recent updates from the Open-RSC Game repository."
echo ""
echo ""
sudo git pull
echo ""
echo ""
echo ""
echo ""
echo "Do you need to do manual file editing for the website domain and SQL user/pass?"
echo ""
echo "${RED}1${NC} - Yes, lets begin."
echo "${RED}2${NC} - Im all set"
echo ""
echo "Which of the above do you wish to do? Type the choice number and press enter."
echo ""
echo ""
read edit
if [ "$edit" == "1" ]; then
echo ""
echo ""
echo "(Use Ctrl + X to save each file when done editing) - Press enter when ready."
read next
sudo nano .env
sudo nano client/src/org/openrsc/client/Config.java
sudo nano Launcher/src/Main.java
sudo nano server/config/config.xml
echo ""
echo ""
echo "File edits complete. Restarting Docker containers."
echo ""
sudo make stop
sudo make start
fi
if [ "$edit" == "2" ]; then
echo ""
echo "Moving on..."
echo ""
echo ""
fi
#cd ../
#touch new_md5sum.txt
#tar -cf - Game | md5sum | grep -o '^[a-zA-Z0-9]*' > new_md5sum.txt
#cd Game
#if [ "(cat current_md5sum.txt)" == "(cat new_md5sum.txt)" ]; then
# Echo "No file changes have been detected since last run."
#else
# Compile server
echo "Compiling the game server."
echo ""
echo ""
sudo ant -f "server/build.xml" compile
echo ""
echo ""
# Compile client
echo "Compiling the game client."
echo ""
sudo ant -f "client/build.xml" compile
echo ""
echo ""
echo "Compressing jar into zip"
echo ""
cd client
sudo zip -r "client.zip" "Open_RSC_Client.jar"
cd ../
echo ""
echo ""
echo "Copying result to Website/downloads/"
echo ""
yes | sudo cp -rf "client/client.zip" "../Website/downloads/"
sudo rm "client/client.zip"
echo ""
echo ""
# Compile launcher
echo "Compiling the game launcher."
echo ""
sudo ant -f "Launcher/build.xml" jar
echo ""
echo ""
echo "Copying result to Website/downloads/"
echo ""
yes | sudo cp -rf "Launcher/dist/Open_RSC_Launcher.jar" "../Website/downloads/"
echo ""
echo ""
# Cache
echo "Copying Game/client/cache.zip to Website/downloads/"
yes | sudo cp -rf "client/cache.zip" "../Website/downloads/"
# MD5sum client.zip and cache.zip > hashes.txt
cd ../
sudo rm Website/downloads/hashes.txt
md5sum Website/downloads/client.zip | grep ^[a-zA-Z0-9]* | awk '{print "client="$1}' | sudo tee -a Website/downloads/hashes.txt
md5sum Website/downloads/cache.zip | grep ^[a-zA-Z0-9]* | awk '{print "cache="$1}' | sudo tee -a Website/downloads/hashes.txt
# Replace the openrsc_config database with a fresh version
echo ""
echo ""
echo "Importing fresh openrsc_config.sql database."
echo ""
sudo docker exec -i $(sudo docker-compose ps -q mysqldb) mysql -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" < Game/Databases/openrsc_config.sql 2>/dev/null
#fi
# Run the game server in a detached screen
echo ""
echo ""
echo "Launching the game server in a new screen."
echo ""
echo "Type 'screen -r' to access the game server screen."
echo "Use CTRL + A + D to detach the live server screen so it runs in the background."
echo ""
echo ""
cd Game/server
screen -dmS name ./ant_launcher.sh
#cd ../../
#touch current_md5sum.txt
#tar -cf - Game | md5sum | grep -o '^[a-zA-Z0-9]*' > current_md5sum.txt

View File

@@ -565,7 +565,6 @@ elif [ "$choice" == "2" ]; then
sudo nano .env
sudo nano Game/client/src/org/openrsc/client/Config.java
sudo nano Game/Launcher/src/Main.java
sudo nano Run_Production_Linux_Game_Server.sh
sudo nano Game/server/config/config.xml
echo ""
echo ""

13
Linux_Run_Production_Server.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Run the game server in a detached screen
echo ""
echo ""
echo "Launching the game server in a new screen."
echo ""
echo "Type 'screen -r' to access the game server screen."
echo "Use CTRL + A + D to detach the live server screen so it runs in the background."
echo ""
echo ""
cd Game/server
screen -dmS name ./ant_launcher.sh

View File

@@ -1,5 +1,7 @@
#!/bin/bash
source .env
# Check for any updates to the game server
echo ""
echo "Pulling recent updates from the Open-RSC Game repository."
@@ -49,7 +51,7 @@ if git diff --name-only | grep -o '[a-zA-Z0-9]*.sql' > /dev/null; then
#Import fresh version of config database
echo "Importing a fresh openrsc_config.sql database."
echo ""
sudo docker exec -i $(sudo docker-compose ps -q mysqldb) mysql -u"root" -p"root" < Game/Databases/openrsc_config.sql 2>/dev/null
sudo docker exec -i $(sudo docker-compose ps -q mysqldb) mysql -u"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" < Game/Databases/openrsc_config.sql 2>/dev/null
echo ""
echo ""

View File

@@ -3,7 +3,7 @@ include .env
MYSQL_DUMPS_DIR=./data/db
start:
docker-compose --file docker-compose.yml up --force-recreate --remove-orphans -d
docker-compose --file docker-compose.yml up -d
start-single-player:
docker-compose --file docker-compose-single-player.yml up -d

View File

@@ -1,75 +0,0 @@
#!/bin/bash
# Check for any updates to the game server
echo "Pulling recent updates from the Open-RSC Game repository."
echo ""
echo ""
sudo make pull-game
echo ""
echo ""
# Compile the game server
echo "Compiling the game server."
echo ""
echo ""
#sudo ant -f Game/server/build.xml compile
sudo gradle -b Game/server/build.gradle compile
echo ""
echo ""
# Client
echo "Compiling the game client."
echo ""
#sudo ant -f "Game/client/build.xml" compile
sudo gradle -b Game/client/build.gradle compile
echo ""
echo ""
echo "Compressing jar into zip"
echo ""
cd Game/client
sudo zip -r "client.zip" "Open_RSC_Client.jar"
cd ../../
echo ""
echo ""
echo "Copying result to Website/downloads/"
echo ""
yes | sudo cp -rf "Game/client/client.zip" "Website/downloads/"
sudo rm "Game/client/client.zip"
echo ""
echo ""
# Launcher
echo "Compiling the game launcher."
echo ""
#sudo ant -f "Game/Launcher/build.xml" jar
sudo gradle -b Game/Launcher/build.gradle jar
echo ""
echo ""
echo "Copying result to Website/downloads/"
echo ""
yes | sudo cp -rf "Game/Launcher/dist/Open_RSC_Launcher.jar" "Website/downloads/"
echo ""
echo ""
# Cache
echo "Copying Game/client/cache.zip to Website/downloads/"
yes | sudo cp -rf "Game/client/cache.zip" "Website/downloads/"
# MD5sum client.zip and cache.zip > hashes.txt
sudo rm Website/downloads/hashes.txt
md5sum Website/downloads/client.zip | grep ^[a-zA-Z0-9]* | awk '{print "client="$1}' | sudo tee -a Website/downloads/hashes.txt
md5sum Website/downloads/cache.zip | grep ^[a-zA-Z0-9]* | awk '{print "cache="$1}' | sudo tee -a Website/downloads/hashes.txt
# Run the game server in a detached screen
echo "Importing fresh openrsc_config.sql database."
echo ""
sudo docker exec -i $(sudo docker-compose ps -q mysqldb) mysql -u"root" -p"root" < Game/Databases/openrsc_config.sql 2>/dev/null
echo ""
echo ""
echo "Launching the game server in a new screen."
echo ""
echo "Type 'screen -r' to access the game server screen."
echo "Use CTRL + A + D to detach the live server screen so it runs in the background."
echo ""
echo ""
screen -dmS name ./ant_launcher.sh

View File

@@ -1,11 +0,0 @@
#!/bin/bash
# Run the game server
echo ""
echo "Running the game server. Press CTRL + C to shut it down or"
echo "CTRL + A + D to detach the screen so this continues in the background."
echo ""
echo "Console output is being saved to gameserver.log"
echo ""
cd Game/server
java -jar "Open_RSC_Server.jar" > ../../gameserver.log