diff options
Diffstat (limited to 'lib-src/mr/config')
-rw-r--r-- | lib-src/mr/config | 175 |
1 files changed, 25 insertions, 150 deletions
diff --git a/lib-src/mr/config b/lib-src/mr/config index 06af1b6e..9cd84fe2 100644 --- a/lib-src/mr/config +++ b/lib-src/mr/config @@ -23,6 +23,11 @@ git_isclean = git is-clean git_clean = git clean -xdff +stow = hstow stow "$MR_REPO" +unstow = hstow unstow "$MR_REPO" +restow = hstow restow "$MR_REPO" +adopt = hstow adopt "$MR_REPO" + # --- Plugin for dgit repos # actually shipped with upstream mr, but use an include command that @@ -40,17 +45,6 @@ include = cat ~/src/dotfiles/lib-src/mr/dgit # after we include the dgit lib, which also redefines git_update) git_update = git pull-safe -# --- Adam Spiers' plugin for managing dotfile symlinks with mr - -# actually shipped with upstream mr, but use an include command that -# will always work -include = - # stow is not available on Windows - if [ -e "$HOME/src/dotfiles/lib-src/mr/stow" ] \ - && ! [ "$(perl -e 'print $^O')" = "msys" ]; then - cat "$HOME/src/dotfiles/lib-src/mr/stow" - fi - # --- joeyh's code for specifying what machine we're on for repo skip # --- tests, plus my code for detecting Git-on-Windows @@ -106,66 +100,6 @@ lib = # --- standard procedures lib = - homedir_mkdirs() { - ( - cd $HOME - mkdir -p \ - .ssh \ - tmp \ - src \ - lib \ - mnt \ - local/mutt \ - local/src \ - local/bin \ - local/big \ - local/lib \ - local/log \ - local/pub \ - local/tmp \ - local/auth \ - local/info - # lib/athena \ - # lib/backup \ - # local/anacron/spool \ - chmod 700 local/auth - # [ -L "src/build-area" ] || ln -s -T /tmp/debuild src/build-area - [ -e "Downloads" ] || ln -s tmp Downloads - # clean up after additions to .stow-local-ignore - find bin lib -type l 2>/dev/null | while read -r link; do - if readlink "$link" | grep --quiet "^[../]*/.STOW/"; then - rm "$link" - fi - done - # cleanup some old dirs if they're empty - find \ - bin \ - lib/aid \ - lib/backup \ - lib/perl5 \ - lib/hooks \ - lib/athena \ - lib/bins \ - lib/img \ - lib/mr \ - lib/src \ - local/anacron/spool \ - -type d -empty -delete 2>/dev/null ||: - ) - } - # specify files that should automatically be adopted because - # programs convert them from symlinks to regular files. Arguments - # to this function should be paths relative to the stow target - # (usually $HOME) - always_adopt () { - for f in $@; do - if ! [ -L "$STOW_TARGET/$f" ]; then - # ignore errors; if it doesn't work, the user will - # have to fix up manually - mv 2>/dev/null "$STOW_TARGET/$f" "$MR_REPO/$f" || true - fi - done - } # export plain text Org agenda in post_ hooks of ~/doc repo (not currently used) export_org_agenda () { if on athena; then @@ -179,72 +113,18 @@ lib = # --- primary dotfiles repository -# TODO we need to unstow before switching branches, and stow -# afterwards, or else do some sort of automatic cleanup of dangling -# symlinks before a restow, so a broken situation is easy to fix? -# Also see kill-broken-stowed-symlink() in .bashrc. -# -# Note that the scan is expensive. So actually we probably don't want -# the cleanup to happen automatically. Also, it should exclude -# lib/annex, src/*/ (but not src/) because I don't stow files into -# those dirs. -# -# Maybe just run it as part of sysmaint -# -# Hmm. Situation is not as bad as I thought. stow manages to clean -# up quite a few of the symlinks. So running it as part of sysmaint -# seems like a sufficient fix - [src/dotfiles] checkout = git clone https://git.spwhitton.name/dotfiles.git dotfiles -stowable = true -# we have a script to update master, and all other branches should -# only be checked out and committed to on a single host +# We have a script to update master, and all other branches should be checked +# out and committed to on only a single host, so no need to pull them, and +# they'll always be rebaseable. update = git dotfiles-update-master -push = git push origin master -# use `git dotfiles-rebase` instead -# rebase = -# # usual rebasing pattern. Per dotfiles repo policy (excluding -# # win32 case), the branch being rebased will always be rebaseable -# # on master, since it is only checked out and committed to on this -# # host -# branch="$(git rev-parse --abbrev-ref HEAD)" -# hostname="$(hostname -s)" -# if [ "$branch" = "win32" -o "$branch" = "$hostname" -o "$branch" = "develacc-$hostname" ]; then -# git rebase master -# fi -fixups = - # Use a rebase workflow as I'm the only committer - git config pull.rebase true - # Pushing and pulling are always done explicitly - for head in $(git for-each-ref --format='%(refname)' refs/heads/); do - branch=$(echo "$head" | cut -d/ -f3) - git branch --unset-upstream "$branch" 2>/dev/null || true - done - git config push.default nothing - # this is just for M-x magit-status - git config remote.pushDefault origin - # - homedir_mkdirs - chmod -Rf u+rwX,go= $HOME/local/auth/* || true - # eventually move the following two lines from fixups to post_checkout - install-git-hooks dotfiles - git config user.signingkey 8DC2487E51ABDD90B5C4753F0F56D0553B6D411B - # eventually drop this - rm -f .git/hooks/post-checkout{,_01gpgsign} - -# clean-ups so that initial stow will be successful -pre_stow = - homedir_mkdirs - $HOME/src/dotfiles/bin/unskel - # these will often end up created, e.g. by insinuate-dotfiles script - rm -f $HOME/.gnupg/{gpg.conf,gpg-agent.conf,dirmngr.conf,.gpg-v21-migrated} - -# this file frequently gets desymlinked -pre_unstow_append = always_adopt .config/mimeapps.list -pre_restow_append = always_adopt .config/mimeapps.list -pre_stow_append = always_adopt .config/mimeapps.list -pre_update_append = always_adopt .config/mimeapps.list +push = git dotfiles-rebase +# Restowing is expensive, and most dangling symlinks into ~/.STOW do no harm, +# so we leave it to be run manually -- bstraph stows but does not restow. +# Possibly restowing could be done by locmaint, or we could have hstow skip +# annex/ and src/, into which I don't stow anything. +fixups = bstraph # --- private dotfiles repositories @@ -252,7 +132,9 @@ pre_update_append = always_adopt .config/mimeapps.list checkout = git clone athenag:libpriv.git priv update = git annex sync --content cloud origin push = git annex sync --content cloud origin -stowable = true +post_update = + hstow stow ~/lib/priv + load-trustdb sync = mr autoci && git annex sync --no-commit --content cloud origin skip = lazy @@ -261,6 +143,11 @@ post_checkout = git annex init git annex enableremote cloud git annex group . backup + # Delete any pubring.kbx created by INSINUATE-DOTFILES Consfigurator + # property / 'insinuate-dotfiles' shell script: don't want to adopt it. + rm -f ~/.gnupg/pubring.kbx + hstow stow ~/lib/priv + load-trustdb fixups = chmod 600 .passwddb.pet \ @@ -282,21 +169,18 @@ fixups = git config mrrepo.review-unused false autoci = + hstow stow ~/lib/priv # to perform adoptions git annex add .passwddb.pet .labbook.gpg .gnupg/pubring.kbx git commit -a -m \ "auto passwddb, pubring and labbook commit on $(hostname -s)" || true pre_update = mr autoci -# since dotfiles repo also stows into ~/.gnupg, and athpriv repo stows -# into ~/.duply, make the dirs first -pre_stow = homedir_mkdirs -post_stow = load-trustdb - [src/athpriv] checkout = git clone demeterp:athpriv athpriv pre_update = on athena || git annex sync origin athenah pre_push = on athena || git annex sync --content origin athenah -stowable = true +post_update = hstow stow ~/src/athpriv +post_checkout = hstow stow ~/src/athpriv skip = ! mine post_checkout = @@ -321,15 +205,6 @@ autoci = git annex add News/* git commit News -m"auto commit of Gnus score files" ||: -# since priv repo also stows into ~/.duply, make the dir first -pre_stow = homedir_mkdirs - -# r2e always desymlinks this file -pre_stow_append = always_adopt .config/rss2email.cfg -pre_unstow_append = always_adopt .config/rss2email.cfg -pre_restow_append = always_adopt .config/rss2email.cfg -pre_update_append = always_adopt .config/rss2email.cfg - # --- hosts configuration [src/propellor] |