blob: ebb5c3fe7fd68e6e2ba3d8afa1f96fe19f706974 (
plain)
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
|
#!/bin/bash
# Define an associative array mapping dotfile names to their corresponding paths
declare -A dotfiles=(
["bashrc"]="$HOME/.bashrc"
["papes/PurplePhoneLines.jpg"]="$HOME/Pictures/Papes/PurplePhoneLines.jpg"
["local/bin"]="$HOME/.local/bin"
["config/foot"]="$HOME/.config/foot"
["config/sway"]="$HOME/.config/sway"
["config/dunst"]="$HOME/.config/dunst"
["config/i3status/"]="$HOME/.config/i3status"
# Add more dotfiles here as needed
)
# Function to create symbolic links
create_symlink() {
local source=$1
local target=$2
# Check if the target file already exists
if [ -e "$target" ]; then
echo "Target file '$target' already exists. Skipping..."
return
fi
# Check if the target directory exists, if not, create it
local target_dir=$(dirname "$target")
if [ ! -d "$target_dir" ]; then
mkdir -p "$target_dir"
fi
# Create symbolic link
ln -s "$source" "$target"
echo "Created symbolic link: $source -> $target"
}
# Loop through each dotfile and create symbolic links
for file in "${!dotfiles[@]}"; do
create_symlink "$(pwd)/$file" "${dotfiles[$file]}"
done
echo "Dotfile setup complete."
|