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 reference list immediately after installation using:

  dpkg --get-selections >distribution_name.sel

Then later run my script e.g.:

  dpkg-dsel localhost distribution_name.sel

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:[email protected], http://bioinformatics.rri.sari.ac.uk/~ajt
#!/bin/sh
# @(#)dpkg-diff.sh  2009-06-05  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-diff -l # list standard package selections"
        echo "       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

# 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
-- 
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/

Reply via email to