#!/bin/bash

#System upgrade
sudo eopkg up

#echo "Fixing pulseaudio (ignore rm errors)..."
#rm /tmp/.esd-1000/socket
#rm /tmp/.esd-1000/socket
#rm /tmp/.esd-1000/socket
#rm /tmp/.esd-1000/socket

#mkdir ~/apps

sudo snap install spotify
sudo eopkg it -c system.devel -y
sudo eopkg it xrdb zsh git git-lfs telegram htop etcher golang zip unzip cava neofetch aria2 acpi ncmpcpp rxvt-unicode vim epson-inkjet-printer-escpr flatpak texlive-all solbuild pip -y

sudo solbuild update
if [[ $? == 1 ]]; then
	sudo solbuild init
	sudo solbuild update
fi

sudo pip install mopidy mopidy-spotify mopidy-spotify-web mopidy-iris

flatpak install --user --from https://download.mono-project.com/repo/monodevelop.flatpakref -y

#TODO: Insync, Sublime, Dotnet, anything missing from arch
sudo eopkg it https://github.com/ZotanWolf/solbuilds-lfs/raw/master/jetbrains-toolbox/jetbrains-toolbox-1.6.2914-1-1-x86_64.eopkg https://github.com/ZotanWolf/solbuilds-lfs/raw/master/geogebra/geogebra-5.0.24-1-1-x86_64.eopkg https://github.com/ZotanWolf/solbuilds-lfs/raw/master/cli-visualizer/cli-visualizer-1.7-1-1-x86_64.eopkg https://github.com/ZotanWolf/solbuilds-lfs/raw/master/libspotify/libspotify-12.1.51-3-1-x86_64.eopkg https://github.com/ZotanWolf/solbuilds-lfs/raw/master/libspotify/libspotify-devel-12.1.51-3-1-x86_64.eopkg https://github.com/ZotanWolf/solbuilds-lfs/raw/master/xarchiver/xarchiver-0.5.4-1-1-x86_64.eopkg
cd

#Dotnet (to update link)
#curl -sSL -o dotnet.tar.gz "https://download.microsoft.com/download/1/1/5/115B762D-2B41-4AF3-9A63-92D9680B9409/dotnet-sdk-2.1.4-linux-x64.tar.gz"
#mkdir -p ~/apps/dotnet && tar zxf dotnet.tar.gz -C ~/apps/dotnet
#sudo ln -s $HOME/apps/dotnet/dotnet /usr/bin/dotnet
#cd

#Dotfiles
wget https://zotan.pw/dotfiles.zip -O /tmp/dotfiles.zip
unzip -o /tmp/dotfiles.zip -d .
xrdb -load .Xresources

#ZSH
bash -c "$(curl -sSL zotan.pw/solus-ohmyz.sh)"

#transfer.sh
cat .zshrc | grep transfer.sh -q
if [[ $? -ne 0 ]]; then
    curl -fsSL https://gist.githubusercontent.com/anonymous/c2a9e0ea86b5fb9c7971182f461e33e4/raw/567a15b8491cb9106c53835c731e583d3b12d7b5/gistfile1.txt >> .zshrc
fi

echo
echo
echo "If you do not plan to use the gtk theme, please delete .config/gtk-3.0/gtk.css"
echo "Otherwise, please enable the theme 'Arc-Dark' now, using your DE's configuration utility."
