aboutsummaryrefslogtreecommitdiff
path: root/link-user
blob: 752e38cb85bfbac6eb2f829cce9218d767bce493 (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
#!/usr/bin/env bash
# Symlinks the files in user/ into my XDG_CONFIG_HOME.

set -u

cd $(dirname "$0") # change to the directory of the script
cd user

for dir in $(find . -type d); do
    homedir="$XDG_CONFIG_HOME/$dir"
    if [ ! -d $homedir ]; then
        mkdir "$homedir"
    fi
    if [ -L $homedir ]; then
        rm "$homedir"
        mkdir "$homedir"
    fi
done

for file in $(find . -type f); do
    homefile="$XDG_CONFIG_HOME/$file"
    if [ -L $homefile ]; then
        rm "$homefile"
    fi
    ln -s "$PWD/$file" "$homefile"
done

if [[ -f ~/.mozilla/firefox/profiles.ini ]]; then
    for dir in ~/.mozilla/firefox/*.*/; do
        mkdir -p "$dir"/chrome
        ln -sf ~/.config/mozilla/firefox/userChrome.css "$dir/chrome"
    done
fi