# TLroot.def: Performs Data Collection as root User # $Id: TLroot.def,v 1.15 2012/04/25 07:03:57 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/TLroot.def,v 1.15 2012/04/25 07:03:57 mschenke Exp $ # # Change History # 20120423 MSC Improve the credential management. =head1 NAME TLroot - Performs Data Collection as C User =head1 DESCRIPTION This tool performs data collection as C user. It changes the owner of the generated reports to the owner of report directory. If you execute this tool before any RDA collection, the report directory will belong to the C user and you will have to modify that ownership before using it for making RDA collections as another user. =head1 USAGE -vdT root By defaut, it collects data from all applicable modules. It is possible to limit the data collection to a subset of the configured modules. However, it always collect the C and C modules. For example, -vdT root:OS,NET You can enable the trace selectively. For example, -vdT root:T:OS,NET It will enable code and variable tracing for the OS module only. You can obtain the list of applicable modules with the following command: -L root =cut use Mrc echo tput('bold'),'Processing TLroot tool ...',tput('off') # Verify prerequisites if !getSetting('FORCE_ROOT') {if !isUnix() die S,'This tool can be run only on UNIX.' if !match(id(),'^uid=0\(') die S,'This tool can be run only as root user.' } # Initialisation var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' # Purge all reports and create the report index call setAbbr('ROOT') call purge('C','.',0,0,true) call enableIndex(true) # Get applicable modules var %col loop $mod (getCollections()) {if ?getSetting(concat($mod,'_MRC')) var $col{$mod} = 1 } # Determine the modules to treat var $dft = setTrace() var $min = 2 var %mod = (S999END => $dft) var %trc = ('',$dft,'t:',1,'T:',2) if getSetting('TST_ARGS') {var @mod = split(',',last) call getLists(1) loop $mod (@mod) {var ($trc,$mod) = match($mod,'^([tT]:)?(.*)$') var $nam = nvl(getModule($mod),$mod) if exists($col{$nam}) var ($min,$mod{$nam}) = (1,$trc{nvl($trc,'')}) else echo "\011No root collection applicable for ",$mod } var @mod = keys(%mod) } else var @mod = keys(%col) if expr('<',scalar(@mod),$min) die S,"\012No collection required" # Perform the collection debug loop $mod (@mod) {debug 'Processing module ',$mod,' ...' var $trc = setTrace(nvl($mod{$mod},$trc{''})) if beginCollect($mod) echo "\011Base collection missing for ",$mod else {var $abr = substr($mod,4) loop $def (getMembers($abr,getSetting(concat($abr,'_MRC_GROUPS')),true)) {if match($def,'\-') run &{$def}() else collect &{$def}() } call endCollect() } call setTrace($trc) } # Warn when the report directory belongs to root if expr('==',${CUR.OWNER},'0') echo 'The owner of the report directory is root. Modify the owner of the \ directory when you will use it for RDA collections with another user.' else {if isVerbose() echo "\011Generating the index ..." call renderIndex() } # Force setup save call setSetting('FORCE_SAVE',1) =begin credits =over 10 =item RDA 4.19: Jaime Alcoreza. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, 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