Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ubuntu Installation #99

Closed
wants to merge 13 commits into from
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
name: CI
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04]
steps:
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: 1.13
- name: Check out code into the Go module directory
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Get dependencies
run: go get -v -t -d ./...
- name: Run Installer
Expand All @@ -27,3 +29,5 @@ jobs:
sudo ./startup
- name: Run Tests
run: go test -v startup_test.go
env:
DISCORD_API_KEY: ${{ secrets.SINUSBOT_DISCORD_API_KEY }}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# SinusBot Installer for Linux

![Build Status](https://github.com/sinusbot/installer-linux/workflows/CI/badge.svg)
![Build Status](https://github.com/sinusbot/installer-linux/workflows/ci.yml/badge.svg)

## Officially supported Linux distributions

- Debian 9+
- Ubuntu 16.10+
- Debian 10+
- Ubuntu 18.04+
- CentOS 7+

## Features
Expand All @@ -20,7 +20,7 @@
The following tasks will be done:

- Checks if the linux distribution is supported
- Installs the latest supported version of the teamspeak client
- Installs the latest supported version of the TeamSpeak client
- Installs all the necessary dependencies
- Creates a separated user
- Installs the latest SinusBot version
Expand Down
77 changes: 11 additions & 66 deletions sinusbot_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Vars

MACHINE=$(uname -m)
Instversion="1.5"
Instversion="2.0"

USE_SYSTEMD=true

Expand Down Expand Up @@ -538,19 +538,6 @@ if [ "$INSTALL" == "Rem" ]; then
exit 0
fi

# Private usage only!

redMessage "This SinusBot version is only for private use! Accept?"

OPTIONS=("No" "Yes")
select OPTION in "${OPTIONS[@]}"; do
case "$REPLY" in
1) errorQuit ;;
2) break ;;
*) errorContinue ;;
esac
done

# Ask for YT-DL

redMessage "Should YT-DL be installed/updated?"
Expand Down Expand Up @@ -621,76 +608,34 @@ fi
magentaMessage "Installing necessary packages. Please wait..."

if [[ -f /etc/centos-release ]]; then
yum -y -q install screen xvfb libxcursor1 ca-certificates bzip2 psmisc libglib2.0-0 less ntp python iproute which dbus libnss3 libegl1-mesa x11-xkb-utils libasound2 libxcomposite-dev libxi6 libpci3 libxslt1.1 libxkbcommon0 libxss1 >/dev/null
yum -y -q install screen xvfb libxcursor1 ca-certificates bzip2 psmisc libglib2.0-0 less ntp python3 iproute which dbus libnss3 libegl1-mesa x11-xkb-utils libasound2 libxcomposite-dev libxi6 libpci3 libxslt1.1 libxkbcommon0 libxss1 >/dev/null
update-ca-trust extract >/dev/null
else
# Detect if systemctl is available then use systemd as start script. Otherwise use init.d
if [ "$OSRELEASE" == "18.04" ] && [ "$OS" == "ubuntu" ]; then
apt-get -y install chrony
else
apt-get -y install ntp
fi
apt-get install -y -qq --no-install-recommends libfontconfig libxtst6 screen xvfb libxcursor1 ca-certificates bzip2 psmisc libglib2.0-0 less python iproute2 dbus libnss3 libegl1-mesa x11-xkb-utils libasound2 libxcomposite-dev libxi6 libpci3 libxslt1.1 libxkbcommon0 libxss1
apt-get install -y -qq --no-install-recommends libfontconfig libxtst6 screen xvfb libxcursor1 ca-certificates bzip2 psmisc libglib2.0-0 less python3 iproute2 dbus libnss3 libegl1-mesa x11-xkb-utils libasound2 libxcomposite-dev libxi6 libpci3 libxslt1.1 libxkbcommon0 libxss1 libxdamage1
update-ca-certificates >/dev/null
fi

if [[ $(cat /etc/*release | grep "PRETTY_NAME=" | sed 's/PRETTY_NAME=//g') =~ "Debian" ]]; then
apt-get install -y -qq --no-install-recommends python-is-python3
fi
Comment on lines +617 to +619
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [[ $(cat /etc/*release | grep "PRETTY_NAME=" | sed 's/PRETTY_NAME=//g') =~ "Debian" ]]; then
apt-get install -y -qq --no-install-recommends python-is-python3
fi
if [[ $(cat /etc/*release | grep "PRETTY_NAME=" | sed 's/PRETTY_NAME=//g') =~ "Debian" ]]; then
apt-get install -y -qq --no-install-recommends python-is-python3
fi
if [[ $(cat /etc/*release | grep "PRETTY_NAME=" | sed 's/PRETTY_NAME=//g') =~ "Ubuntu" ]]; then
apt-get install -y -qq --no-install-recommends python-is-python3
fi

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mhh have to filter for old ubuntu version

if [[ $(cat /etc/*release | grep "PRETTY_NAME=" | sed 's/PRETTY_NAME=//g') =~ "Ubuntu" ]]; then
apt-get install -y -qq --no-install-recommends python-is-python3
fi
else

magentaMessage "Installing necessary packages. Please wait..."

if [[ -f /etc/centos-release ]]; then
yum -y -q install ca-certificates bzip2 python wget >/dev/null
yum -y -q install ca-certificates bzip2 python3 wget >/dev/null
update-ca-trust extract >/dev/null
else
apt-get -qq install ca-certificates bzip2 python wget -y >/dev/null
apt-get -qq install ca-certificates bzip2 python3 wget -y >/dev/null
update-ca-certificates >/dev/null
fi

fi

greenMessage "Packages installed"!

# Setting server time

if [[ $VIRTUALIZATION_TYPE == "openvz" ]]; then
redMessage "You're using OpenVZ virtualization. You can't set your time, maybe it works but there is no guarantee. Skipping this part..."
else
if [[ -f /etc/centos-release ]] || [ $(cat /etc/*release | grep "DISTRIB_ID=" | sed 's/DISTRIB_ID=//g') ]; then
if [ "$OSRELEASE" == "18.04" ] && [ "$OS" == "ubuntu" ]; then
systemctl start chronyd
if [[ $(chronyc -a 'burst 4/4') == "200 OK" ]]; then
TIME=$(date)
else
errorExit "Error while setting time via chrony"!
fi
else
if [[ -f /etc/centos-release ]]; then
service ntpd stop
else
service ntp stop
fi
ntpd -s 0.pool.ntp.org
if [[ -f /etc/centos-release ]]; then
service ntpd start
else
service ntp start
fi
TIME=$(date)
fi
greenMessage "Automatically set time to" $TIME!
else
if [[ $(command -v timedatectl) != "" ]]; then
service ntp restart
timedatectl set-ntp yes
timedatectl
TIME=$(date)
greenMessage "Automatically set time to" $TIME!
else
redMessage "Unable to configure your date automatically, the installation will still be attempted."
fi
fi
fi

USERADD=$(which useradd)
GROUPADD=$(which groupadd)
ipaddress=$(ip route get 8.8.8.8 | awk {'print $7'} | tr -d '\n')
Expand Down
8 changes: 0 additions & 8 deletions startup.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,10 @@ func main() {
Value: "1",
Detect: "Should I install TeamSpeak or only Discord Mode?",
},
parameter{
Value: "2",
Detect: "This SinusBot version is only for private use! Accept?",
},
parameter{
Value: "1",
Detect: "Should YT-DL be installed/updated?",
},
parameter{
Value: "1",
Detect: "Check your time below:",
},
parameter{
Value: "2",
Detect: "Update the system packages to the latest version?",
Expand Down
Loading