[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Here's a script to help reinstall all packages



Somebody mentioned recently that they'd like a way for dselect to 
reinstall all installed packages. Their reason may have been because of a
bad disk that corrupted some unknown number of files (caused by bios LBA
and 32-bit access, I remember now?).

I trashed my setup trying to get g++ to work by installing some packages
from the unstable tree.

As the last stage of repair I wrote this little Tcl script to generate a
list of dpkg commands. The output looks like this:

dpkg -i /usr/local/src/debian/1.3.1-fixed/binary-i386/base/adduser_3.2.deb
dpkg -i /usr/local/src/debian/1.3.1-fixed/binary-i386/base/ae_962-14.deb
dpkg -i
/usr/local/src/debian/1.3.1-fixed/binary-i386/libs/aout-svgalib_1.2.10-4.deb
dpkg -i /usr/local/src/debian/1.3.1-fixed/binary-i386/admin/at_3.1.7-3.deb

...etc...

I plan to execute these manually, one at a time.

Here is the Tcl program. It outputs to stdout so just redirect the output
to a file. 

--- snip ---
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

set plist [split [exec dpkg --get-selections] \n]

foreach l $plist {
    set p [string trim [lindex $l 0]]
    set s [string trim [lindex $l 1]]
    if {$s == "install"} {
        set d [exec debfind /${p}_ | grep -v /unstable/]
        if {[llength $d] == 1} {
            puts "dpkg -i $d"
        } {
            puts "Found multiple matches for $p: $d"
        }
    } {
        puts "Skipping $p: $s"
    }
}
--- snip ---

...RickM...


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: