You are not logged in.

#1 2018-10-21 21:20:27

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Utility to track customized confs

Unless I'm missing something, pacman can't do this (just yet). Is there any external utility which compares the hashes/contents of conf files to see if they've changed from the defaults?

Conceptually, something which diffs current files (maybe just in /etc or similar directories) with the contents in the appropriate pacman cache. This would effectively be a list of changes you've made to the system. This could then be backed up and, together with the output of paclist, be used to totally restore the system without having to do a full backup. Or it could be used to figure out what changes I've made historically (which I may or may not remember anymore), for example having added a quick hack to an xorg.conf which causes an issue 2 years later.

Compared to something like etckeeper, this would be more useful, since that tracks all changes and hence has a low SNR (changes due to package upgrades probably outnumber to quite a degree individual changes, especially in a long-running system).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#2 2018-10-21 21:33:52

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,858
Website

Re: Utility to track customized confs

Pacman's mtree files can be used to find any files that have been "modified", which can be permissions, filesize, or modification times vs. the packaged files.

e.g.

# pacman -Qqkk

You'll get a lot of false positives with pyc files and the like, but if you're only looking for modified config files, you can probably just grep the results for "/etc".

EDIT: oops, seems this will miss the most important files. See below.

Last edited by WorMzy (2018-10-22 07:51:36)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2018-10-21 22:12:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: Utility to track customized confs

Here's a start - but it's slow as hell:

#!/bin/sh

pacman -Qkkq | while read pkg file; do
	tarball=/var/cache/pacman/pkg/$(pacman -Q $pkg | sed 's/ /-/')-x86_64.pkg.tar.xz
	if [ ! -f $tarball ]; then
		printf '%s is not available in the cache\n' $pkg
		continue
	fi
	file $file | if grep -q text; then
		echo $pkg ": " $file
		tar xf $tarball -O ${file#/} | diff $file -
		exit
	else
		printf '%s is not a text file\n' $file
	fi
done

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2018-10-21 23:46:55

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Utility to track customized confs

WorMzy and Trilby are both wrong, because pacman -Qkkq will also silence the warnings for "backup file:", and I believe backup files are the one thing that is actually wanted here.

paccheck --files --sha256sum --quiet --backup

Comparing them to the version in the repository *.pkg.tar.xz can be done in a separate pass, once you know which files are actually changed.

Last edited by eschwartz (2018-10-21 23:52:28)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2018-10-22 00:09:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: Utility to track customized confs

My script was really just for the latter half of that anyways.  Switch the pacman -Qkkq with paccheck there (then you can ditch the check for whether or not it's a text file.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2018-10-22 08:01:24

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Utility to track customized confs

Thanks to all 3 of you (I only got email notification of WorMzy's message and I tried it out immediately before coming here, then realised that definitely a LOT of my edited files weren't showing up. Of course, they'd mostly be in the Backup list. I think I can work something out based on paccheck. The underlying answer though seems to be that no single utility exists for this sort of purpose though, which surprises me.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB