summaryrefslogtreecommitdiffstats
path: root/.bin/synchronize-pub-dots
blob: 8c7a9c4ad3f3ef2e16b51ec46538c64e58062f68 (plain) (blame)
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
#!/bin/sh

set -e

command -v yadm git
git rev-parse --is-inside-work-tree

allowed_patterns="-e ^.bin
	-e ^.config/alacritty/
	-e ^.config/calcurse/
	-e ^.config/cmus/classic.theme
	-e ^.config/cmus/rc
	-e ^.config/dot/term-color-*
	-e ^.config/gopass/config.yml
	-e ^.config/i3*/config
	-e ^.config/mimeapps.list
	-e ^.config/neomutt/neomuttrc
	-e ^.config/newsboat/config
	-e ^.config/nvim/
	-e ^.config/pipewire/
	-e ^.config/qutebrowser/config.py
	-e ^.config/qutebrowser/greasemonkey/
	-e ^.config/sway/config
	-e ^.config/systemd/*.service
	-e ^.config/tmux/
	-e ^.config/user-dirs.dir
	-e ^.config/user-dirs.locale
	-e ^.config/virt-lightning/
	-e ^.config/xsuspender.conf
	-e ^.gnupg/gpg-agent.conf
	-e ^.kshrc
	-e ^.mbsyncrc
	-e ^.npmrc
	-e ^.public-keys/
	-e ^.weechat/buflist.conf
	-e ^.weechat/fset.conf
	-e ^.weechat/logger.conf
	-e ^.xinitrc
	-e ^.zshrc
	"

[ "$(yadm rev-parse --show-toplevel)" != "$(git rev-parse --show-toplevel)" ]

# retrieve existing files
upstream_files=$(cd "${HOME}" && yadm ls-files)
local_files=$(find . -not -path "./.git*" -not -path ".")

echo "${local_files}" | xargs rm -rf

allowed_files=$(echo "${upstream_files}" | grep ${allowed_patterns})
for allowed_file in ${allowed_files}; do
	echo "${allowed_file}"
	install -D "${HOME}/${allowed_file}" "${allowed_file}"
done

git add .
git commit -m "$(date)"
remember that computers suck.