Update script

Basically a complete rewrite. This now is able to parse git installed
imag version strings and behave accordingly.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2018-10-12 17:44:57 +02:00
parent 4beeef080b
commit 05d43128ce

View file

@ -2,11 +2,22 @@
# Find all imag commands which changed since last install # Find all imag commands which changed since last install
imag versions |\ imag versions 2>&1 | \
grep "imag-" | \ grep "imag-" | \
sed 's,v.*-g,,' |\ sed 's,\ *->.*\ , ,' | \
while read binary hash; do while read binary hash; do
git diff "$hash..master" --name-only | \ if [[ "$hash" =~ v.*\..*\..*- ]]; then
hash="$(echo "$hash" | sed 's,.*-g,,')"
fi
log="$(git diff --name-only ${hash}..master 2>/dev/null)"
if [[ $? -eq 0 ]]; then
echo "$log" | \
grep "$binary" >/dev/null 2>/dev/null && \ grep "$binary" >/dev/null 2>/dev/null && \
echo "$binary changed since last install (was $hash)" echo -e "changed since last install ($hash): $binary"
else
echo "WARN: Could not check $binary because git hash '$hash' is not present"
fi
done done