#!/bin/sh
# Conveniently use sysyadm
unignore="/etc/yadm/unignore"
test -r "$unignore" && cat "$unignore" | while read f; do eval ls -d $f; done | sysyadm add --intent-to-add --pathspec-from-file=- 2>/dev/null
case "$1" in
  ("") sysyadm s;;
  (p) sysyadm p;;
  (l) sysyadm fetch && sy rebase main --onto origin/main;;
  (clone) sudo -E sysyadm clone -w / git.jfischer.org:xeruf/etc.git --bootstrap;;
  (init) sudo -E sysyadm init -b main -w /;;
  (*) sudo -E sysyadm "$@";;
esac
sudo chown -R $USER /etc/yadm
