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::Control(3)						   libdpkg-perl 						  Dpkg::Control(3)

NAME
Dpkg::Control - parse and manipulate official control-like information DESCRIPTION
The Dpkg::Control object is a smart version of Dpkg::Control::Hash. It associates a type to the control information. That type can be used to know what fields are allowed and in what order they must be output. The types are constants that are exported by default. Here's the full list: CTRL_UNKNOWN This type is the default type, it indicates that the type of control information is not yet known. CTRL_INFO_SRC Corresponds to the first block of information in a debian/control file in a Debian source package. CTRL_INFO_PKG Corresponds to subsequent blocks of information in a debian/control file in a Debian source package. CTRL_INDEX_SRC Corresponds to an entry in a Sources file of an APT source package repository. CTRL_INDEX_PKG Corresponds to an entry in a Packages file of an APT binary package repository. CTRL_PKG_SRC Corresponds to a .dsc file of a Debian source package. CTRL_PKG_DEB Corresponds to the control file generated by dpkg-gencontrol (DEBIAN/control) and to the same file inside .deb packages. CTRL_FILE_CHANGES Corresponds to a .changes file. CTRL_FILE_VENDOR Corresponds to a vendor file in /etc/dpkg/origins/. CTRL_FILE_STATUS Corresponds to an entry in dpkg's status file (/var/lib/dpkg/status). CTRL_CHANGELOG Corresponds to the output of dpkg-parsechangelog. FUNCTIONS
All the methods of Dpkg::Control::Hash are available. Those listed below are either new or overridden with a different behaviour. my $c = Dpkg::Control->new(%opts) If the "type" option is given, it's used to setup default values for other options. See set_options() for more details. $c->set_options(%opts) Changes the value of one or more options. If the "type" option is changed, it is used first to define default values for others options. The option "allow_pgp" is set to 1 for CTRL_PKG_SRC and CTRL_FILE_CHANGES and to 0 otherwise. The option "drop_empty" is set to 0 for CTRL_INFO_PKG and CTRL_INFO_SRC and to 1 otherwise. The option "name" is set to a textual description of the type of control information. The output order is also set to match the ordered list returned by Dpkg::Control::Fields::field_ordered_list($type). $c->get_type() Returns the type of control information stored. See the type parameter set during new(). AUTHOR
Raphael Hertzog <hertzog@debian.org>. 1.16.0.3 2012-04-17 Dpkg::Control(3)