summaryrefslogtreecommitdiffstats
path: root/.bin/sync-public-dotfiles
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-12-23 18:28:03 +0000
committerRomain Gonçalves <me@rgoncalves.se>2021-12-23 18:28:03 +0000
commit0f08d04698c814955116b6bae50752e64b774d8f (patch)
tree8cf9a33557093eebfd25aab2872e97639c7e2f62 /.bin/sync-public-dotfiles
downloaddots-0f08d04698c814955116b6bae50752e64b774d8f.tar.gz
Thu Dec 23 06:28:03 PM UTC 2021
Diffstat (limited to '.bin/sync-public-dotfiles')
-rwxr-xr-x.bin/sync-public-dotfiles52
1 files changed, 52 insertions, 0 deletions
diff --git a/.bin/sync-public-dotfiles b/.bin/sync-public-dotfiles
new file mode 100755
index 0000000..7bff64f
--- /dev/null
+++ b/.bin/sync-public-dotfiles
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -e
+
+command -v yadm git
+
+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/tmux/
+ -e ^.config/mimeapps.list
+ -e ^.config/neomutt/neomuttrc
+ -e ^.config/newsboat/config
+ -e ^.config/nvim/
+ -e ^.config/qutebrowser/config.py
+ -e ^.config/qutebrowser/greasemonkey/
+ -e ^.config/sway/config
+ -e ^.config/systemd/*.service
+ -e ^.config/user-dirs.dir
+ -e ^.config/user-dirs.locale
+ -e ^.gnupg/gpg-agent.conf
+ -e ^.public-keys/
+ -e ^.kshrc
+ -e ^.weechat/buflist.conf
+ -e ^.weechat/fset.conf
+ -e ^.weechat/logger.conf
+ -e ^.weechat/weechat.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.