aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-01-10 02:13:54 -0800
committerGravatar Tom Willemse2019-01-10 02:13:54 -0800
commit7e7597ab990060cffda486eae04aad16f822f033 (patch)
tree17127a007ab9df135b69241a5d4324d1e222871a /util
parent6521d4ac9e6d45883d0e458b051b9bb1f43896a4 (diff)
downloadnew-dotfiles-7e7597ab990060cffda486eae04aad16f822f033.tar.gz
new-dotfiles-7e7597ab990060cffda486eae04aad16f822f033.zip
Add merge-pacnews utility
Diffstat (limited to 'util')
-rwxr-xr-xutil/usr/bin/merge-pacnews21
1 files changed, 21 insertions, 0 deletions
diff --git a/util/usr/bin/merge-pacnews b/util/usr/bin/merge-pacnews
new file mode 100755
index 0000000..d9f0e85
--- /dev/null
+++ b/util/usr/bin/merge-pacnews
@@ -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