TeamSpeak 3 installer

mikhomikho AdministratorHosting ProviderOG

After a couple of tickets asking for TS3 install support I decided to fork an existing script and update it with some features like

  • Downloading the latest version
  • Working on both CentOS and Debian

I am not a coder by profession, I'll take all ideas, test-reports and feature requests as an opportunity to educate myself and learn something new.

https://github.com/mikho/TS3-Installer

I'm asking for this favor, please download, test install, let me know what you think.

Thanked by (3)Mason Ympker Pwner
Tagged:

Comments

  • WSSWSS Retired
    edited May 2020

    I don't like you putting that read in a loop. You should ony allow y/n/abort. I guarantee there's one moron who will bash on the keyboard for a week here.

    also:

    read -p 'Butts? [y/N]' boogerbrain
    case $boogerbrain in:
      y|Y) install ;;
     n|N) quit ;;
     *) abort ;;
    esac
    

    Also, holy shit, use lsb_release rather than assuming /etc/redhat-release and /etc/os-release are anything you can trust unless you parse them. Here's a silly code snippit based on CloudLinux' KernelCare installer script - I'd prefer to use lsb_release, but this /mostly/ works:

    if [ -e /etc/os-release ]; then
        distr=$(grep -w 'ID' /etc/os-release | cut -d'=' -f2|tr -d '"')
        if [ "$distr" == "debian" ] || [ "$distr" == "devuan" ] || [ "$distr" == "ubuntu" ]; then
            repo=${repo}-debian
            apt-get -y -q install curl
        else
            yum -y -q install curl
        fi
        #I really don't like their script design, but whatever.
        if [ "$distr" ==  "devuan" ]; then 
            ver=$(grep -w 'PRETTY_NAME' /etc/os-release | cut -d' ' -f3 | grep -oE "[a-z]*")
            if [ "$ver" == "ascii" ]; then rel="9" pkg=${name}-9.deb
            else rel="8" pkg=${name}-8.deb
            fi
        else
            rel=$(grep -w 'VERSION_ID' /etc/os-release | cut -d'.' -f1 | grep -oE "[0-9]*")
        fi
    
        case $distr in
            "devuan")
                if [ "$rel" -ge "9" ]; then pkg=${name}-9.deb
                elif [ "$rel" -eq "8" ]; then pkg=${name}-8.deb
                else pkg=${name}-6.deb
                fi
            ;;
            "debian")
                if [ "$rel" -ge "9" ]; then pkg=${name}-9.deb
                elif [ "$rel" -eq "8" ]; then pkg=${name}-8.deb
                else pkg=${name}-6.deb
                fi
            ;;
            "ubuntu")
                if [ "$rel" -ge "14" ]; then pkg=${name}-8.deb
                else pkg=${name}-6.deb
                fi
            ;;
            "amzn")
                rel='7'
                pkg=${name}-${rel}.rpm
            ;;
            *       )
                pkg=${name}-${rel}.rpm
            ;;
        esac
    
    elif [ -e /etc/system-release ]; then
        rel=$(cut -d'.' -f1 /etc/system-release | grep -oE "[0-9]")
        pkg=${name}-${rel}.rpm
    else
        rel=$(cut -d'.' -f1 /etc/redhat-release | grep -oE "[0-9]")
        pkg=${name}-${rel}.rpm
    fi
    

    Also, might want to learn to use ip a; since ifconfig is officially deprecated and isn't installed by default.

    Thanked by (2)mikho vimalware

    My pronouns are asshole/asshole/asshole. I will give you the same courtesy.

  • I took a quick look, it looks good for someone who is learning Bash.

    Some observations:

    • If you install ca-certificates, don't use --no-check-certificate
    • Old init systems are irrelevant nowadays so I'd remove references to them and replace with systemd.
    • ifconfig is deprecated and not available everywhere. ip is available everywhere, and should be used instead. Take a look at my installers if you need help with regex.
    Thanked by (2)mikho vimalware
  • @WSS said: Also, holy shit, use lsb_release rather than assuming /etc/redhat-release and /etc/os-release are anything you can trust.

    lsb_release isn't available everywhere, while /etc/*-release are.

    Thanked by (1)vimalware
  • WSSWSS Retired

    @Nyr said:

    • Old init systems are irrelevant nowadays so I'd remove references to them and replace with systemd.

    Fuck you, that's what.

    • ifconfig is deprecated and not available everywhere. ip is available everywhere, and should be used instead. Take a look at my installers if you need help with regex.

    @Nyr said:

    @WSS said: Also, holy shit, use lsb_release rather than assuming /etc/redhat-release and /etc/os-release are anything you can trust.

    lsb_release isn't available everywhere, while /etc/*-release are.

    It is if you install it. Look at my revised 'not quite lsb_release' info above.

    Thanked by (1)comi

    My pronouns are asshole/asshole/asshole. I will give you the same courtesy.

  • @Nyr said: Old init systems are irrelevant nowadays so I'd remove references to them and replace with systemd.

    Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.

    Please.

    Thanked by (1)comi
  • I knew I was going to hurt some feelings.

  • WSSWSS Retired

    @Nyr said:
    I knew I was going to hurt some feelings.

    I'm happy for you, and Imma let you finish, but (sysv)init was and is still the standard of all time!

    My pronouns are asshole/asshole/asshole. I will give you the same courtesy.

  • mikhomikho AdministratorHosting ProviderOG

    @Nyr said:
    I took a quick look, it looks good for someone who is learning Bash.

    Thanks :)

    @Nyr said:
    Some observations:

    • If you install ca-certificates, don't use --no-check-certificate

    One of two reasons, either I tested before I added ca-certificates to be installed.
    Or, it didn’t work without it.
    can’t remember which, I’ll check it out.

    @Nyr said:

    • Old init systems are irrelevant nowadays so I'd remove references to them and replace with systemd.

    I think I’ll keep it for now, still loads of old installations around that uses the old init system.

    @Nyr said:

    • ifconfig is deprecated and not available everywhere. ip is available everywhere, and should be used instead. Take a look at my installers if you need help with regex.

    Will take a look.
    Not that important though, only displaying the value in a text, not using it anywhere.

    @WSS : thanks for the input. I’ll consider lsb_release.
    In the templates I tried, lsb_release wasn’t available unless you installed it.
    Tried to keep number of packages needed to a minimum.

  • @WSS said:

    @Nyr said:
    I knew I was going to hurt some feelings.

    I'm happy for you, and Imma let you finish, but (sysv)init was and is still the standard of all time!

    Has even Red Hat stopped reading /etc/rc.local these days? :o
    Or is there a systemd unit parsing/sourcing it? :#

  • @Nyr said:
    I knew I was going to hurt some feelings.

    I knew you did it on purpose! =D

  • I don't know anything about TeamSpeak.... is these ports are supposed to be accessible from outside?

    fport="30033"
    qport="10011"

    If so, I think you would need some kind of iptables/firewalld management.

  • @flips said: Or is there a systemd unit parsing/sourcing it?

    Indeed there is.

  • @Nyr said:

    @flips said: Or is there a systemd unit parsing/sourcing it?

    Indeed there is.

    Awesome ... :p Then all those old articles explaining how you get old and unpatched stuff working by using tar, cp, chmod 777 and by adding a line or two to rc.local are still relevant ... ;) :#

  • @flips said: Awesome ... :p Then all those old articles explaining how you get old and unpatched stuff working by using tar, cp, chmod 777 and by adding a line or two to rc.local are still relevant ... ;) :#

    I was going to argue relevancy but since you specified "old and unpatched stuff" I figured learning the wrong way to do things was kinda on target. :P

    Thanked by (1)flips
  • mikhomikho AdministratorHosting ProviderOG

    @PHP_Backend said:
    I don't know anything about TeamSpeak.... is these ports are supposed to be accessible from outside?

    fport="30033"
    qport="10011"

    If so, I think you would need some kind of iptables/firewalld management.

    I think iptables is a bit out of the scope as not everyone is running it.
    I will however, make a note on adding a text telling the user to open the firewall on the selected ports.

Sign In or Register to comment.