[pacman-dev] [PATCH] pacdiff - merge just the newest .pacsave
Jonathan Frazier
eyeswide at gmail.com
Mon Jul 1 03:26:41 EDT 2013
Merge just the newest .pacsave, warn about any .pacsave.N files at the end
Signed-off-by: Jonathan Frazier <eyeswide at gmail.com>
---
contrib/pacdiff.sh.in | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
index ee80c9c..a24a7c9 100644
--- a/contrib/pacdiff.sh.in
+++ b/contrib/pacdiff.sh.in
@@ -107,12 +107,21 @@ cmd() {
fi
}
+declare -a oldsaves
+
# see http://mywiki.wooledge.org/BashFAQ/020
while IFS= read -u 3 -r -d '' pacfile; do
file="${pacfile%.pac*}"
file_type="pac${pacfile##*.pac}"
+ # add matches for pacsave.N to oldsaves array, do not prompt
+ if [ "${file_type%%[[:digit:]]*}" == "pacsave." ]; then
+ oldsaves+=("$pacfile")
+ continue
+ fi
+
msg "%s file found for %s" "$file_type" "$file"
+
if [ ! -f "$file" ]; then
warning "$file does not exist"
rm -iv "$pacfile"
@@ -139,6 +148,8 @@ while IFS= read -u 3 -r -d '' pacfile; do
fi
done 3< <(cmd)
+(( ${#oldsaves[@]} > 0 )) && warning "Ignoring %s" "${oldsaves[@]}"
+
exit 0
# vim: set ts=2 sw=2 noet:
--
1.8.3.1
More information about the pacman-dev
mailing list