X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;ds=sidebyside;f=conflink;h=55d7a02489dc6b1d1ae3cbf7d0f3152778d73215;hb=7d5e9e87105fafa2243603f958c8b41cdaa7f0ad;hp=aecd0377119a99daf04b7d0e497e65c46f729de0;hpb=36f92d5af79d7934e953515f58af1c86d6838599;p=distro-setup diff --git a/conflink b/conflink index aecd037..55d7a02 100755 --- a/conflink +++ b/conflink @@ -1,7 +1,7 @@ #!/bin/bash source /a/bin/errhandle/err -_errcatch_cleanup() { +errcatch-cleanup() { echo 1 >~/.local/conflink } @@ -24,14 +24,26 @@ m() { s() { sudo "$@"; } lnf() { /a/exe/lnf "$@"; } + +# error prone +#f=~/.local/conflink +# fast=false +# if [[ -e $f ]] && (( $(stat -c %Y $f) > $now - 60*60*24 )); then +# fast=true +# fi if [[ $1 == -f ]]; then # f for fast - lnf() { ln -sf "$@"; } + fast=true + shift elif [[ $1 ]]; then echo "error: unrecognized arguments" >&2 exit 0 fi +if $fast; then + lnf() { ln -sf "$@"; } +fi + shopt -s nullglob shopt -s extglob shopt -s dotglob @@ -76,10 +88,13 @@ common-file-setup() { # but I haven't looked at the symlinks. # s rsync -n -ahviSAXPH --specials --devices --chown=root:root --chmod=g-s $fs / # note, symlinks get resolved, not copied. - if s tar --mode=g-s --owner=0 --group=0 -cz -C $fs . | s tar -dz -C / | grep /etc/systemd &>/dev/null; then + if s tar --anchored \ + --exclude etc/dovecot/users \ + --exclude etc/exim4/passwd \ + --exclude etc/exim4/*.pem \ + --mode=g-s --owner=0 --group=0 -cz -C $fs . | s tar -dz -C / | grep /etc/systemd &>/dev/null; then systemd_reload=true fi - s tar --mode=g-s --owner=0 --group=0 -cz -C $fs . | s tar -xz -C / fi if [[ -e $dir/subdir_files ]]; then @@ -164,4 +179,3 @@ case $user in echo "$0: error: unexpected user"; exit 1 ;; esac -