Add merge-pacnews utility
This commit is contained in:
parent
6521d4ac9e
commit
7e7597ab99
1 changed files with 21 additions and 0 deletions
21
util/usr/bin/merge-pacnews
Executable file
21
util/usr/bin/merge-pacnews
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
files=$(find /etc -type f -name '*.pacnew')
|
||||||
|
|
||||||
|
for pacnew in $files
|
||||||
|
do
|
||||||
|
unprefixed=${pacnew%.pacnew}
|
||||||
|
|
||||||
|
if [[ ! -e "$unprefixed" ]]; then continue; fi
|
||||||
|
|
||||||
|
emacs -eval "(emerge-files nil \"$unprefixed\" \"$pacnew\" \"$unprefixed\")"
|
||||||
|
|
||||||
|
otime=$(stat -c %Y "$unprefixed")
|
||||||
|
ntime=$(stat -c %Y "$pacnew")
|
||||||
|
|
||||||
|
if [[ "$otime" -gt "$ntime" ]]; then
|
||||||
|
rm -v "$pacnew"
|
||||||
|
else
|
||||||
|
echo "Skipping removal of $pacnew"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in a new issue