Talk:Pacman/Tips and tricks

From ArchWiki
< Talk:Pacman
Revision as of 03:55, 8 October 2013 by Gdiscry (Talk | contribs) (Listing changed configuration files: new section)

Jump to: navigation, search

Listing changed configuration files

Regarding the shell script to manually list the configuration files that have changed, I wrote the following script instead that only uses awk to process the /var/lib/pacman/local/*/files:

changed-files.sh
#!/bin/sh
cat /var/lib/pacman/local/*/files | awk '
    /^$/ { backups = 0 }
    {
        if (backups) {
            $1 = "/"$1
            if ($2 == "(null)") {
                if (! system("test -e "$1)) {
                    print "d41d8cd98f00b204e9800998ecf8427e "$1
                }
            } else {
                print $2" "$1
            }
        }
    }
    /^%BACKUP%$/ { backups = 1 }
' | md5sum -c --quiet

It supports empty/non-existent files that have (null) instead of a hash but does not list to which package owns a file. --Gdiscry (talk) 03:55, 8 October 2013 (UTC)