pacdiff: Search and give warnings for older pacsave.[0-9]* files
Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
6e3ea82f9b
commit
c4d8da4727
1 changed files with 11 additions and 2 deletions
|
@ -25,6 +25,7 @@ diffprog=${DIFFPROG:-vimdiff}
|
||||||
diffsearchpath=${DIFFSEARCHPATH:-/etc}
|
diffsearchpath=${DIFFSEARCHPATH:-/etc}
|
||||||
locate=0
|
locate=0
|
||||||
USE_COLOR='y'
|
USE_COLOR='y'
|
||||||
|
declare -a oldsaves
|
||||||
|
|
||||||
m4_include(../scripts/library/output_format.sh)
|
m4_include(../scripts/library/output_format.sh)
|
||||||
|
|
||||||
|
@ -47,9 +48,9 @@ version() {
|
||||||
|
|
||||||
cmd() {
|
cmd() {
|
||||||
if [ $locate -eq 1 ]; then
|
if [ $locate -eq 1 ]; then
|
||||||
locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave
|
locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave '*.pacsave.[0-9]*'
|
||||||
else
|
else
|
||||||
find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave \) -print0
|
find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave -o -name '*.pacsave.[0-9]*' \) -print0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +72,12 @@ while IFS= read -u 3 -r -d '' pacfile; do
|
||||||
file="${pacfile%.pac*}"
|
file="${pacfile%.pac*}"
|
||||||
file_type="pac${pacfile##*.pac}"
|
file_type="pac${pacfile##*.pac}"
|
||||||
|
|
||||||
|
# add matches for pacsave.N to oldsaves array, do not prompt
|
||||||
|
if [[ $file_type = pacsave.+([0-9]) ]]; then
|
||||||
|
oldsaves+=("$pacfile")
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
msg "%s file found for %s" "$file_type" "$file"
|
msg "%s file found for %s" "$file_type" "$file"
|
||||||
if [ ! -f "$file" ]; then
|
if [ ! -f "$file" ]; then
|
||||||
warning "$file does not exist"
|
warning "$file does not exist"
|
||||||
|
@ -98,6 +105,8 @@ while IFS= read -u 3 -r -d '' pacfile; do
|
||||||
fi
|
fi
|
||||||
done 3< <(cmd)
|
done 3< <(cmd)
|
||||||
|
|
||||||
|
(( ${#oldsaves[@]} )) && warning "Ignoring %s" "${oldsaves[@]}"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 noet:
|
# vim: set ts=2 sw=2 noet:
|
||||||
|
|
Loading…
Add table
Reference in a new issue