#!/usr/bin/env bash

cd "$(dirname $(realpath "$0"))"

# install config files
cd files
for filepath in $(find . -type f); do
	mkdir -p "$HOME/$(dirname $filepath)"
	cp "$filepath" "$HOME/$filepath"
done
cd ..

mkdir -p "$HOME/.local/bin"

# install pfetch
if [[ ! -e "$HOME/.local/bin/pfetch" ]]; then
	curl -s https://raw.githubusercontent.com/dylanaraps/pfetch/master/pfetch > "$HOME/.local/bin/pfetch"
	chmod +x "$HOME/.local/bin/pfetch"
fi

# provide rickroll
if [[ ! -e "$HOME/.local/bin/rickroll" ]]; then
	curl -s https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh > "$HOME/.local/bin/rickroll"
	chmod +x "$HOME/.local/bin/rickroll"
fi

if command -v gsettings &> /dev/null; then
	gsettings set org.gnome.desktop.interface gtk-theme Adwaita
	gsettings set org.gnome.desktop.interface icon-theme Adwaita
	gsettings set org.gnome.desktop.interface cursor-theme Adwaita
fi

systemctl enable --now --user ssh-agent.service &> /dev/null

systemctl enable --user rclonesync.service &> /dev/null
systemctl enable --now --user rclonesync.timer &> /dev/null
if [[ ! -e "$HOME/.config/rclone/rclone.conf" ]]; then
	echo "WARN: ~/.config/rclone/rclone.conf missing"
fi
