-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·132 lines (108 loc) · 3.44 KB
/
deploy.sh
File metadata and controls
executable file
·132 lines (108 loc) · 3.44 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/env bash
#TODO:
# option to dry run
# targets for deploy all keyword (the current programs I use regularly)
all_targets=("kitty" "zsh" "starship" "nvim" "ranger" "tmux" "colors" "zathura" "direnv" "nix" "stylua" "latexindent")
dotfiles=$(pwd) # TODO: this should always be the location of this script
targets=( `printf "%q\n" "$@" | sort -u` ) # remove duplicate values
synced=()
failed=()
# echo $@
# echo ${synced[@]}
sync() {
echo -e "\nAttempting to sync $1"
case $1 in
#copy zsh directory and keep .zshrc in $HOME
nix)
mkdir -p $HOME/.confignix &&
rsync -rav $dotfiles/config/nix $HOME/.config &&
synced+=("Nix");;
zsh)
mkdir -p $HOME/.config/zsh &&
rsync -rav $dotfiles/config/zsh $HOME/.config &&
ln -snT ~/.config/zsh/.zshrc ~/.zshrc &&
synced+=("Zsh");;
starship | prompt)
##Starship Prompt
rsync -rav $dotfiles/config/starship.toml $HOME/.config &&
synced+=("Starship");;
alacritty)
mkdir -p $HOME/.config/alacritty &&
rsync -rav $dotfiles/config/alacritty $HOME/.config &&
synced+=("Alacritty");;
foot)
mkdir -p $HOME/.config/foot &&
rsync -rav $dotfiles/config/foot $HOME/.config &&
synced+=("Foot");;
kitty)
mkdir -p $HOME/.config/kitty &&
rsync -rav $dotfiles/config/kitty $HOME/.config &&
synced+=("Kitty");;
# dircolors / lscolors
colors | dircolors)
rsync -rav $dotfiles/.dircolors $HOME &&
synced+=("Dircolors");;
ranger)
mkdir -p $HOME/.config/ranger/plugins &&
rsync -rav $dotfiles/config/ranger $HOME/.config &&
synced+=("Ranger");;
nvim | neovim)
mkdir -p $HOME/.config/nvim &&
rsync -rav $dotfiles/config/nvim $HOME/.config &&
synced+=("Neovim");;
tmux)
mkdir -p $HOME/.config/tmux &&
rsync -rav $dotfiles/config/tmux $HOME/.config &&
# ln -snT ~/.config/tmux/.tmux.conf ~/.tmux.conf &&
synced+=("Tmux");;
zathura)
mkdir -p $HOME/.config/zathura &&
rsync -rav $dotfiles/config/zathura $HOME/.config &&
synced+=("Zathura");;
direnv)
mkdir -p $HOME/.config/direnv &&
rsync -rav $dotfiles/config/direnv $HOME/.config &&
synced+=("Direnv");;
stylua)
rsync -rav $dotfiles/.stylua.toml $HOME/ &&
synced+=("Stylua");;
latexindent)
rsync -rav $dotfiles/indentconfig.yaml $HOME/ &&
synced+=("LatexIndent");;
git)
mkdir -p $HOME/.config/git &&
rsync -rav $dotfiles/config/git $HOME/.config &&
rsync -rav $dotfiles/config/delta.conf $HOME/.config &&
synced+=("gitconfig");;
test) # fails
return 1 &&
echo "synced test";;
##Nvim - latex formatter
# rsync -rav $dotfiles/config/tex-fmt $HOME/.config
# echo "Synced tex-fmt"
*)
echo "$1 is not an option";;
esac
}
# if all is present in inputs, set all as the input
[[ " ${targets[*]} " == *' all '* ]] && targets=${all_targets[@]} && echo "deploying all";
# deploy all targets
for key in ${targets[@]}; do
sync ${key}
if [[ $? = 1 ]]; then
failed+=($key)
echo "failed"
fi
done
echo ""
# summary output on results
for task in ${synced[@]}; do
echo "Synced ${task}"
done
echo ""
if [[ -n $"{failed[@]}" ]]; then
for task in ${failed[@]}; do
echo "Failed to sync ${task}"
done
exit 1
fi