# MCpkg.ctl:207: Collects Installed Software Packages Information # $Id: MCpkg.ctl,v 1.13 2015/09/21 14:04:01 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCpkg.ctl,v 1.13 2015/09/21 14:04:01 RDA Exp $ # # Change History # 20150916 JGS Extend publisher collection information. =head1 NAME EXPLORER:MCpkg - Collects Installed Software Packages Information =head1 DESCRIPTION This module collects information on software packages installed on the server. =cut use Mrc # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' run EXPLORER:XPLRlib('pkg') #------------------------------------------------------------------------------ # XPLR_pkg section #------------------------------------------------------------------------------ section XPLR_pkg call log_run('Processing PKG sections ...') pretoc '2:Installed Packages' # Define the summary descriptors var %DSC = (\ I => "Fully Installed pkgs\012\ ====================\012",\ L => "Long pkg Listing\012\ ================\012",\ P => "Partially Installed pkgs\012\ ========================\012",\ U => "Listing of pkg Publishers\012\ =========================\012") # Validate the action count var $COUNT = ${MOD.PKG.N_HISTORY:'25'} =head2 Overview Gathers the information about Solaris software packages installed on the server using the following commands: =over 2 =item o C =item o C =item o C =item o C (global zone) =item o C =item o C =item o C =item o C =item o C =item o C =item o C (global zone) =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back Also gathers information about Solaris ZFS Boot Environments using the following commands: =over 2 =item o C =item o C =back Gathers the information about Linux software packages installed on the server using the following commands: =over 2 =item o by using C =back =cut loop $zon (get_zones(true)) {if $loc = defined($nam = $zon->[0]) {var ($ttl,$pre,$exe) = (concat('From Zone ',$nam),\ concat('zones/',$nam),\ concat('/usr/sbin/zlogin ',$nam)) call log_info(concat('pkg: RUNNING: zone ',$nam),\ concat(' Inside PKG collection, collecting from zone ',$nam,\ ' (can take time)')) } else var ($ttl,$pre,$exe) = ('From Global Zone') var $top = $zon->[1] report concat('pkg_z_',nvl($nam,'global')) title '---+!! ',$ttl title $TOC if ${OS.solaris} {# Collect Solaris SVR4-related information debug ' Inside PKG collection, collecting SVR4 package information' call do_exec({cmd => 'TITLE',txt => '---+ SVR4 Package Information'}) if ?testDir('d',catDir($top,'var','sadm','pkg')) call do_remote($pre,$exe,$top,\ ['patch+pkg/pkg_listing',\ ${CMD.LS:'ls'},'-almtr /var/sadm/pkg',\ '---++ Contents of /var/sadm/pkg Directory',\ {out=>{ext=>'',nat=>true}}]) if ?testFile('x',catFile($top,'usr','bin','pkginfo')) call do_remote($pre,$exe,$top,\ {cmd => 'COMMENT',\ nam=>'patch+pkg/pkginfo-i.out',\ txt => $DSC{'I'}},\ ['patch+pkg/pkginfo-i',\ '/usr/bin/pkginfo','-i',\ '---++ Fully Installed Packages',\ {out=>{cat=>'T',nat=>true}}],\ {cmd => 'COMMENT',\ nam=>'patch+pkg/pkginfo-l.out',\ txt => $DSC{'L'}},\ ['patch+pkg/pkginfo-l',\ '/usr/bin/pkginfo','-l',\ '---++ Long Packages Listing',\ {out=>{cat=>'T',nat=>true}}],\ {cmd => 'COMMENT',\ nam=>'patch+pkg/pkginfo-p.out',\ txt => $DSC{'P'}},\ ['patch+pkg/pkginfo-p',\ '/usr/bin/pkginfo','-p',\ '---++ Partially Installed Packages',\ {out=>{cat=>'T',nat=>true}}]) if and(not($loc),has_zones(),${B_LOCAL:1}) {debug ' Inside PKG collection, collecting generic zone package information',\ ' (can take time)' prefix {write '---++ Zone-Related Package Information' write '---## Using: /usr/bin/pkgparam -v $PACKAGE | grep "SUNW_PKG"' } loop $pkg (grepCommand('/usr/bin/pkginfo','^\S+\s+(\S+)','1')) {loop $par (grepCommand(concat('/usr/bin/pkgparam -v ',$pkg),'^SUNW_PKG')) {write $pkg,':',$par,'%BR%' call addBlock('E','T','patch+pkg/pkg_zoneinfo.out') call writeComment(chomp(concat($pkg,':',$par))) } } if hasOutput(true) write $TOP } call do_exec({cmd => 'UNTITLE'}) # Collect Solaris IPS-related information if ?testFile('x',catFile($top,'usr','bin','pkg')) {debug ' Inside PKG collection, collecting IPS package information' call do_remote($pre,$exe,$top,\ {cmd => 'TITLE',txt => '---+ IPS Package Information'},\ {cmd => 'COMMENT',\ nam=>'patch+pkg/pkg_info-l.out',\ txt => $DSC{'L'}},\ ['patch+pkg/pkg_avoid',\ '/usr/bin/pkg','avoid',\ '---++ Avoided Packages Information'],\ ['patch+pkg/pkg_info-l',\ '/usr/bin/pkg','info -l',\ '---++ Long Package Listing',\ {out=>{cat=>'T',nat=>true},req=>{inc=>3}}]) if !$loc call do_remote($pre,$exe,$top,\ ['patch+pkg/pkg_contents',\ '/usr/bin/pkg',\ 'contents -o path,action.name,mode,owner,group,pkg.size,pkg.name',\ '---++ Package Contents',\ {out=>{nat=>true},req=>{inc=>4}}],\ ['patch+pkg/pkg_list-af_entire',\ '/usr/bin/pkg','list -af entire',\ '---++ Package entire - All versions',\ {out=>{nat=>true}}]) call do_remote($pre,$exe,$top,\ ['patch+pkg/pkg_listing_ips',\ '/usr/bin/pkg','list',\ '---++ Package Listing',\ {out=>{ext=>'',nat=>true}}],\ {cmd => 'COMMENT',\ nam=>'patch+pkg/pkg_publisher.out',\ txt => $DSC{'U'}},\ ['patch+pkg/pkg_publisher',\ '/usr/bin/pkg','publisher',\ '---++ Package Publishers',\ {out=>{cat=>'T'}}],\ ['patch+pkg/pkg_publisher-F_tsv',\ '/usr/bin/pkg','publisher -F tsv',\ '---++ Package Publishers Extended Information'],\ ['patch+pkg/pkg_facet',\ '/usr/bin/pkg','facet',\ '---++ Package Facets'],\ ['patch+pkg/pkg_mediator',\ '/usr/bin/pkg','mediator',\ '---++ Package Mediators'],\ ['patch+pkg/pkg_freeze',\ '/usr/bin/pkg','freeze',\ '---++ Packages Frozen'],\ ['patch+pkg/pkg_property',\ '/usr/bin/pkg','property',\ '---++ Package Properties'],\ ['patch+pkg/pkg_history-l',\ '/usr/bin/pkg','history -l',\ '---++ Package History - Long listing',\ {out=>{nat=>true},req=>{inc=>2}}],\ ['patch+pkg/pkg_history',\ '/usr/bin/pkg',concat('history -n ',$COUNT),\ concat('---++ Package History - Last ',$COUNT,' Actions'),\ {out=>{nat=>true},req=>{inc=>3}}],\ {cmd => 'UNTITLE'}) } elsif and($loc,testDir('d',catDir($top,'var','pkg','pkg'))) {debug ' Inside PKG collection, collecting IPS package directory listing' call do_remote($pre,$exe,$top,\ {cmd => 'TITLE',txt => '---+ IPS Package Information'},\ ['patch+pkg/pkg_listing_ips',\ ${CMD.LS:'ls'},'-almtr /var/pkg/pkg',\ '---++ Package Directory Listing',\ true],\ {cmd => 'UNTITLE'}) } # Collect Solaris ZFS Boot Environments related information if ?testFile('x',catFile($top,'usr','sbin','beadm')) call do_remote($pre,$exe,$top,\ {cmd => 'TITLE',txt => '---+ ZFS Boot Environments Information'},\ ['patch+pkg/beadm_list',\ '/usr/sbin/beadm','list',\ '---++ Boot Environments'],\ ['patch+pkg/beadm_list_-a',\ '/usr/sbin/beadm','list -a',\ '---++ Boot Environments - All Information'],\ {cmd => 'UNTITLE'}) } elsif ${OS.linux} {# Collect Linux RPM information debug ' Inside PKG collection, collecting Linux RPM package listing' var $arg = '-qa --queryformat "|%{NAME}|%{VERSION}|%{RELEASE}|%{ARCH}|\n"' call do_remote($pre,$exe,$top,\ {cmd => 'TITLE',txt => '---+ Linux RPM Package Information'},\ ['patch+pkg/rpm_-qa.out',\ '/bin/rpm',$arg,\ '---++ RPM Package Listing'],\ {cmd => 'UNTITLE'}) } # Add the report to the table of content if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$ttl,']]' } # Adjust the table of content unpretoc =head2 Zones =for zone begin pkg Collects information about software packages installed on the server from the global zone. Unless local zone collections are disabled, collects information about software packages installed on the selected local zones using the following commands: =over 2 =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back and information about ZFS Boot Environments from the selected local zones using the following commands: =over 2 =item o C =item o C =back =for zone end =head1 SEE ALSO L, L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut