Merge pull request #10 from Marwolf/master
Script clean up, enhancements
This commit is contained in:
129
Linux_Fetch_Updates_Production.sh
Executable file
129
Linux_Fetch_Updates_Production.sh
Executable 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
|
||||
@@ -117,7 +117,7 @@ if [ "$install" == "1" ]; then
|
||||
echo "sudo ufw enable"
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Do you have Oracle Java JDK 8 and Gradle installed already? It is required for this."
|
||||
echo "Do you have Oracle Java JDK 8 and Ant installed already? It is required for this."
|
||||
echo ""
|
||||
echo "${RED}1${NC} - Install for me!"
|
||||
echo "${RED}2${NC} - Im all set"
|
||||
@@ -130,7 +130,7 @@ if [ "$install" == "1" ]; then
|
||||
# Ubuntu Java ===================================================>
|
||||
if [ "$java" == "1" ]; then
|
||||
sudo apt-get remove openjdk-6-jre default-jre default-jre-headless -y
|
||||
sudo add-apt-repository ppa:webupd8team/java -y && sudo apt update && sudo apt install gradle ant oracle-java8-set-default openjfx -y
|
||||
sudo add-apt-repository ppa:webupd8team/java -y && sudo apt update && sudo apt install ant oracle-java8-set-default openjfx -y
|
||||
else
|
||||
continue
|
||||
fi
|
||||
@@ -159,7 +159,7 @@ if [ "$install" == "1" ]; then
|
||||
firewall-cmd --reload
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Do you have Oracle Java JDK 8 and Gradle installed already? It is required for this."
|
||||
echo "Do you have Oracle Java JDK 8 and Ant installed already? It is required for this."
|
||||
echo ""
|
||||
echo "${RED}1${NC} - Install for me!"
|
||||
echo "${RED}2${NC} - Im all set"
|
||||
@@ -171,7 +171,7 @@ if [ "$install" == "1" ]; then
|
||||
|
||||
# Fedora Java ===================================================>
|
||||
if [ "$java" == "1" ]; then
|
||||
sudo dnf -y install gradle ant openjfx
|
||||
sudo dnf -y install ant openjfx
|
||||
wget --no-cookies \
|
||||
--no-check-certificate \
|
||||
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
|
||||
@@ -259,7 +259,7 @@ if [ "$install" == "1" ]; then
|
||||
firewall-cmd --reload
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Do you have Oracle Java JDK 8 and Gradle installed already? It is required for this."
|
||||
echo "Do you have Oracle Java JDK 8 and Ant installed already? It is required for this."
|
||||
echo ""
|
||||
echo "${RED}1${NC} - Install for me!"
|
||||
echo "${RED}2${NC} - Im all set"
|
||||
@@ -271,7 +271,7 @@ if [ "$install" == "1" ]; then
|
||||
|
||||
# CentOS 7 Java ===================================================>
|
||||
if [ "$java" == "1" ]; then
|
||||
sudo dnf -y install gradle ant openjfx
|
||||
sudo dnf -y install ant openjfx
|
||||
wget --no-cookies \
|
||||
--no-check-certificate \
|
||||
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
|
||||
@@ -355,7 +355,7 @@ if [ "$install" == "1" ]; then
|
||||
brew install unzip wget git curl zip screen
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Do you have Oracle Java JDK 8 and Gradle installed already? It is required for this."
|
||||
echo "Do you have Oracle Java JDK 8 and Ant installed already? It is required for this."
|
||||
echo ""
|
||||
echo "${RED}1${NC} - Install for me!"
|
||||
echo "${RED}2${NC} - Im all set"
|
||||
@@ -368,7 +368,7 @@ if [ "$install" == "1" ]; then
|
||||
# Mac Java ===================================================>
|
||||
if [ "$java" == "1" ]; then
|
||||
brew tap AdoptOpenJDK/openjdk
|
||||
brew install adoptopenjdk-openjdk8 gradle ant openjfx
|
||||
brew install adoptopenjdk-openjdk8 ant openjfx
|
||||
fi
|
||||
# Mac Java <===================================================
|
||||
|
||||
@@ -438,7 +438,7 @@ if [ "$install" == "1" ]; then
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Do you have Oracle Java JDK 8 and Gradle installed already? It is required for this. If it fails, install manually."
|
||||
echo "Do you have Oracle Java JDK 8 and Ant installed already? It is required for this. If it fails, install manually."
|
||||
echo ""
|
||||
echo "${RED}1${NC} - Install for me!"
|
||||
echo "${RED}2${NC} - Im all set"
|
||||
@@ -451,7 +451,7 @@ if [ "$install" == "1" ]; then
|
||||
# Other OS Java ===================================================>
|
||||
if [ "$java" == "1" ]; then
|
||||
sudo apt-get remove openjdk-6-jre default-jre default-jre-headless -y
|
||||
sudo add-apt-repository ppa:webupd8team/java -y && sudo apt update && sudo apt install gradle ant oracle-java8-set-default openjfx -y
|
||||
sudo add-apt-repository ppa:webupd8team/java -y && sudo apt update && sudo apt install ant oracle-java8-set-default openjfx -y
|
||||
else
|
||||
continue
|
||||
fi
|
||||
@@ -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
13
Linux_Run_Production_Server.sh
Executable 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
|
||||
85
Linux_Single_Player.sh
Executable file
85
Linux_Single_Player.sh
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
source .env
|
||||
|
||||
# Check for any updates to the game server
|
||||
echo ""
|
||||
echo "Pulling recent updates from the Open-RSC Game repository."
|
||||
echo ""
|
||||
sudo git pull
|
||||
sudo make pull-game
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Starting Docker containers."
|
||||
echo ""
|
||||
sudo make start-single-player
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
cd Game
|
||||
if git diff --name-only | grep -o '[a-zA-Z0-9]*.java' > /dev/null; then
|
||||
|
||||
# Compile the game server and client
|
||||
echo "Compiling the game client."
|
||||
echo ""
|
||||
sudo ant -f "client/build.xml" compile
|
||||
#sudo gradle -b "client/build.gradle" compile
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Compiling the game server."
|
||||
echo ""
|
||||
sudo ant -f "server/build.xml" compile
|
||||
#sudo gradle -b "server/build.gradle" compile
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
fi
|
||||
cd ../
|
||||
|
||||
#Create game cache
|
||||
echo "Removing old cache if exists and then extracting a fresh client cache to your home folder."
|
||||
echo ""
|
||||
sudo rm -rf ~/OpenRSC
|
||||
mkdir ~/OpenRSC
|
||||
unzip -o Game/client/cache.zip -d ~/OpenRSC >/dev/null
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
cd Game
|
||||
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"$MYSQL_ROOT_USER" -p"$MYSQL_ROOT_PASSWORD" < Game/Databases/openrsc_config.sql 2>/dev/null
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
#Generate updated cache files, copies them to cache folder overwriting existing
|
||||
echo "Generating cache .dat files from current config database and copying to client cache in your home folder."
|
||||
echo ""
|
||||
sudo ant -f Game/server/build.xml npcs items objects > /dev/null
|
||||
yes | cp -rf Game/server/npcs.dat ~/OpenRSC/npcs.dat
|
||||
yes | cp -rf Game/server/objects.dat ~/OpenRSC/objects.dat
|
||||
yes | cp -rf Game/server/items.dat ~/OpenRSC/items.dat
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
fi
|
||||
cd ../
|
||||
|
||||
# Run the game client in a new window
|
||||
echo "Launching the game client."
|
||||
echo ""
|
||||
ant -f Game/client/build.xml runclient &
|
||||
#java -jar Game/client/Open_RSC_Client.jar &
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# Run the game server in the current window
|
||||
echo "Launching the game server."
|
||||
echo ""
|
||||
#ant -f Game/server/build.xml runserver
|
||||
cd Game/server
|
||||
java -jar Open_RSC_Server.jar
|
||||
echo ""
|
||||
2
Makefile
2
Makefile
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check for any updates to the game server
|
||||
echo ""
|
||||
echo "Pulling recent updates from the Open-RSC Game repository."
|
||||
echo ""
|
||||
sudo git pull
|
||||
sudo make pull-game
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Starting Docker containers."
|
||||
echo ""
|
||||
sudo make start-single-player
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# Compile the game server and 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 "Compiling the game server."
|
||||
echo ""
|
||||
#sudo ant -f Game/server/build.xml compile
|
||||
sudo gradle -b Game/server/build.gradle compile
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
#Create game cache
|
||||
echo "Removing old then extracting a fresh client cache to your home folder."
|
||||
echo ""
|
||||
sudo rm -rf ~/OpenRSC
|
||||
mkdir ~/OpenRSC
|
||||
unzip -o Game/client/cache.zip -d ~/OpenRSC >/dev/null
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
#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
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
#Generate updated cache files, copies them to cache folder overwriting existing
|
||||
echo "Generating cache .dat files from current config database and copying to client cache in your home folder."
|
||||
echo ""
|
||||
sudo ant -f Game/server/build.xml npcs items objects > /dev/null
|
||||
yes | cp -rf Game/server/npcs.dat ~/OpenRSC/npcs.dat
|
||||
yes | cp -rf Game/server/objects.dat ~/OpenRSC/objects.dat
|
||||
yes | cp -rf Game/server/items.dat ~/OpenRSC/items.dat
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# Run the game client in a new window
|
||||
echo "Launching the game client."
|
||||
echo ""
|
||||
#ant -f Game/client/build.xml runclient &
|
||||
java -jar Game/client/Open_RSC_Client.jar &
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# Run the game server in the current window
|
||||
echo "Launching the game server."
|
||||
echo ""
|
||||
#ant -f Game/server/build.xml runserver
|
||||
cd Game/server
|
||||
java -jar Open_RSC_Server.jar
|
||||
echo ""
|
||||
@@ -59,9 +59,9 @@ goto doinstall
|
||||
|
||||
:installjava
|
||||
echo:
|
||||
echo Installing Oracle Java JDK 8 and Gradle.
|
||||
echo Installing Oracle Java JDK 8 and Ant.
|
||||
echo:
|
||||
choco install -y jdk8 gradle ant
|
||||
choco install -y jdk8 ant
|
||||
echo:
|
||||
echo:
|
||||
goto askdocker
|
||||
@@ -17,12 +17,12 @@ echo:
|
||||
REM Compile the game server and client:
|
||||
echo Compiling the game client.
|
||||
echo:
|
||||
call gradle -b Game/client/build.gradle compile
|
||||
call ant -f Game/client/build.xml compile
|
||||
echo:
|
||||
echo:
|
||||
echo Compiling the game server.
|
||||
echo:
|
||||
call gradle -b Game/server/build.gradle compile
|
||||
call ant -f Game/server/build.xml compile
|
||||
echo:
|
||||
echo:
|
||||
|
||||
@@ -45,7 +45,7 @@ echo:
|
||||
REM Generate updated cache files, copies them to cache folder overwriting existing:
|
||||
echo Generating cache .dat files from current config database and copying to client cache in your home folder.
|
||||
echo:
|
||||
call sudo gradle -b Game/server/build.gradle npcs items objects > NULL
|
||||
call sudo ant -f Game/server/build.xml npcs items objects > NULL
|
||||
xcopy /y "Game/server/npcs.dat" "%HOMEPATH%/OpenRSC/npcs.dat"
|
||||
xcopy /y "Game/server/objects.dat" "%HOMEPATH%/OpenRSC/objects.dat"
|
||||
xcopy /y "Game/server/items.dat" "%HOMEPATH%/OpenRSC/items.dat"
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user