-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
36 lines (30 loc) · 831 Bytes
/
install.sh
File metadata and controls
36 lines (30 loc) · 831 Bytes
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
33
34
35
36
#!/bin/bash
# codeandkey/dotfiles
THISDIR="$(dirname $(readlink -f $0))"
BACKUPDIR="$HOME/.dotfiles_backup"
LOCAL_CONFIG="${HOME}/.config"
ROAMING_CONFIG="$LOCAL_CONFIG"
LOCAL_HOME="$HOME"
if [ "$IS_WINDOWS" = "1" ]; then
LOCAL_CONFIG="${LOCAL_HOME}/AppData/Local"
ROAMING_CONFIG="${LOCAL_HOME}/AppData/Roaming"
fi
backup() {
if [ -e "$1" ]; then
echo "Backing up $1"
mkdir -p "$BACKUPDIR/$(dirname $1)"
cp -r "$1" "$BACKUPDIR/$1"
fi
}
install_config() {
source="$1"
dest="$2"
backup "$dest"
rm -rf "$dest"
echo "Installing ${source} to ${dest}"
mkdir -p "$(dirname $dest)"
cp -r "$source" "$dest"
}
install_config "${THISDIR}/bash/.bashrc" "${LOCAL_HOME}/.bashrc"
install_config "${THISDIR}/tmux/.tmux.conf" "${LOCAL_HOME}/.tmux.conf"
install_config "${THISDIR}/nvim" "${LOCAL_CONFIG}/nvim"