about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-02-11 17:54:09 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2016-02-11 17:54:09 +0100
commitbef15594968f4899db673a73e89f29b5f3482714 (patch)
tree73da17991a5621fdcf7a6758fadb4268a4057a20
parentdf18374ab6c64ccf6eeeb361238c5f08935076fa (diff)
downloadxtools-bef15594968f4899db673a73e89f29b5f3482714.tar.gz
xtools-bef15594968f4899db673a73e89f29b5f3482714.tar.xz
xtools-bef15594968f4899db673a73e89f29b5f3482714.zip
add xetcchanges
-rw-r--r--README1
-rwxr-xr-xxetcchanges15
2 files changed, 16 insertions, 0 deletions
diff --git a/README b/README
index 89925d4..2cf328a 100644
--- a/README
+++ b/README
@@ -12,6 +12,7 @@ https://github.com/voidlinux/xbps
   xdiff [-u|-l] [DIR] - merge/diff/list XBPS .new-* files
   xdistdir - figure out XBPS_DISTDIR
   xdowngrade PKGS.xbps... - install XBPS package directly from .xbps file
+  xetcchanges - show diff of /etc against binary packages
   xgensum [-f] [-i] TEMPLATE - update SHA256 sums in templates
   xgrep PATTERN PKGS... - search files limited to XBPS package contents
   xhog - list installed XBPS packages ordered by size
diff --git a/xetcchanges b/xetcchanges
new file mode 100755
index 0000000..f3e4935
--- /dev/null
+++ b/xetcchanges
@@ -0,0 +1,15 @@
+#!/bin/sh
+# xetcchanges - show diff of /etc against binary packages
+
+xbps-query -o '/etc/*' |
+	awk 'function q(a) { gsub("\\47", "\47\\\47\47", a); return "\47"a"\47" }
+	{
+		sub(" \\([^)]*\\)$", "")
+		sub(" -> .*$", "")
+		i = index($0, ": ")
+		pkg = substr($0, 1, i-1)
+		file = substr($0, i+2)
+		system("[ -f " q(file) " ] && " \
+                       " xbps-query --cat=" q(file) " " q(pkg) \
+ 		       " | diff -u --label " q(pkg file) " - " q(file))
+	}'