-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-symlinks.sh
executable file
·53 lines (47 loc) · 1.33 KB
/
setup-symlinks.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /usr/bin/bash
set -euo pipefail
# Local folder to the dotfiles repo (input argument $1)
DP="${1:-"${HOME}/git/dotfiles/"}"
echo "Setting up symlinks from '${HOME}/' to '${DP}'"
TO_LINK=(
".config/Code/User/keybindings.json"
".config/Code/User/settings.json"
".config/fish"
".config/micro"
".config/pypoetry"
".config/zim"
".config/keepassxc"
".gitconfig"
".kde/share/config/kdeglobals"
".config/gtk-3.0/settings.ini"
".config/dolphinrc"
".config/kdeglobals"
".config/kglobalshortcutsrc"
".config/konsolerc"
".config/kwinrc"
".config/kwinrulesrc"
".local/share/fonts"
".local/share/konsole"
".local/share/kxmlgui5")
echo "----------------------------"
for folder in "${TO_LINK[@]}"; do
TO="$DP$folder"
FROM="${HOME}/$folder"
# Make sure the path to symlink exists
mkdir --parents $(dirname $FROM)
if [[ -e $FROM ]]; then
echo "The file '$FROM' already exists."
echo -n "Overwrite with symlink? [y/n]: "
read confirmation
if [[ $confirmation == "y" ]]; then
rm -rf $FROM
else
echo "Skipping..."
echo "----------------------------"
continue
fi
fi
ln --symbolic $TO $FROM
echo "Created symlink: $FROM ---> $TO"
echo "----------------------------"
done