mirror of
				https://github.com/solero/wand.git
				synced 2025-11-03 22:22:03 +00:00 
			
		
		
		
	QoL + MacOS installation (#32)
* made the question at the start
I made it so the user will be able to leave the server alone after answering the questions
* Added the option to run the game when installation ends
* QoL update
* Now I'm logging the First Run and the installation process
* Revert "Now I'm logging the First Run and the installation process"
This reverts commit d5136cde94.
* Added automatic seperate for Linux and Darwin (MacOS)
			
			
This commit is contained in:
		
							
								
								
									
										55
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								install.sh
									
									
									
									
									
								
							@@ -1,17 +1,6 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
clear
 | 
					clear
 | 
				
			||||||
echo "Setting up the enviroment."
 | 
					echo "Please answer these questions to set up the game:"
 | 
				
			||||||
sudo apt update
 | 
					 | 
				
			||||||
sudo apt install docker.io git curl
 | 
					 | 
				
			||||||
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 | 
					 | 
				
			||||||
sudo chmod +x /usr/local/bin/docker-compose
 | 
					 | 
				
			||||||
echo "Done setting up the enviroment."
 | 
					 | 
				
			||||||
echo "Downloading Game Files"
 | 
					 | 
				
			||||||
git clone --recurse-submodules https://github.com/solero/wand && cd wand
 | 
					 | 
				
			||||||
echo "Done Downloading the game files."
 | 
					 | 
				
			||||||
sudo rm -r .env
 | 
					 | 
				
			||||||
echo "Please answer this questions for setting up the game:"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "Enter password for the database (leave empty for a random password):"
 | 
					echo "Enter password for the database (leave empty for a random password):"
 | 
				
			||||||
dbpass=""
 | 
					dbpass=""
 | 
				
			||||||
while IFS= read -r -s -n1 char; do
 | 
					while IFS= read -r -s -n1 char; do
 | 
				
			||||||
@@ -32,17 +21,44 @@ if [ -z "$dbpass" ]; then
 | 
				
			|||||||
    dbpass=$(openssl rand -base64 12)
 | 
					    dbpass=$(openssl rand -base64 12)
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "enter the hostname for the game (example: example.com) (leave empty for localhost)"
 | 
					echo "Enter the hostname for the game (example: example.com) (leave empty for localhost):"
 | 
				
			||||||
read hostname
 | 
					read hostname
 | 
				
			||||||
if [ -z "$hostname" ]; then
 | 
					if [ -z "$hostname" ]; then
 | 
				
			||||||
	hostname=localhost
 | 
					    hostname=localhost
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Enter your external IP address (leave empty for localhost):"
 | 
					echo "Enter your external IP address (leave empty for localhost):"
 | 
				
			||||||
read ipadd
 | 
					read ipadd
 | 
				
			||||||
if [ -z "$ipadd" ]; then
 | 
					if [ -z "$ipadd" ]; then
 | 
				
			||||||
	ipadd=127.0.0.1
 | 
					    ipadd=127.0.0.1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					read -p "Do you want to run the game when the installation ends? (y/N): " run_game
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ $(uname) == "Linux" ]]; then
 | 
				
			||||||
 | 
					    echo "Setting up the environment."
 | 
				
			||||||
 | 
					    sudo apt update
 | 
				
			||||||
 | 
					    sudo apt install docker.io git curl -y
 | 
				
			||||||
 | 
					    sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 | 
				
			||||||
 | 
					    sudo chmod +x /usr/local/bin/docker-compose
 | 
				
			||||||
 | 
					elif [[$(uname) == "Darwin" ]]; then
 | 
				
			||||||
 | 
					    echo "Installing homebrew"
 | 
				
			||||||
 | 
					    sudo curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
 | 
				
			||||||
 | 
					    brew install docker
 | 
				
			||||||
 | 
					    brew install git
 | 
				
			||||||
 | 
					    brew install docker-compose@2.20.3
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    echo "This operating system isn't supported yet. feel free to join the discord and ask questions."
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Done setting up the environment."
 | 
				
			||||||
 | 
					echo "Downloading Game Files"
 | 
				
			||||||
 | 
					git clone --recurse-submodules https://github.com/solero/wand && cd wand
 | 
				
			||||||
 | 
					echo "Done Downloading the game files."
 | 
				
			||||||
 | 
					sudo rm -r .env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "# database
 | 
					echo "# database
 | 
				
			||||||
POSTGRES_USER=postgres
 | 
					POSTGRES_USER=postgres
 | 
				
			||||||
POSTGRES_PASSWORD=$dbpass
 | 
					POSTGRES_PASSWORD=$dbpass
 | 
				
			||||||
@@ -66,5 +82,10 @@ GAME_ADDRESS=$ipadd
 | 
				
			|||||||
GAME_LOGIN_PORT=6112" > .env
 | 
					GAME_LOGIN_PORT=6112" > .env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Done!"
 | 
					echo "Done!"
 | 
				
			||||||
echo "You can now run the game doing the command"
 | 
					
 | 
				
			||||||
echo "cd wand && sudo docker-compose up"
 | 
					
 | 
				
			||||||
 | 
					if [ "$run_game" == "y" ] || [ "$run_game" == "Y" ]; then
 | 
				
			||||||
 | 
					    sudo docker-compose up
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    echo "You chose not to run the game. To run the game later, execute the command: cd wand && sudo docker-compose up"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user