<commit_before>#!/usr/bin/env bash

########
# author: ryantaussig
# license: MIT
#
# abstract:
#   The following script installs dotfiles and applications interactively. It is intended for Ubuntu systems.
########

set -euo pipefail

# install settings
DOTFILES_DIR="$HOME/.local/dotfiles"
OLD_DIR="$HOME/tmp/dotfiles_old"
BIN_DIR="$HOME/.local/bin"
VENDOR_DIR="$HOME/.local/vendor"
DOTFILES="
vimrc
bashrc
tmux.conf
profile
tigrc
"

# install dotfile symlinks
echo "Installing dotfile symlinks."
mkdir -p $OLD_DIR
pushd $DOTFILES_DIR
for DOTFILE in $DOTFILES; do
	if [[ -f "$HOME/.$DOTFILE" ]]; then
		echo "Moving existing $DOTFILE to $OLD_DIR"
		mv $HOME/.$DOTFILE $OLD_DIR
	fi
	echo "Creating symlink to $DOTFILE in $HOME"
	ln -s $DOTFILES_DIR/$DOTFILE $HOME/.$DOTFILE
done
echo "Dotfile installation complete. Backups of the originals are located in $OLD_DIR."
popd

# TODO: add a switch to allow installing with various package managers
# update package index prior to application installs
echo "Updating package index."
sudo apt update

# headless applications/utilities
while true; do
	read -rp "Do you wish to install the headless/server applications? (y/n): " CLI
	if [[ "$CLI" == "y" ]]; then
		echo "Installing..."
		sudo apt install -y vim-nox tmux git ssh exa lnav peco tig ranger ncdu htop curl wget w3m w3m-img iperf mycli
	elif [[ "$CLI" == "n" ]]; then
		echo "Skipping..."
	else
		echo "Please respond y or n."
		continue
	fi
	break
done

# workstation applications
while true; do
	read -rp "Do you wish to install the GUI/workstation applications and settings? (y/n): " GUI
	if [[ "$GUI" == "y" ]]; then
		echo "Installing..."

		mkdir -p $BIN_DIR
		mkdir -p $VENDOR_DIR

		# NOTE: rust installation is best managed using `rustup`, which will prompt the user for input during install, so let's do that first
		curl https://sh.rustup.rs -sSf | sh

		# install general packages
		sudo apt install -y gnome-terminal firefox pandoc cmus ripit mpv youtube-dl vlc libreoffice gnome-tweaks vim-gtk3 pavucontrol snapd

		# install chat clients
		sudo snap install discord
		sudo snap install slack --classic
		sudo snap install skype --classic

		# install devops stuff
		sudo apt install -y docker.io certbot openssl zstd php composer php-xml php-pear python3 python3-pip
		pip3 install phpserialize<commit_msg>Updates for Ubuntu 19.10<commit_after>#!/usr/bin/env bash

########
# author: ryantaussig
# license: MIT
#
# abstract:
#   The following script installs dotfiles and applications interactively. It is intended for Ubuntu systems.
########

set -euo pipefail

# install settings
DOTFILES_DIR="$HOME/.local/dotfiles"
OLD_DIR="$HOME/tmp/dotfiles_old"
BIN_DIR="$HOME/.local/bin"
VENDOR_DIR="$HOME/.local/vendor"
DOTFILES="
vimrc
bashrc
tmux.conf
profile
tigrc
"

# install dotfile symlinks
echo "Installing dotfile symlinks."
mkdir -p $OLD_DIR
pushd $DOTFILES_DIR
for DOTFILE in $DOTFILES; do
	if [[ -f "$HOME/.$DOTFILE" ]]; then
		echo "Moving existing $DOTFILE to $OLD_DIR"
		mv $HOME/.$DOTFILE $OLD_DIR
	fi
	echo "Creating symlink to $DOTFILE in $HOME"
	ln -s $DOTFILES_DIR/$DOTFILE $HOME/.$DOTFILE
done
echo "Dotfile installation complete. Backups of the originals are located in $OLD_DIR."
popd

# TODO: add a switch to allow installing with various package managers
# update package index prior to application installs
echo "Updating package index."
sudo apt update

# headless applications/utilities
while true; do
	read -rp "Do you wish to install the headless/server applications? (y/n): " CLI
	if [[ "$CLI" == "y" ]]; then
		echo "Installing..."
		sudo apt install -y vim-nox tmux git ssh lnav peco tig ranger ncdu htop curl wget w3m w3m-img iperf mycli # exa not available on 19.10, install via cargo instead
	elif [[ "$CLI" == "n" ]]; then
		echo "Skipping..."
	else
		echo "Please respond y or n."
		continue
	fi
	break
done

# workstation applications
while true; do
	read -rp "Do you wish to install the GUI/workstation applications and settings? (y/n): " GUI
	if [[ "$GUI" == "y" ]]; then
		echo "Installing..."

		mkdir -p $BIN_DIR
		mkdir -p $VENDOR_DIR

		# NOTE: rust installation is best managed using `rustup`, which will prompt the user for input during install, so let's do that first
		curl https://sh.rustup.rs -sSf | sh
		cargo install exa

		# install general packages
		sudo apt install -y gnome-terminal firefox pandoc cmus ripit mpv youtube-dl vlc libreoffice gnome-tweaks vim-gtk3 pavucontrol snapd

		# install chat clients
		sudo snap install discord
		sudo snap install slack --classic
		sudo snap install skype --classic

		# install devops stuff
		sudo apt install -y docker.io certbot openssl zstd php composer php-xml php-pear python3 python3-pip mysql-workbench
		pip3 install phpserialize
{'fraction_non_alphanumeric': 0.10002105706464519, 'fraction_numerical': 0.004211412929037693, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1713184', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1541, 'n_words': 598}