#!/usr/bin/sh
# yadm bootstrap file
# used on ubuntu - haven't tested extensively yet

source ~/.config/shell/start.sh
echo "This script will ask for your sudo password throughout"

echo "Installing and updating some packages..."
sudo apt update && sudo apt upgrade -y && sudo apt install -y \
     build-essential curl git wget moreutils

# zsh plugins
# Using debian unstable versions because there are no builds for latest versions of ubuntu
echo "Installing zsh plugins..."
sudo apt install zsh -y
echo 'deb http://download.opensuse.org/repositories/shells:/zsh-users:/zsh-completions/Debian_Unstable/ /' | sudo tee /etc/apt/sources.list.d/shells:zsh-users:zsh-completions.list
curl -fsSL https://download.opensuse.org/repositories/shells:zsh-users:zsh-completions/Debian_Unstable/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-completions.gpg > /dev/null

echo 'deb http://download.opensuse.org/repositories/shells:/zsh-users:/zsh-syntax-highlighting/Debian_Unstable/ /' | sudo tee /etc/apt/sources.list.d/shells:zsh-users:zsh-syntax-highlighting.list
curl -fsSL https://download.opensuse.org/repositories/shells:zsh-users:zsh-syntax-highlighting/Debian_Unstable/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-syntax-highlighting.gpg > /dev/null

sudo apt update ; sudo apt install -y zsh-completions zsh-syntax-highlighting

echo "Downloading fonts to ~/Downloads"
cd $HOME/Downloads
wget -nv "https://download.jetbrains.com/fonts/JetBrainsMono-2.225.zip"
wget -nv "https://github.com/tonsky/FiraCode/releases/download/5.2/Fira_Code_v5.2.zip"
wget -nv "https://bboxtype.com/downloads/FiraGO/Download_Folder_FiraGO_1001.zip"
cd -

echo "Installing golang"
wget -nv https://golang.org/dl/go1.16.5.linux-amd64.tar.gz -O /tmp/go.tar.gz && sudo tar -C /usr/local -xzf /tmp/go.tar.gz && rm /tmp/go.tar.gz

echo "Installing node, npm, etc."
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install --global yarn


# Set git remote from HTTPS (read-only on sr.ht) to SSH
yadm remote set-url origin git@git.sr.ht:~earnestma/dotfiles

echo "Done!"