diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-11 23:32:12 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-12 11:23:53 -0700 |
commit | f223f38fcab3c94402603d1fadb2d6fa0ac3d05a (patch) | |
tree | 8036d67f8e96d335368d8b1ff19d3c98770fd754 | |
parent | 74585ec4711667c76ecdad7eb53590cb912501ba (diff) | |
download | dotfiles-f223f38fcab3c94402603d1fadb2d6fa0ac3d05a.tar.gz |
GNU Stow -> hstow, and follow-up tidying & simplifications
-rw-r--r-- | .bash_defns | 10 | ||||
-rw-r--r-- | .hstow-always-adopt | 1 | ||||
-rw-r--r-- | .hstow-local-ignore | 11 | ||||
-rw-r--r-- | .stow-local-ignore | 14 | ||||
l--------- | Downloads | 1 | ||||
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | archive/Rexfile | 2 | ||||
-rwxr-xr-x | archive/bin/apple-setup.sh | 2 | ||||
-rwxr-xr-x | archive/bin/chkstow (renamed from lib-src/stow/chkstow) | 0 | ||||
-rwxr-xr-x | archive/bin/stow (renamed from lib-src/stow/stow) | 0 | ||||
-rw-r--r-- | archive/lib-src/mr/stow (renamed from lib-src/mr/stow) | 0 | ||||
-rw-r--r-- | archive/perl5/Stow.pm (renamed from perl5/Stow.pm) | 0 | ||||
-rw-r--r-- | archive/perl5/Stow/Util.pm (renamed from perl5/Stow/Util.pm) | 0 | ||||
-rwxr-xr-x | bin/bstraph | 78 | ||||
-rwxr-xr-x | bin/bstraph.sh | 27 | ||||
-rwxr-xr-x | bin/git-dotfiles-update-master | 6 | ||||
-rwxr-xr-x | bin/hstow | 172 | ||||
-rwxr-xr-x | bin/insinuate-dotfiles | 2 | ||||
-rwxr-xr-x | bin/unskel | 25 | ||||
-rw-r--r-- | lib-src/mr/config | 175 | ||||
-rw-r--r-- | perl5/Local/MrRepo/Repo.pm | 2 |
21 files changed, 295 insertions, 239 deletions
diff --git a/.bash_defns b/.bash_defns index 76a76097..d1a994d7 100644 --- a/.bash_defns +++ b/.bash_defns @@ -50,16 +50,6 @@ package-plan-unpack () { ~/src/dotfiles/scripts/debian/package-plan-unpack "$1"; cd "/tmp/$1" } -# tidy up if I deleted files from stowed repos without properly -# restowing -kill-broken-stowed-symlinks () { - find "$HOME" -xtype l | while read -r link; do - if readlink "$link" | grep --quiet "^[../]*/.STOW/"; then - rm "$link" - fi - done -} - # install package(s) and immediately mark as auto installed, so it # will get cleaned up by the next autoclean. # --no-install-recommends is needed as otherwise packages are manually diff --git a/.hstow-always-adopt b/.hstow-always-adopt new file mode 100644 index 00000000..a75cc276 --- /dev/null +++ b/.hstow-always-adopt @@ -0,0 +1 @@ +.config/mimeapps.list diff --git a/.hstow-local-ignore b/.hstow-local-ignore new file mode 100644 index 00000000..c2f6b18e --- /dev/null +++ b/.hstow-local-ignore @@ -0,0 +1,11 @@ +archive/* +bin/* +hooks/* +lib-src/* +perl5/* +scripts/* + +GTAGS +GRTAGS +GPATH +README diff --git a/.stow-local-ignore b/.stow-local-ignore deleted file mode 100644 index 769c716d..00000000 --- a/.stow-local-ignore +++ /dev/null @@ -1,14 +0,0 @@ -^/archive -^/bin -^/hooks -^/lib-src -^/perl5 -^/scripts - -^/\.git -^/\.gitignore - -^/GTAGS -^/GRTAGS -^/GPATH -^/README diff --git a/Downloads b/Downloads new file mode 120000 index 00000000..f1fde8c1 --- /dev/null +++ b/Downloads @@ -0,0 +1 @@ +../../tmp
\ No newline at end of file @@ -30,13 +30,13 @@ cloning this repo into HOME on arbitrary machines less intrusive. Minimal system requirements ================================ -git; Perl 5/7; POSIX.2 shell and utilities +POSIX.2 shell and utilities ================================ Recommended pre-installed extras ================================ -Git::Wrapper +git; Perl 5/7; Git::Wrapper ================================ Minimal setup @@ -48,4 +48,4 @@ Git::Wrapper 2. Run bootstrap script: - % $HOME/src/dotfiles/bin/bstraph.sh + % $HOME/src/dotfiles/bin/bstraph diff --git a/archive/Rexfile b/archive/Rexfile index 00bebe09..cd523e76 100644 --- a/archive/Rexfile +++ b/archive/Rexfile @@ -126,7 +126,7 @@ task "dotfiles" => sub { die "unimplemented"; } - run "~/src/dotfiles/bin/bstraph.sh"; + run "~/src/dotfiles/bin/bstraph"; }; 1; diff --git a/archive/bin/apple-setup.sh b/archive/bin/apple-setup.sh index 71101fc2..21f382f1 100755 --- a/archive/bin/apple-setup.sh +++ b/archive/bin/apple-setup.sh @@ -54,7 +54,7 @@ if ! [ -d "$HOME/src/dotfiles/.git" ]; then git clone https://git.spwhitton.name/dotfiles $HOME/src/dotfiles # this is currently out of action because GNU stow installs but # doesn't seem to actually do anything on Mac OS - # $HOME/src/dotfiles/bin/bstraph.sh + # $HOME/src/dotfiles/bin/bstraph cp $HOME/src/dotfiles/{.zshrc,.shenv} $HOME # instead fi pkill firefox diff --git a/lib-src/stow/chkstow b/archive/bin/chkstow index a74d1b90..a74d1b90 100755 --- a/lib-src/stow/chkstow +++ b/archive/bin/chkstow diff --git a/lib-src/stow/stow b/archive/bin/stow index b94dc88d..b94dc88d 100755 --- a/lib-src/stow/stow +++ b/archive/bin/stow diff --git a/lib-src/mr/stow b/archive/lib-src/mr/stow index 254bd0c3..254bd0c3 100644 --- a/lib-src/mr/stow +++ b/archive/lib-src/mr/stow diff --git a/perl5/Stow.pm b/archive/perl5/Stow.pm index bda7d3ab..bda7d3ab 100644 --- a/perl5/Stow.pm +++ b/archive/perl5/Stow.pm diff --git a/perl5/Stow/Util.pm b/archive/perl5/Stow/Util.pm index c22d7b87..c22d7b87 100644 --- a/perl5/Stow/Util.pm +++ b/archive/perl5/Stow/Util.pm diff --git a/bin/bstraph b/bin/bstraph new file mode 100755 index 00000000..7d729ff3 --- /dev/null +++ b/bin/bstraph @@ -0,0 +1,78 @@ +#!/bin/sh + +# Bootstrap home directory after dotfiles repository successfully cloned (see +# INSINUATE-DOTFILES Consfigurator property and 'insinuate-dotfiles' script). +# This script should be POSIX sh and idempotent. This is the 'mr fixups' +# action for src/dotfiles, here rather than in src/dotfiles/lib-src/mr/config +# so that we can run it even if we don't have a Perl interpreter. + +set -e + +cd "$HOME/src/dotfiles" + +if [ -d /etc/skel ]; then + cd /etc/skel + for file in $(find . -type f); do + [ -e "$HOME/$file" -a ! -h "$HOME/$file" ] \ + && cmp "$file" "$HOME/$file" >/dev/null && rm "$HOME/$file" + done + cd "$HOME/src/dotfiles" +fi + +# On Debian systems root gets a special .bashrc and .profile. +for f in bashrc profile; do + [ -e /usr/share/base-files/dot.$f \ + -a -e "$HOME/.$f" -a ! -h "$HOME/.$f" ] \ + && cmp /usr/share/base-files/dot.$f "$HOME/.$f" >/dev/null \ + && rm "$HOME/.$f" +done + +# These will often end up created by, e.g., insinuate-dotfiles. +# Remove them so that the initial stow will not involve any conflicts. +for f in gpg.conf gpg-agent.conf dirmngr.conf .gpg-v21-migrated; do + [ -h "$HOME/.gnupg/$f" ] || rm -f "$HOME/.gnupg/$f" +done + +bin/hstow stow . + +if command -v git >/dev/null; then + # Use a rebase workflow as I'm the only committer. + git config pull.rebase true + + git config user.signingkey 8DC2487E51ABDD90B5C4753F0F56D0553B6D411B + + # Pushing and pulling are always done explicitly. + for branch in $(git for-each-ref \ + --format='%(refname:short)' refs/heads/); do + git rev-parse "$branch"@{upstream} >/dev/null 2>&1 \ + && git branch --unset-upstream "$branch" + done + git config push.default nothing + + # This is just for `magit-status'. + git config remote.pushDefault origin + + # Don't set up any tracking branches, or fetch it. + [ -z "$(git remote)" ] \ + && git remote add origin https://git.spwhitton.name/dotfiles + + # Non-POSIX cleanup: eventually drop. + rm -f .git/hooks/post-checkout{,_01gpgsign} + 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 ||: + + # Eventually move to 'if ! [ "$MR_ACTION" = fixups ]; then' part, above. + bin/install-git-hooks dotfiles +fi + +cd "$HOME" +[ -e .mrconfig ] || cat >.mrconfig <<EOF +# -*- mode: conf -*- + +include = cat ~/src/dotfiles/lib-src/mr/config +EOF +mkdir -p .ssh tmp src lib mnt \ + local/mutt local/big local/pub local/auth \ + local/src local/bin local/lib local/log local/tmp local/info +chmod -R u+rwX,go= local/auth diff --git a/bin/bstraph.sh b/bin/bstraph.sh deleted file mode 100755 index 46d6ba84..00000000 --- a/bin/bstraph.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -. $HOME/src/dotfiles/.shenv - -# Bootstrap home directory after dotfiles repository successfully -# cloned (see ~/bin/insinuate-dotfiles). This script should -# definitely be POSIX sh - -set -e - -if ! [ -e "$HOME/.mrconfig" ]; then - cat >"$HOME/.mrconfig" <<EOF -# -*- mode: conf -*- - -include = cat ~/src/dotfiles/lib-src/mr/config -EOF -fi -( - cd $HOME/src/dotfiles - mr fixups - mr stow - - if [ -z $(git remote) ]; then - # don't set up any tracking branches or fetch it - git remote add origin athena:dotfiles - fi -) diff --git a/bin/git-dotfiles-update-master b/bin/git-dotfiles-update-master index 0a3ac34d..d48290b4 100755 --- a/bin/git-dotfiles-update-master +++ b/bin/git-dotfiles-update-master @@ -1,11 +1,5 @@ #!/bin/sh -# Before using this script, will want to unset all upstreams: -# 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 - # Could generalise to a script that reads a git config value for the # fingerprint to look for, updates branches specified by user and is # able to handle updating by both merge and rebase diff --git a/bin/hstow b/bin/hstow new file mode 100755 index 00000000..d151504b --- /dev/null +++ b/bin/hstow @@ -0,0 +1,172 @@ +#!/bin/sh + +# hstow -- POSIX sh minimal reimplementation of GNU Stow for dotfiles +# +# Copyright (C) 2022 Sean Whitton <spwhitton@spwhitton.name> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# The point of this script is to obtain minimally functional dotfiles +# handling in one's home directory on even machines that lack a Perl +# interpreter. As such, many of GNU Stow's more advanced features are +# not reimplemented. Git depends on Perl, for now, but my two methods +# for deploying my dotfiles to remote machines -- my INSINUATE-DOTFILES +# Consfigurator property and 'insinuate-dotfiles' shell script -- do not +# depend on having Git on the remote side. See also 'bstraph' script. +# +# We completely skip filenames containing control characters, including +# newline and tab, as POSIX find(1) lacks -print0, and it's unlikely +# you'd need to stow any such files. +# Technique from <https://dwheeler.com/essays/filenames-in-shell.html>. + +set -efu +IFS="$(printf '\n\t')" +export LC_ALL=C +tab="$(printf '\t')" +cchars="$(printf '*[\001-\037\177]*')" + +if ! command -v readlink >/dev/null; then + readlink () { + # Safe parse of ls(1) output given its POSIX specification. + ls -ld "$1" | tr -s ' ' \ + | cut -d' ' -f9- | cut -c$((4 + $(echo "$1" | wc -c)))- + } +fi + +read_globs_file () { + if [ -e "$DIR/$1" ]; then + while read -r line; do + printf "|./%s" "$line" + done <"$DIR/$1" | cut -c2- + fi +} + +dir_contents () { + ( cd "$1"; find . ! -name . ! -name "$cchars" ) +} + +fail () { + echo >&2 "hstow: $*" + exit 127 +} + +usage () { + fail "usage: hstow stow|unstow|restow|adopt DIRECTORY" +} + +stow () { + cd "$DIR" + [ -d "$HOME/.STOW" ] || mkdir "$HOME/.STOW" + [ -f "$HOME/.STOW/.stow" ] || touch "$HOME/.STOW/.stow" + [ -h "$HOME/.STOW/$NAME" ] \ + || ( cd "$HOME/.STOW"; ln -s "$DIR" "$NAME" ) + conflicts= + ignores="$(read_globs_file .hstow-local-ignore)" + + # Files that (i) always/often have their symlinks replaced with + # regular files when applications access them; and (ii) we don't + # ever want to edit the copy under $DIR directly, but only via the + # link/copy under $HOME. + $always_adopt || adoptions="$(read_globs_file .hstow-always-adopt)" + + for file in $(find . ! -name . ! -type d ! -name "$cchars" \ + ! -name .gitignore \ + ! -name .hstow-local-ignore \ + ! -name .hstow-always-adopt \ + | grep -v '^\./\.git/'); do + file_dir="$(dirname $file)" + if [ -n "$ignores" ]; then + eval case "'$file'" in "${ignores})" continue ";;" esac + eval case "'$file_dir'" in "${ignores})" continue ";;" esac + fi + + rel="$(echo $file | sed -E 's#/dot[-.]([^/]+)#/.\1#g; s#^\./##')" + dotdotslashes="$(echo $rel | sed -E 's#[^/]*$##; s#[^/]+#..#g')" + target="${dotdotslashes}.STOW/$NAME/$rel" + link="$HOME/$rel" + link_target= + [ -h "$link" ] && link_target="$(readlink $link)" + + [ "$target" = "$link_target" ] && continue + + if [ ! -h "$link" -a ! -h "$file" -a -f "$link" ]; then + if $always_adopt \ + || ( [ -n "$adoptions" ] \ + && eval case "'$file'" in \ + "${adoptions})" exit 0 ";;" \ + "*)" exit 1 ";;" \ + esac ); then + mv -f "$link" "$file" + ln -s "$target" "$link" + else + conflicts="$conflicts${tab}$file" + fi + elif [ -h "$link" ]; then + # With at least GNU ln(1), passing -f, but not also -T, does not + # replace an existing link in some cases. + # -T is not POSIX, so we just remove any existing link first. + rm "$link" + ln -s "$target" "$link" + else + mkdir -p "$HOME/$file_dir" + ln -s "$target" "$link" + fi + done + [ -z "$conflicts" ] && return + echo >&2 "hstow: encountered conflicts:" + for conflict in $conflicts; do echo >&2 " $conflict"; done + exit 127 +} + +unstow () { + cd "$HOME" + dir_pat="^.$(echo $DIR | cut -c$(echo $HOME | wc -c)-)/" + for file in $(find . -type l ! -name . ! -name "$cchars" \ + | grep -v "$dir_pat"); do + if readlink "$file" | grep -Eq '^(\.\./)*\.STOW/'"$NAME/"; then + rm "$file" + while true; do + file="$(dirname $file)" + [ "$file" = . ] && break + if [ -z "$(dir_contents $file)" ]; then + rmdir "$file" + else + break + fi + done + fi + done + [ -e "$HOME/.STOW/$NAME" ] && rm "$HOME/.STOW/$NAME" + if [ -d "$HOME/.STOW" ] \ + && [ "$(dir_contents $HOME/.STOW)" = "./.stow" ]; then + rm "$HOME/.STOW/.stow" + rmdir "$HOME/.STOW" + fi +} + +[ $# = 2 ] || usage +[ -d "$2" ] || fail "$2 is not an existing directory" +DIR="$(cd $2; pwd)" +[ "$(echo $DIR | cut -c-$(($(echo $HOME | wc -c) - 1)))" = "$HOME" ] \ + || fail "$DIR is not below $HOME" + +NAME="$(echo $DIR | tr / _)" +always_adopt=false +case "$1" in + 'stow') stow ;; + 'unstow') unstow ;; + 'restow') unstow; stow ;; + 'adopt') always_adopt=true; stow ;; + *) usage ;; +esac diff --git a/bin/insinuate-dotfiles b/bin/insinuate-dotfiles index 6cc5e5a4..d7ec9178 100755 --- a/bin/insinuate-dotfiles +++ b/bin/insinuate-dotfiles @@ -58,4 +58,4 @@ if ssh "$1" which gpg >/dev/null; then | ssh "$1" gpg --import fi # stow dotfiles into $HOME -ssh "$1" 'sh src/dotfiles/bin/bstraph.sh' +ssh "$1" 'sh src/dotfiles/bin/bstraph' diff --git a/bin/unskel b/bin/unskel deleted file mode 100755 index 80f77d53..00000000 --- a/bin/unskel +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# Removes contents of /etc/skel in home directory. Checks for -# modifications, so should always be safe to run. - -SKEL="/etc/skel" -torm="" - -for skelfile in $(find $SKEL -maxdepth 1 -type f | sed -e "s|${SKEL}/||"); do - # The following conditional passes if the file in $HOME is the - # *same* as the file in $SKEL, so it ought to be deleted. - if diff -q "$SKEL/$skelfile" "$HOME/$skelfile" >/dev/null 2>&1; then - torm="$torm $HOME/$skelfile" - fi -done - -[ "$torm" = "" ] || rm -rf $torm - -# on Debian systems root gets a special .bashrc and .profile -if diff -q /usr/share/base-files/dot.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then - rm -f "$HOME/.bashrc" -fi -if diff -q /usr/share/base-files/dot.profile "$HOME/.profile" >/dev/null 2>&1; then - rm -f "$HOME/.profile" -fi 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] diff --git a/perl5/Local/MrRepo/Repo.pm b/perl5/Local/MrRepo/Repo.pm index edc87e92..937d0a0e 100644 --- a/perl5/Local/MrRepo/Repo.pm +++ b/perl5/Local/MrRepo/Repo.pm @@ -45,7 +45,7 @@ sub auto_commit { shift->_mr_cmd("-m", "autoci") } sub update { my $self = shift; - # note that this also restows + # note that this may also stow my $result = $self->_mr_cmd("update"); $self->{updated} = 1 if $result->{exit} == 0 |