1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 08:29:02 -08:00

prevent dedupe from echoing the new CWD

This commit is contained in:
Connor Olding 2024-07-05 21:06:50 -07:00
parent 389e81dcce
commit b416171017

View file

@ -37,8 +37,8 @@ while o="${1#-}" && [ "${#o}" != "${#1}" ] && shift
esac; done &&
{ [ -d /tmp ] || die 72 "/tmp must be mounted" ;} &&
{ [ $# -ge 2 ] || die 64 'expected at least 2 arguments' ;} &&
D="$(readlink -f "$2")" && CDPATH= cd -- "$1" && shift 2 && T="$(mktemp -d)" &&
t="$T/sums" && { [ $# -eq 0 ] || sha256sum >"$t" "$@" ;} &&
unset CDPATH && D="$(readlink -f "$2")" && cd -- "$1" && shift 2 &&
T="$(mktemp -d)" && t="$T/sums" && { [ $# -eq 0 ] || sha256sum >"$t" "$@" ;} &&
find ! -type d ! -type s -exec sha256sum -- {} + >>"$t~" &&
sort -k2 <"$t~" >>"$t" && awk -v D="$D" -v h="$h" -F' ' "$program" <"$t"; x=$?
! [ -d "$t" ] || rm -r "$t" && [ $x = 0 ] || die $x 'exiting after failure'