-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·34 lines (26 loc) · 745 Bytes
/
install
File metadata and controls
executable file
·34 lines (26 loc) · 745 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
#!/bin/zsh
# Folder where this repository is
DIR=~/.dotfiles
installfile () {
SOURCE=$1
TARGET=$2
if [ -e $TARGET ] && [ ! -L $TARGET ]; then
echo -e " * \e[34mSkip\e[39m: $TARGET is not a symlink. Skipping."
return
fi
if [ -e $TARGET ]; then
echo -e " * \e[31mDelete\e[39m: $TARGET"
rm -f $TARGET || true
fi
echo -e " * \e[33mLinking\e[39m: $SOURCE \t->\t $TARGET"
ln -s $SOURCE $TARGET
}
for ENTRY in "$DIR/home"/*; do
echo -e "[\e[32mhome\e[39m] installing $ENTRY"
installfile $ENTRY ~/.${ENTRY##*/}
done
mkdir -p ~/.config
for ENTRY in "$DIR/config"/*; do
echo -e "[\e[32m.config\e[39m] installing $ENTRY"
installfile $ENTRY ~/.config/${ENTRY##*/}
done