dotfiles/copy.sh

53 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/bash
2021-10-06 09:40:58 -04:00
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)")
home_files=""
for f in $moving_files; do
home_file="$HOME$(echo $f | sed "s@$SCRIPT_DIR@@")"
if test -f "$home_file"; 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 => ~/"
2021-10-06 09:40:58 -04:00
ln -sf $f ~/
done
mkdir -p ~/.vim/colors
ln -sf $SCRIPT_DIR/.vim/colors/* ~/.vim/colors/
2021-10-06 13:01:46 -04:00
touch ~/.zsh_local
2021-10-06 13:32:36 -04:00
# Install required packages
if [[ "$1" == "--install" ]]; then
echo -n "Rust is "
if ! where 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 where cargo; then
cargo install bat
fi
sh -c "$(curl -fsSL https://starship.rs/install.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