Sonntag, 29. Mai 2011

Minecraft Server unter Ubuntu Linux installieren

Um Minecraft auf Ubuntu zu installieren muss man nur diesen Anweisungen folgen.
Noch einfacher gehts mit einem Script, dass ich geschrieben habe.
  1. Downloaden
  2. Ausführbar machen ( chmod a+x minecraft_server_setup.sh )
  3. Ausführen ( ./minecraft_server_setup.sh )
Klick mich um Code anzuzeigen
#!/bin/bash
echo -n 'Do you want to (i)nstall or (s)tart the minecraft server?'
read watdo
startit(){ 
 if [ -d ~/.minecraft\ server/ ]; then
  cd ~/.minecraft\ server/
  echo -n "Do you have more than 1024MB of RAM?
  (y)es or (n)o"
  read watram
  echo -n "Do you want to start the server with a GUI?
   (y)es or (n)o"
  read watgui
  case "$watram" in 
   y|Y|Yes)
    case "$watgui" in
     y|Y|Yes)
      java -jar minecraft_server.jar
     ;;
     n|N|no|No)
      java -jar minecraft_server.jar nogui
     ;;
     *) echo "Unknown Parameter"
     read ''
     ;;
    esac 
   ;;
   n|N|no|No)
    case "$watgui" in
     y|Y|Yes)
      java -Xmx1024M -Xms1024M -jar minecraft_server.jar
     ;;
     n|N|no|No)
      java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
     ;;
     *) echo "Unknown Parameter" 
     read ''
     ;;
    esac 
   ;;
   *) echo "Unknown Parameter" 
   read ''
   ;;
  esac
 else
  echo "You don't seem to have the Minecraft server installed.
Do you want to install it now?
(y)es or (n)o"
  read watdo
  installit
 fi
 
}
installit(){
 case "$watdo" in
 y|Y|yes|Yes|i|I|install|Install) 
 if [ ! -d ~/.minecraft\ server/ ]; then
  mkdir ~/.minecraft\ server
  cd ~/.minecraft\ server/
  wget http://www.minecraft.net/download/minecraft_server.jar
  chmod a+x minecraft_server.jar
  echo -n "Do you want to start the server now?
   (y)es or (n)o"
  read startnow
  case "$startnow" in
  y|Y|Yes)
   startit
  ;;
  *)  
  ;;
  esac
 else
  echo "The Minecraft Server seems to be installed.
Do you want to start it now?
(y)es or (n)o"
  read watnowdo
  case "$watnowdo" in
  y|Y|yes|Yes)
   startit
  ;;
  *)
  ;;
  esac
 fi
 ;;
 s|S|start|Start)
  startit
 ;;
 n|N|no|No)
  exit 0
 ;;
 *) 
  echo "Unknown Parameter" 
  read ''
 ;;
esac
}
installit
exit 0

Der Code ist deshalb so chaotisch, weil es mein erstes Shell-Script ist ;)

0 Kommentare:

Kommentar veröffentlichen