#!/bin/bash SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" moving_files="$(find $SCRIPT_DIR -mindepth 1 -maxdepth 1 -type f -not -name "copy.sh" -not -name "*.git*")" moving_files=$(echo -e "$moving_files\n$(find $SCRIPT_DIR/.vim/colors/ -mindepth 1)") moving_files=$(echo -e "$moving_files\n$(find $SCRIPT_DIR/.config/ -mindepth 1)") mkdir -p $HOME/.vim/user/ touch $HOME/.vim/user/files.vim home_files="" for f in $moving_files; do home_file="$HOME$(echo $f | sed "s@$SCRIPT_DIR@@")" if test -f "$home_file" && ! diff $home_file $f &>/dev/null; then home_files="$home_files\n $home_file" fi done if [[ "$home_files" != "" ]]; then echo -n "Warning! This will overwrite all of the following files:" echo -e $home_files read -r -p "Are you sure you want to continue? [y/N] " response response=${response,,} # tolower if ! [[ "$response" =~ ^(yes|y)$ ]]; then exit 1 fi fi for f in $moving_files; do echo "$f => ~/" ln -sf $f ~/ done mkdir -p ~/.vim/colors ln -sf $SCRIPT_DIR/.vim/colors/* ~/.vim/colors/ mkdir -p ~/.config/ ln -sf $SCRIPT_DIR/.config/* ~/.config/ touch ~/.zsh_local if ! test -f ~/.gitlocal; then echo "[user]" > ~/.gitlocal echo " email = sagev9000@tutanota.com" >> ~/.gitlocal fi # Install required packages if [[ "$1" == "--install" ]]; then echo -n "Rust is " if ! command -v cargo; then echo "not installed. Installing..." curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh else echo "installed." fi . "$HOME/.cargo/env" if command -v cargo; then cargo install bat fi curl -sS https://starship.rs/install.sh | sh echo "Starship requires an NFont: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip" echo "You may wish to install fzf" fi