configs  Check-in [dfc76a33b7]

Overview
Comment:create_symlinks.sh: Only symlink as needed
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dfc76a33b7b4a659953114c783dc43e2ef033559aed2bd743961da6df9f15977
User & Date: js 2020-02-16 18:09:33
Context
2020-02-19
21:46
Consistent indenting for .fish files check-in: bed5a23ae3 user: js tags: trunk
2020-02-16
18:09
create_symlinks.sh: Only symlink as needed check-in: dfc76a33b7 user: js tags: trunk
17:48
cross.fish: Add devkitPro check-in: 01a7f7a67b user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to create_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
#!/bin/sh
rel_dir="${PWD#$HOME/}"
echo "Configs relative to home in $rel_dir."

link_file() {
	if [ ! -f "$HOME/$2" ]; then

		ln -s "$3$rel_dir/$1" "$HOME/$2"
	else
		echo "$HOME/$2 already exists, skipping..."
	fi
}


link_file gitconfig .gitconfig

mkdir -p $HOME/.gnupg
link_file gpg.conf .gnupg/gpg.conf ../

link_file tmux.conf .tmux.conf

link_file vim .vim
link_file vimrc .vimrc

link_file config/fish .config/fish ../
mkdir -p $HOME/.config/youtube-dl
link_file config/youtube-dl/config .config/youtube-dl/config ../../
link_file zshrc .zshrc

if test x"$(uname -s)" = x"Darwin"; then



	link_file eu_US.keylayout \
		"Library/Keyboard Layouts/eu_US.keylayout" ../../
else



	link_file Xdefaults .Xdefaults
	link_file Xmodmap .Xmodmap
	link_file xinitrc .xinitrc
fi





|
>


|



>
|
>
|
|
>
|
>
|
|
>
|
<
|
|


>
>
>
|
|
|
>
>
>




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/sh
rel_dir="${PWD#$HOME/}"
echo "Configs relative to home in $rel_dir."

link_file() {
	if [ ! -e "$HOME/$2" ]; then
		echo "Symlinking $HOME/$2 -> $3$rel_dir/$1…"
		ln -s "$3$rel_dir/$1" "$HOME/$2"
	else
		echo "$HOME/$2 already exists, skipping"
	fi
}

mkdir -p $HOME/.config
which git >/dev/null 2>&1 && link_file gitconfig .gitconfig
if which gpg >/dev/null 2>&1 || which gpg2 >/dev/null 2>&1; then
	mkdir -p $HOME/.gnupg
	link_file gpg.conf .gnupg/gpg.conf ../
fi
which tmux >/dev/null 2>&1 && link_file tmux.conf .tmux.conf
if which vim >/dev/null 2>&1; then
	link_file vim .vim
	link_file vimrc .vimrc
fi
which fish >/dev/null 2>&1 && link_file config/fish .config/fish ../

which youtube-dl >/dev/null 2>&1 && link_file config/youtube-dl .config/youtube-dl ../
which zsh >/dev/null 2>&1 && link_file zshrc .zshrc

if test x"$(uname -s)" = x"Darwin"; then
	dest="$HOME/Library/Keyboard Layouts/eu_US.keylayout"
	# This does not like being symlinked…
	if [ ! -e "$dest" ]; then
		echo "Hardlinking eu_US.keylayout -> $dest"
		ln eu_US.keylayout "$dest"
	else
		echo "$dest already exists, skipping…"
	fi
elif which startx >/dev/null 2>&1; then
	link_file Xdefaults .Xdefaults
	link_file Xmodmap .Xmodmap
	link_file xinitrc .xinitrc
fi