-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.fish
executable file
·58 lines (51 loc) · 1.39 KB
/
setup.fish
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
54
55
56
57
#!/usr/bin/env fish
if not test -d ~/.config
mkdir ~/.config
else
echo "~/.config exists, skipping"
end
# symlinks into $HOME/bin
if not test -d ~/bin
mkdir ~/bin
else
echo "~/bin exists, skipping"
end
for executable in bin/*
set full_executable_path "$PWD/$executable"
set bin_executable_path "$HOME/$executable"
if not test -L $bin_executable_path
ln -sv "$full_executable_path" "$bin_executable_path"
else
echo "$bin_executable_path already symlinked, skipping"
end
end
# symlinks into $HOME
for linkable in _*
set linkdir (string replace -r "^_" "." $linkable)
if not test -L "$HOME/$linkdir"
ln -sv "$PWD/$linkable" "$HOME/$linkdir"
else
echo "$HOME/$linkdir already symlinked, skipping"
end
end
# symlinks into $HOME/.config
pushd config
for dir in *
# Not sure how to avoid this since it looks like fish creates the
# $HOME/config/fish folder once this script is run. Once that is
# done, symlinking ends up going to $HOME/config/fish/fish...
if string match "fish" $dir
pushd $dir
for file in *
ln -sv "$PWD/$file" "$HOME/.config/fish/$file"
end
popd
else if not test -L "$HOME/.config/$dir"
ln -sv "$PWD/$dir" "$HOME/.config/"
else
echo "$HOME/.config/$dir already symlinked, skipping"
end
end
popd
git submodule init
git submodule update