1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Linux Simple KAG dedicated server installer script

Discussion in 'Community Dev Corner' started by Asu, Jun 15, 2015.

Mods: Downburst, Mazey
  1. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Hey, I was not sure where to post this so I've put it on resources. I think this may go on this forum as well, so there we are.

    This script allows a Debian-based (and probably other *nix based distros featuring apt-get) distro user to install a KAG server on his box, VPS or dedicated server easily.

    You will need root priviledges, apt-get and tar.

    More info : https://forum.kag2d.com/resources/linux-dedicated-server-installer.326/

    Code:
    #!/bin/bash
    
    if [[ $EUID -ne 0 ]]; then
       echo "You don't have root priviledges."
       echo "Please run the script as root : sudo ./script.sh"
       exit 1
    fi
    
    echo "Updating package lists."
    apt-get update >/dev/null
    
    echo "Downloading/Updating librairies. Depending on your network speed, this may take a while."
    plat=$(uname -m)
    if [[ plat -eq "x86_64" ]]; then
       echo "You are running a 64-bit operating system."
       echo "Downloading 32-bit libs required to run KAG..."
       apt-get install ia32-libs >/dev/null
    else
       echo "You are running a 32-bit or an unsupported operating system.\nIgnoring 32-bit libs downloading."
    fi
    
    echo "How will this server be named? Do not choose a conflicting name!"
    choice="Server"
    read choice
    
    archivename="kag-linux32-dedicated-release.tar.gz"
    
    mkdir $choice
    if [[ ! -f $archivename ]]; then
       echo "The KAG archive was not found."
       echo "It will be downloaded for you."
       wget http://dl.kag2d.com/kag-linux32-dedicated-release.tar.gz >/dev/null
    fi
    
    echo "Copying and extracting the dedicated server archive"
    
    cp $archivename $choice
    
    cd $choice
    tar -zxf $archivename
    rm $archivename
    
    chmod +x ./KAGdedi
    
    echo "Updating the dedicatedserver.sh script"
    
    echo "dedicatedserver.sh" >> ./autoupdate_ignore.cfg
    rm ./dedicatedserver.sh
    
    echo "#!/bin/bash
    chmod +x ./KAGdedi
    until ./KAGdedi autostart Scripts/server_autostart.as autoconfig autoconfig.cfg; do
       sleep 2
    done" >> ./dedicatedserver.sh
    
    chmod +x ./dedicatedserver.sh
    
    cd ../
    
    echo "Job finished!"
    This is my first bash script as well, if you have some tips feel free.
     
    kaizokuroof likes this.
  2. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    You made a copy of archive and removed it after unpacking, but u could do that unpacking arc to custom dir.
    Also there can be some problems with rights: folders and files will be created under root, its bad.
    Tar will work without root rights.

    This libs installing will not work under Ubuntu 12+, because there is no ia32-libs package now.
     
  3. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Yeah, wasn't really sure how to do. I'll fix it on a next update.
    About ubuntu, goddamnit, why do they basically need to be a heavy and shitted up debian, duh.

    Thanks for the tips
     
  4. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    hmm, I have just googled and found that that problem is actual for debian 7+ too.
    for installing i386 arch packages in later Debian and Ubuntu u need to do firstly:
    dpkg --add-architecture i386
    apt-get update
    then u can install packages like this:
    apt-get install libc6:i386

    I don't remember what packages is needed for server, but u can check what libs are needed using ldd command.
     
  5. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    I didn't have issues on debian 7 with ia32-libs.
     
Mods: Downburst, Mazey