diff --git a/server-setup.sh b/server-setup.sh index 20b3034..b97bd6f 100644 --- a/server-setup.sh +++ b/server-setup.sh @@ -1,43 +1,44 @@ #!/bin/bash #Variables used by the script in various sections to pre-fill long commandds ROOT_UID="0" -apache="/etc/apache2/sites-available" -vh="./apache-hosts" -vh1="gamestats2.gs.nintendowifi.net" -vh2="gamestats.gs.nintendowifi.net" -vh3="nas-naswii-dls1-conntest.nintendowifi.net" -vh4="sake.gs.nintendowifi.net" -mod1="proxy.conf" -mod2="proxy_http.load" -mod3="proxy.load" +apache="/etc/apache2/sites-available" #This is the directory where sites are kept in case they need to be disabled in Apache +vh="./apache-hosts" #This folder is in the root directory of this script and is required for it to copy the files over +vh1="gamestats2.gs.nintendowifi.net" #This is the first virtual host file +vh2="gamestats.gs.nintendowifi.net" #This is the second virtual host file +vh3="nas-naswii-dls1-conntest.nintendowifi.net" #This is the third virtual host file +vh4="sake.gs.nintendowifi.net" #This is the fourth virtual host file +mod1="proxy.conf" #This is a proxy mod that is dependent on the other 2 +mod2="proxy_http.load" #This is related to mod1 +mod3="proxy.load" #This is related to mod1 and mod2 mod4="proxy" #This is a fallback module for use with OS's that don't support mod1, mod2 or mod3 -cp="/etc/apache2/sites-enabled" -fqdn="localhost" +cp="/etc/apache2/sites-enabled" #This is the directory where sites are usually enabled using a2enmod +fqdn="localhost" #This variable fixes the fqdn error in Apache #Don't forget to install the git package before running this script #Check if run as root -if [ "$UID" -ne "$ROOT_UID" ] ; then - echo "You must be root to do that!" - exit 1 -fi +if [ "$UID" -ne "$ROOT_UID" ] ; then #if the user ID is not root... + echo "You must be root to do that!" #Tell the user they must be root + exit 1 #Exits with an error +fi #End of if statement echo "Hello and welcome to my installation script. I assume you're running this as root?" -sleep 5s +sleep 5s #Pauses for 5 seconds echo "Okay! Gotta love when a plan comes together!" echo "Let me install a few upgrade and packages on your system for you...." echo "If you already have a package installed, I'll simply skip over it or upgrade it" -apt-get update -y --fix-missing +apt-get update -y --fix-missing #Fixes missing apt-get repository errors on some Linux distributions echo "Updated repo lists...." echo "Installing package upgrades... go kill some time as this may take a few minutes..." -apt-get upgrade -y +apt-get upgrade -y #Upgrades all already installed packages on your system clear echo "Upgrades complete!" echo "Now installing required packages..." -apt-get install apache2 python2.7 python-twisted dnsmasq -y +apt-get install apache2 python2.7 python-twisted dnsmasq -y #Install required packages echo "Installing Apache, Python 2.7, Python Twisted and DNSMasq....." clear echo "Now that that's out of the way, let's do some apache stuff" echo "Copying virtual hosts to sites-available for virtual hosting of the server" -cp ./$vh/$vh1 $apache/$vh1 +#The next several lines will copy the Nintendo virtual host files to sites-available in Apache's directory +cp ./$vh/$vh1 $apache/$vh1 cp ./$vh/$vh2 $apache/$vh2 cp ./$vh/$vh3 $apache/$vh3 cp ./$vh/$vh4 $apache/$vh4 @@ -52,18 +53,18 @@ clear echo "Okay! Lets hope nothing broke during this process..." sleep 5s echo "Now lets enable some modules so we can make all of this work..." -a2enmod $mod1 $mod2 $mod3 -if [ $? != "0" ] ; then - a2enmod $mod4 +a2enmod $mod1 $mod2 $mod3 #Enables proxy modules +if [ $? != "0" ] ; then #If in the event these modules fail to activate.... + a2enmod $mod4 #Enable proxy fallback module fi echo "Great! Everything appears to be set up as far as Apache" echo "Fixing that nagging Apache FQDN error...." -cat >>/etc/apache2/apache2.conf <>/etc/apache2/apache2.conf <>/etc/dnsmasq.conf <>/etc/dnsmasq.conf < ./adminpageconf.json < ./adminpageconf.json <