Hello 'dpkg' users,

Same problem here, because my Debian system has been going (upgraded
regularly) since the late '90s.  It turns out 'sed' can fix this, the
code is nigh unreadable but it works.

Anyway, from the command prompt (copy & paste should work):

        # the problem file
        I=/var/lib/dpkg/status

        # temp file to revise $I
        O=/tmp/status

        # get the most common Arch line (highest count) in status file
        A="`sed -n '/Architecture:/p' $I | \
            sort | uniq -c | sort -g | \
            sed -n '$s/^.*\(Arch.*\)/\1/p'`"

        # Learn to juggle with 'sed'.
        #       How it works: Package descriptions are separated by blank lines.
        #       Load the 'hold' buffer with consecutive lines, until there's a 
blank.
        #       If there's no Arch line, then look for a Maint, and put Arch 
after that.
        #       Empty 'hold' buffer and repeat several thousand times.
        sed -n 
'1{h;b};H;/./b;g;/\nArchitecture:/!{g;s/\(Maintainer:[^\n]*\n\)/\1'"$A"'\n/};p;n;h'
 $I > $O

        # verify the changes are good.
        diff -c $I $O | less

        # back up $I, just in case...
        bzip2 -9 < $I > ~/status_dpkg.bak.bz2

        # If the 'diff' looks OK, copy it over.  (as root)
        cp $O $I

HTH...



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to