-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·32 lines (27 loc) · 907 Bytes
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# List only files/config dirs that should be copied
DOTFILES=".vimrc .zshrc .tmux.conf"
CONFIGDIRS="gh" # limited list since this is only for codespaces at this time
# DOTFILES
for f in $DOTFILES; do
if [ -f ~/"$f" ]; then
mkdir -p ~/dotfiles_backups
echo "Backing up pre-existing $f..."
mv ~/"$f" ~/dotfiles_backups/"$f"
fi
echo "Linking $f"
ln -s "$SCRIPT_DIR/$f" ~/"$f"
done
# .config dirs
mkdir -p ~/.config
for f in $CONFIGDIRS; do
if [ -d ~/.config/"$f" ]; then
mkdir -p ~/dotfiles_backups
echo "Backing up pre-existing $f..."
mv ~/.config/"$f" ~/dotfiles_backups/"$f"
fi
echo "Linking $f"
ln -s "$SCRIPT_DIR/.config/$f" ~/.config/
done