Tony Travis wrote:
Gordon wrote:
Ubuntu 9.04
Is there a way of producing a list of all applications and utilities
installed by me post-installation from the Ubuntu CD?

Hello, Gordon.

I've got a script that compares the packages installed on two different
machines, or between one machine and a list of packages. I create the
[...]

Hello, Gordon.

Sorry, I just noticed that the script I posted has comments and usage info relating to an older script I wrote called "dpkg-diff", which compares the output of "dpkg -l" more like Alan suggested. This level of detail is less useful in most circumstances, because you normally want to know what packages are installed regardless of their version. There are, of course, circumstances where you do want to compare versions and that's why I wrote "dpkg-diff".

Attached is a corrected version of my "dpkg-dsel" script, and my older "dpkg-diff" script that it is based on.

Bye,

  Tony.
--
Dr. A.J.Travis, University of Aberdeen, Rowett Institute of Nutrition
and Health, Greenburn Road, Bucksburn, Aberdeen AB21 9SB, Scotland, UK
tel +44(0)1224 712751, fax +44(0)1224 716687, http://www.rowett.ac.uk
mailto:a.tra...@abdn.ac.uk, http://bioinformatics.rri.sari.ac.uk/~ajt
#!/bin/sh
# @(#)dpkg-diff.sh  2008-01-31  A.J.Travis

#
# Show differences between installed packages on two hosts
#
if [ $# -ne 2 ]; then
        echo "usage: dpkg-diff host1 host2"
        exit 1
fi
if [ $1 = $2 ]; then
        echo "dpkg-diff: host names must be different"
        exit 2
fi

WORK=/tmp/$$
mkdir $WORK
WIDTH=140

if [ $1 = "localhost" ]; then
        COLUMNS=$WIDTH dpkg -l > $WORK/$1.pkg
else
        ssh $1 -- COLUMNS=$WIDTH dpkg -l > $WORK/$1.pkg
fi
if [ $2 = "localhost" ]; then
        COLUMNS=$WIDTH dpkg -l > $WORK/$2.pkg
else
        ssh $2 -- COLUMNS=$WIDTH dpkg -l > $WORK/$2.pkg
fi
diff $WORK/$1.pkg $WORK/$2.pkg
rm -r $WORK
#!/bin/sh
# @(#)dpkg-dsel.sh  2009-07-01  A.J.Travis

#
# Show differences between package selections on two hosts
#

if [ $1 = '-l' ]; then
        cd /usr/local/share/dpkg-dsel
        for i in *.sel; do
                basename $i .sel
        done
        exit 0
fi
        
if [ $# -ne 2 ]; then
        echo "usage: dpkg-dsel -l # list standard package selections"
        echo "       dpkg-dsel host1 host2"
        exit 1
fi
if [ $1 = $2 ]; then
        echo "dpkg-dsel: host names must be different"
        exit 2
fi

WORK=/tmp/$$
mkdir $WORK

# extract hostname from selection file name
host1=`basename $1 .sel`
host2=`basename $2 .sel`

# reference package selection lists
ref1=/usr/local/share/dpkg-dsel/${host1}.sel
ref2=/usr/local/share/dpkg-dsel/${host2}.sel

# absolute filename
if [ -r $1 ]; then
        cmd="cat $1"

# reference selection
elif [ -r $ref1 ]; then
        cmd="cat $ref1"

# local system
elif [ $host1 = "localhost" ]; then
        cmd="dpkg --get-selections"

# remote system
else
        cmd="ssh $host1 -- dpkg --get-selections"
fi

# save selection list for first host
$cmd | grep -v 'deinstall$' | sort -o $WORK/$host1.sel

# absolute filename
if [ -r $2 ]; then
        cmd="cat $2"

# reference selection
elif [ -r $ref2 ]; then
        cmd="cat $ref2"

# local system
elif [ $host2 = "localhost" ]; then
        cmd="dpkg --get-selections"

# remote system
else
        cmd="ssh $host2 -- dpkg --get-selections"
fi

# save selection list for second host
$cmd | grep -v 'deinstall$' | sort -o $WORK/$host2.sel

# generate host1 -> host2 install list
diff $WORK/$host1.sel $WORK/$host2.sel | \
        sed -n -e '/^</s/install$/deinstall/;s/< //p' -e '/^>/s/> //p'

# tidy up
rm -r $WORK
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/

Reply via email to