Install script clean up

This commit is contained in:
Marwolf
2018-08-21 10:53:23 -04:00
parent 47fe76d70e
commit 8b621635b6
4 changed files with 131 additions and 267 deletions

View File

@@ -3,20 +3,23 @@
source .env
# Check for any updates to the game server
cd Game
clear
echo "Pulling recent updates from the Open-RSC Game repository."
echo ""
echo ""
cd Game
sudo git pull
echo ""
echo ""
# Verifies permissions are set correctly
sudo chmod -R 777 Game
sudo setfacl -m user:$USER:rw /var/run/docker.sock
cd ..
echo ""
echo ""
echo "Do you need to do manual file editing for the website domain and SQL user/pass?"
clear
echo "Do you need to do any manual file editing?"
echo ""
echo "${RED}1${NC} - Yes, lets begin."
echo "${RED}2${NC} - Im all set"
echo "${RED}2${NC} - No, continue."
echo ""
echo "Which of the above do you wish to do? Type the choice number and press enter."
echo ""
@@ -24,98 +27,58 @@ 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
clear
sudo nano .env
sudo nano client/src/org/openrsc/client/Config.java
sudo nano Launcher/src/Main.java
sudo nano server/config/config.xml
sudo nano ../etc/ghost/config.production.json
echo ""
echo ""
echo "File edits complete. Restarting Docker containers."
echo ""
sudo nano Game/client/src/org/openrsc/client/Config.java
sudo nano Game/Launcher/src/Main.java
sudo nano Game/server/config/config.xml
sudo nano etc/ghost/config.production.json
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
# Server
cd Game
clear
echo "Preparing the game server."
echo ""
sudo ant -f "server/build.xml" compile
#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 ""
# Client
clear
echo "Preparing the game client."
echo ""
sudo ant -f "client/build.xml" compile
cd client
sudo zip -r "client.zip" "Open_RSC_Client.jar"
cd ../
yes | sudo cp -rf "client/client.zip" "../Website/downloads/"
sudo rm "client/client.zip"
# 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 ""
# Launcher
clear
echo "Preparing the game launcher."
echo ""
sudo ant -f "Launcher/build.xml" jar
yes | sudo cp -rf "Launcher/dist/Open_RSC_Launcher.jar" "../Website/downloads/"
# 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
clear
echo "Preparing the cache."
yes | sudo cp -rf "client/cache.zip" "../Website/downloads/"
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
# 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
# Database
clear
echo "Preparing the database."
echo ""
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
# Run the game server in a detached screen
./Linux_Run_Production_Server.sh
#cd ../../
#touch current_md5sum.txt
#tar -cf - Game | md5sum | grep -o '^[a-zA-Z0-9]*' > current_md5sum.txt
sudo ./Linux_Run_Production_Server.sh