-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy
executable file
·74 lines (65 loc) · 1.42 KB
/
deploy
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
set -eu
srcdir=$(pwd)
dstdir=$HOME
files_default=(
'.:.dotfiles'
'profile:.profile'
'nixpkgs-config.nix:.config/nixpkgs/config.nix'
'nvim:.config/nvim'
'git/gitconfig:.gitconfig'
'git/gitignore:.gitignore'
'bash/bashrc:.bashrc'
'fish/config.fish:.config/fish/config.fish'
'tmux:.tmux.conf'
'shellcheckrc:.shellcheckrc'
'starship.toml:.config/starship.toml'
)
files_desktop=(
'latexmkrc:.latexmkrc'
'xresources:.Xresources'
'systemd:.config/systemd/user'
'alacritty.yml:.config/alacritty/alacritty.yml'
'kitty:.config/kitty'
)
install_filepair () {
src="$srcdir/$1"
dst="$dstdir/$2"
if [ -L $dst ] ; then
rm $dst
elif [ -f $dst ] || [ -d $dst ]; then
echo "Warning! File '$dst' already exists and won't be overwritten!"
return 1
else
echo "$1 -> $2"
fi
mkdir -p ${dst%/*}
ln -sf $src $dst
}
for filepair in "${files_default[@]}" ; do
install_filepair "${filepair%%:*}" "${filepair##*:}"
done
# Optional tasks
for opt in "$@"; do
case $opt in
desktop)
for filepair in "${files_desktop[@]}" ; do
install_filepair "${filepair%%:*}" "${filepair##*:}"
done
;;
z)
rm -f $srcdir/z.sh &> /dev/null
curl https://raw.github.com/rupa/z/HEAD/z.sh -sLo $srcdir/z.sh
;;
private)
. $srcdir/private/deploy
;;
fzf)
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
;;
nixos)
(cd $srcdir/nixos && ./rebuild.sh)
;;
esac
done