blob: b388c76cf0a52a087619a8dd826e07d2955b494a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
# xdiff [-u|-l] [DIR] - merge/diff/list XBPS .new-* files
mergeutil() {
vim -d "$1" "$2" && rm -vi "$1"
}
listutil() {
printf '%s\n' "$1"
}
if [ "$1" = -u ]; then
shift
DIFF="diff -u"
elif [ "$1" = -l ]; then
shift
DIFF=listutil
else
DIFF=mergeutil
fi
DIR=${1:-/etc}
if ! [ -d "$DIR" ] ; then
echo "$DIR is not a valid directory" >&2
exit 1
fi
for newfile in $(find "$DIR" -name '*.new-*_*' | sort -V); do
$DIFF "$newfile" "${newfile%.new-*_*}"
done
|