#!/usr/bin/env bash
echo 'Starting installation'

echo 'Installing Depending Repositories...'
echo 'Installing RPMFusion'
sudo dnf install -y \
    https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
    https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

echo 'Adding Flatpak'
sudo dnf install -y flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

echo 'Enabling Cisco openh264'
sudo dnf config-manager --set-enabled fedora-cisco-openh264

echo 'Installing base packages...'
sudo dnf install -y \
    git tar zsh ack mlocate usbutils sqlite neofetch which util-linux-user dialog neovim

echo 'Installing fonts'
sudo dnf install -y \
    twitter-twemoji-fonts fontawesome-fonts powerline-fonts

echo 'Install locale...'
sudo dnf install -y \
    langpacks-de langpacks-en

cd ~
mkdir $HOME/workspace
mkdir -p $HOME/.local/bin
cd $HOME/workspace
git clone https://git.doggoat.de/dhalucario/devconf.git
git submodule update --init --recusive

cd $HOME/workspace/devconf
./tools/install-light.sh

res=$(dialog --stdout --checklist "Which parts do you want to install?" 0 0 0 graphical Graphical off)
if [[ $res == *"graphical"* ]]; then
    ./tools/install-graphical.sh
fi

sudo usermod -aG audio,input $(whoami)
echo 'Installation Done'
