#!/bin/bash
apt-get update
apt-get -y upgrade

apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce
docker network create \
--driver=bridge \
--subnet=172.18.0.0/16 \
--ip-range=172.18.5.0/24 \
--gateway=172.18.0.1 \
--opt com.docker.network.bridge.host_binding_ipv4=0.0.0.0 \
--opt com.docker.network.bridge.name=plexworks \
--opt com.docker.network.bridge.enable_icc=true \
--opt com.docker.network.driver.mtu=1500 \
plexworks

docker network create \
--driver=bridge \
--subnet=172.19.0.0/16 \
--ip-range=172.19.5.0/24 \
--gateway=172.19.0.1 \
--opt com.docker.network.bridge.host_binding_ipv4=0.0.0.0 \
--opt com.docker.network.bridge.name=tauworks \
--opt com.docker.network.bridge.enable_icc=true \
--opt com.docker.network.driver.mtu=1500 \
tauworks

docker network create \
--driver=bridge \
--subnet=172.20.0.0/16 \
--ip-range=172.20.5.0/24 \
--gateway=172.20.0.1 \
--opt com.docker.network.bridge.host_binding_ipv4=0.0.0.0 \
--opt com.docker.network.bridge.name=embyworks \
--opt com.docker.network.bridge.enable_icc=true \
--opt com.docker.network.driver.mtu=1500 \
embyworks


apt-get install -y cifs-utils
mkdir /opt/plexdocker/
mkdir /deployments
mkdir /opt/plexdocker/plexconfigs/
mkdir /media/storagebox

sed 's/nomodeset[[:blank:]]*//g' -i /etc/default/grub
sed '/i915/d' -i /etc/modprobe.d/blacklist-hetzner.conf
grub-mkconfig -o /boot/grub/grub.cfg
apt-get install -y htop
echo 'abc:x:0:0:/usr/sbin:/usr/sbin/nologin' >> /etc/passwd


apt-get install -y nginx
