Difference between revisions of "Talk:Pacman/Tips and tricks"

From ArchWiki
Jump to: navigation, search
(Merge: rm old discussion)
(Listing changed configuration files: new section)
Line 1: Line 1:
 +
==  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 {{ic|/var/lib/pacman/local/*/files}}:
 +
{{hc|changed-files.sh|<nowiki>
 +
#!/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
 +
</nowiki>}}
 +
 +
It supports empty/non-existent files that have {{ic|(null)}} instead of a hash but does not list to which package owns a file. --[[User:Gdiscry|Gdiscry]] ([[User talk:Gdiscry|talk]]) 03:55, 8 October 2013 (UTC)

Revision as of 03:55, 8 October 2013

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)