#!/bin/bash

# ~ Setup a newly installed PC with Fedora Workstation 31 ~
# ~ Updated Nov 2019 ~

# Update the system
sudo dnf -y update

# Common Packages
sudo dnf install -y dnf-plugin-system-upgrade fedora-workstation-repositories
sudo dnf install -y bash-completion bc bmon bzip2 curl dmidecode ethtool gnome-python2-gnomekeyring git htop httpie ifstat iftop iotop jpegoptim libwebp-tools make multitail nano neofetch net-tools optipng pcre pcre-devel psmisc rsync screen screenfetch siege smartmontools sudo tree unzip wget wmctrl zip zlib-devel

# === Single Apps ===
# Alacritty
sudo dnf copr enable -y pschyska/alacritty
sudo dnf install -y alacritty

# Brave
sudo dnf config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/x86_64/
sudo rpm --import https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
sudo dnf install -y brave-browser

# Code
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo'
sudo dnf check-update
sudo dnf install -y code

# Gnome Tweak Tool
sudo dnf install -y gnome-tweak-tool

# Google Chrome & Chromium
sudo dnf config-manager --set-enabled google-chrome
sudo dnf install -y chromium google-chrome-stable

# HydraPaper
sudo dnf install -y hydrapaper

# MKVToolNix
sudo dnf install -y mkvtoolnix mkvtoolnix-gui

# Sublime Text
sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg
sudo dnf config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo
sudo dnf install -y sublime-text

# Thunderbird
sudo dnf install -y thunderbird

# Viber
sudo dnf install -y https://download.cdn.viber.com/desktop/Linux/viber.rpm

# Virt-Manager
sudo dnf install -y virt-manager

# Apps That Require Version Updating
sudo dnf install -y https://github.com/atom/atom/releases/download/v1.41.0/atom.x86_64.rpm
sudo dnf install -y https://github.com/Eugeny/terminus/releases/download/v1.0.91/terminus-1.0.91-linux.rpm
sudo dnf install -y https://linux.dropbox.com/packages/fedora/nautilus-dropbox-2019.02.14-1.fedora.x86_64.rpm

# === Snap (reboot before installing Snap Apps) ===
sudo dnf install -y snapd
sudo ln -s /var/lib/snapd/snap /snap

# === Flatpak ===
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

# Flatpak Apps
flatpak install -y flathub com.github.muriloventuroso.easyssh

# === Themes & Icons ===
sudo dnf install -y arc-theme
sudo dnf copr enable -y tcg/themes
sudo dnf install -y la-capitaine-icon-theme
sudo dnf install -y numix-icon-theme numix-icon-theme-circle numix-icon-theme-square

# === RPM Fusion ===
sudo dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-31.noarch.rpm
sudo dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-31.noarch.rpm

# === Apps via PyPi ===
#sudo pip install -y glances youtube-dlg

# === Path Aliases (to sync between Mac & Linux PCs) ===
ln -s /home /Users

# === /etc/sysctl.conf Tweaks ===
# For VS Code: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
sudo echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf
sudo sysctl -p

echo ""
echo ""
echo " === Installation Completed === "
echo ""
echo ""