-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlink.sh
executable file
·34 lines (30 loc) · 895 Bytes
/
link.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
33
34
#!/usr/bin/env bash
DOTFILES=$HOME/.dotfiles
echo -e "\\n creating symlinks"
echo "======================"
linkables=$(find -H "$DOTFILES" -maxdepth 3 -name '*.symlink')
for file in $linkables ; do
target="$HOME/.$( basename "$file" '.symlink' )"
if [ -e "$target" ]; then
echo "~${target#$HOME} already exists... skipping."
else
echo "creating symlink for $file"
ln -s "$file" "$target"
fi
done
echo -e "\\n\\n installing to ~/.config"
echo "======================"
if [ ! -d "$HOME/.config" ]; then
echo "creating ~/.config"
mkdir -p "$HOME/.config"
fi
config_files=$( find "$DOTFILES/config" -d 1 2>/dev/null )
for config in $config_files; do
target="$HOME/.config/$( basename "$config" )"
if [ -e "$target" ]; then
echo "~${target#$HOME} already exists... skipping"
else
echo "creating symlink for $config"
ln -s "$config" "$target"
fi
done