ServDoc_installed_sw - Which software is installed on your system ?
$Id: ServDoc_0150installed_sw,v 1.9 2003/10/08 15:23:02 uherbst Exp $
ServDoc_installed_sw [-h|help] [-v|version] [--debug SW,intensity]
ServDoc_installed_sw lists all the software you installed with your systems standard package manager.
The debug feature for that module is named ``SW''.
Ulrich Herbst <Ulrich.Herbst@gmx.de>
#!/usr/bin/perl -w
#---------------------------------------------------------------------- # standard perl modules use strict; # print error about unknown variables ... use English; # long internal variable names; use FindBin; # In which directory is ServDoc itself ? # There has to be the module and the lib dir! use lib $FindBin::Bin. "/lib"; # Here are the ServDoc-perl-modules use vars qw($options); # our own perl modules use ServDoc; #---------------------------------------------------------------------- $options->{Version} = '$Id: ServDoc_0150installed_sw,v 1.9 2003/10/08 15:23:02 uherbst Exp $'; # We need the cmdline to call the modules with the same debug options. $options->{cmdline} = join " ", @ARGV; sub debug { ServDoc_debug( "SW", $options, shift, shift ); } $options = &process_cmdline($options); my $h='Unix%%+Software%%+'; %{$options->{lang}->{en}}= ( rpm => $h . 'Software installed with rpm', rpm_short => i18n_std('cmdout','rpm -qa'), rpm_long => '', dpkg => $h . 'Software installed with dpkg', dpkg_short => i18n_std('cmdout','dpkg -l'), dpkg_long => '', lslpp => $h . 'Software installed with lslpp', lslpp_short => i18n_std('cmdout','lslpp -L all'), lslpp_long => '', swlist => $h . 'Software installed with swlist', swlist_short => i18n_std('cmdout','swlist'), swlist_long => '', pkginfo => $h . 'Software installed with pkginfo', pkginfo_short => i18n_std('cmdout','pkginfo'), pkginfo_long => '', fink => $h . 'Version of fink installed', fink_short => i18n_std('cmdout','/sw/bin/fink --version'), fink_long => '', ); %{$options->{lang}->{de}}= ( rpm => $h . 'Software installiert mit rpm', rpm_short => i18n_std('cmdout','rpm -qa'), rpm_long => '', dpkg => $h . 'Software installiert mit dpkg', dpkg_short => i18n_std('cmdout','dpkg -l'), dpkg_long => '', lslpp => $h . 'Software installiert mit lslpp', lslpp_short => i18n_std('cmdout','lslpp -L all'), lslpp_long => '', swlist => $h . 'Software installiert mit swlist', swlist_short => i18n_std('cmdout','swlist'), swlist_long => '', pkginfo => $h . 'Software installiert mit pkginfo', pkginfo_short => i18n_std('cmdout','pkginfo'), pkginfo_long => '', fink => $h . 'Installierte Fink-Version', fink_short => i18n_std('cmdout','/sw/bin/fink --version'), fink_long => '', ); debug( 9, i18n_std('running',$0)); #---------------------------------------------------------------------- # Main # Here is your useful code. if ( $OSNAME =~ /linux/ ) { if ( -e "/etc/redhat-release" or -e "/etc/SuSE-release" or -e "/etc/mandrake-release") { my $rpm=do_cmd("rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}!!" . "%{SUMMARY}!!------------\\n'" ); # sort and transform !! -> \n $rpm = join "\n", sort {lc($a) cmp lc($b)} split /\n/,$rpm; $rpm =~ s/!!/\n/g; report_i18n('string','rpm',$rpm); } elsif ( -e "/etc/debian_version" ) { report_i18n('cmd','dpkg','dpkg -l'); } else { debug( 1, i18n_std('unsupported','Linux software installation')); } } elsif ( $OSNAME =~ /aix/ ) { report_i18n('cmd','lslpp','lslpp -L all'); my $rpmout=`type rpm 2>&1`; if ($rpmout =~ /\// ) { my $rpm=do_cmd("rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}!!" . "%{SUMMARY}!!------------\\n'" ); # sort and transform !! -> \n $rpm = join "\n", sort {lc($a) cmp lc($b)} split /\n/,$rpm; $rpm =~ s/!!/\n/g; report_i18n('string','rpm',$rpm); } # rpm installed ? } elsif ( $OSNAME =~ /hpux/ ) { report_i18n('cmd','swlist','swlist'); } elsif ( $OSNAME =~ /solaris/ ) { report_i18n('cmd','pkginfo','pkginfo'); } elsif ($OSNAME =~ /darwin/) { # check for fink # if (-e '/sw/etc/fink.conf') { report_i18n('cmd','fink','/sw/bin/fink --version'); report_i18n('cmd','dpkg','dpkg -l'); } } else { debug( 1, i18n_std('unsupported','software installation')); } exit 0;