Help with scripting APT / dpkg in Debian 4


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with scripting APT / dpkg in Debian 4
# 1  
Old 10-20-2008
Help with scripting APT / dpkg in Debian 4

Hello,

I am attempting to write a (bash) shell script that will do some basic reporting based on the APT utilities and dpkg.

I need the following in the report:
Packages installed
(COLUMNS=200 dpkg -l | grep '/^ii/' > packages_installed)

Packages not installed

I suppose that I can do
COLUMNS=200 dpkg -l > packages_available
and then use cmp or diff to print a list of the differences which should just be the packages not installed

Packages with security updates
I'm drawing a blank on this one, maybe restricting sources to
deb Debian -- Security Information stable/updates main
and printing the output

Packages with updates
I think it's just
apt-get -u upgrade > packages_updates

Packages with new versions (including the distro)
apt-cache show?

The script should then print out in a legible form the different categories from the files created. I realize that there are some GUI's out there that do basically the same thing but this will run on servers. Ideally it should be dependent on the "standard" apt utilities.

Thanks for any input!
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Ubuntu

Problem creating Desktop shortcuts through Debian dpkg installer scripts

Hi, I am creating a debian package (*.deb) for my application using the command I am using debian pre/post installer scripts to do certain tasks before/after installation/uninstallation. One such task is to create a shortcut on the user's desktop to launch my application. I am trying to do this... (0 Replies)
Discussion started by: royalibrahim
0 Replies

2. Linux

GPG error on Debian 4 using apt-get

Hello, I wish to update a debian 4.0 server we have but cannot get past the following error message. my keys are as follows: Any help would be good. (0 Replies)
Discussion started by: pobman
0 Replies

3. UNIX for Advanced & Expert Users

Debian aptitude - apt-get problem

I've got a strange one. As root, in aptitude, I'll do an update successfully. Then I do an upgrade, the files download, the progress bar will not show total progress, just progress per file, then reset to 0% for the next file. When the files complete downloading, I hit a carrige return to go to... (1 Reply)
Discussion started by: mikek147
1 Replies
Login or Register to Ask a Question
dpkg-scanpackages(1)						  dpkg utilities					      dpkg-scanpackages(1)

NAME
dpkg-scanpackages - create Packages index files SYNOPSIS
dpkg-scanpackages [options] binary-dir [override-file [path-prefix]] > Packages DESCRIPTION
dpkg-scanpackages sorts through a tree of Debian binary packages and creates a Packages file, used by apt(8), dselect(1), etc, to tell the user what packages are available for installation. These Packages files are the same as those found on Debian archive sites and CD-ROMs. You might use dpkg-scanpackages yourself if making a directory of local packages to install on a cluster of machines. Note: If you want to access the generated Packages file with apt you will probably need to compress the file with bzip2(1) (generating a Packages.bz2 file) or gzip(1) (generating a Packages.gz file). apt ignores uncompressed Packages files except on local access (i.e. file:// sources). binarydir is the name of the tree of the binary packages to process (for example, contrib/binary-i386). It is best to make this relative to the root of the Debian archive, because every Filename field in the new Packages file will start with this string. overridefile is the name of a file to read which contains information about how the package fits into the distribution (it can be a com- pressed file); see deb-override(5). pathprefix is an optional string to be prepended to the Filename fields. If more than one version of a package is found only the newest one is included in the output. If they have the same version and only differ in architecture only the first one found is used. OPTIONS
-t, --type type Scan for *.type packages, instead of *.deb. -u, --udeb Obsolete alias for -tudeb. -e, --extra-override file Scan file to find supplementary overrides (the file can be compressed). See deb-extra-override(5) for more information on its for- mat. -a, --arch arch Use a pattern consisting of *_all.deb and *_arch.deb instead of scanning for all debs. -m, --multiversion Include all found packages in the output. -M, --medium id-string Add an X-Medium field containing the value id-string. This field is required if you want to generate Packages.cd files for use by the multicd access method of dselect. -h, --help Show the usage message and exit. --version Show the version and exit. DIAGNOSTICS
dpkg-scanpackages outputs the usual self-explanatory errors. It also warns about packages that are in the wrong subdirectory, are dupli- cated, have a Filename field in their control file, are missing from the override file, or have maintainer substitutions which do not take effect. SEE ALSO
dpkg(1), dselect(1), deb-override(5), deb-extra-override(5), dpkg-scansources(1). Debian Project 2009-10-01 dpkg-scanpackages(1)