dotfiles/copy.sh

35 lines
923 B
Bash
Executable File

#!/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)")
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 => ~/"
ln -sf $f ~/
done
mkdir -p ~/.vim/colors
ln -sf $SCRIPT_DIR/.vim/colors/* ~/.vim/colors/
touch ~/.zsh_local