summaryrefslogtreecommitdiff
path: root/make-symlinks
blob: fb90154f889ab0c7c99f573bf129710ae72cf45c (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
43
44
45
46
#!/bin/sh

set -e

die() {
	echo "$@" 1>&2
	exit 1
}

abspath() {
	(cd "$1" && pwd)
}

dirname="$(abspath "$(dirname "$0")")"
echo "$dirname"

files="
    abcde.conf
    bash_profile
    bashrc
    emacs.d
    git-global-ignore
    mailcap
    profile
    screenrc
    signature
    vimrc
    xsessionrc
    ssh/config
    ssh/config-pers
    config/starship/config.toml
"

install -d "$HOME/.config"
for x in $files; do
	[ -e "$dirname/$x" ] || die "$dirname/$x does not exist, oops"
	#    [ ! -L "$HOME/.$x" ] || die "$HOME/.$x is already a symlink, oops"
done

for x in $files; do
	d="$(dirname $x)"
	if [ ! -e "$HOME/.$d" ]; then
		mkdir -p "$HOME/.$d"
	fi
	ln -sf "$dirname/$x" "$HOME/.$x"
done