From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078618110506.tru64-unix-managers.marc@archive.invalid> From: "Neil R. Smith" Date: Thu, 16 Oct 1997 23:37:04 +0000 To: tru64-unix-managers Subject: SUMMARY: licensing based on installed sftwr X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078618110506 Original: > I have a csh script from DEC that installs *all* of the licenses > available through the campus-wide agreement (CSLG, etc.) using standard > lmf commands. Rather than run the thing at each machine and get *all* > licenses installed, I'd like to install licenses for just those products > that are installed on each machine. Is there a way to do that? If I > want to modify the DEC-supplied script for this purpose, would I query, > say, setld -i output (inventory)? -- I don't see a (character) match > between setld -i product ID# and PAK Product Names. > There appears to be no mapping available between installed software subset names, such as appears in `setld -i` ouput, and license Product Name, unless DEC will chime in here to correct me. One observation is that the DEC web site has a list of all CSLG DEC Software, listed by Product Name, with unique product identifier (UPI), SPD # and LMF/PAK Product Name (see http://www.digital.com/education/cslg/prod4.htm#unix). So you have to manually go through separate available lists and match them yourself. Now, as to working with the CSLG license install script from DEC, two respondents have developed their own scripts for this task. Since as of this writting I haven't tried either one, I cannot give any product evaluation except that I'm extremely gratefull that they are offered by the authors and each should start out with high marks for no other reason. I'll just include the relevant parts of their responses below, with their permission. But first, thanks to all resondents: alan@nabeth.cxo.dec.com Mike Iglesias "Randy M. Hayman" ============================ Randy Hayman haymanr@icefog.alaska.edu I've created a utility to do exactly what you wish. It is called break_out_paks.ksh and it is located in: ftp://raven.alaska.edu/pub/randy/license_utils/ Another utility which I wrote, which I run as a cron job weekly examines the license PAKS set to expire in the next 30 days and e-mails our systems support staff the output. It is called pak_list-1.0.tar.gz and it is located in the above directory also. ============================ Mike Iglesias Here's the programs, in a sh script. Just put this mail message into a file, strip off the junk at the begining and run it thru /bin/sh. splitpaks takes as input the csh script (for unix) or DCL .com file (for vms) and busts the PAKs up into individual files named after the PAK. They go in the current directory. getpaks takes as input names of the PAKs you want and writes them out to the file designated by the -o option. You'll need to adjust $pak_dir as necessary to point to the place you put the PAKs via splitpaks. It requires you to specify whether you want VMS or Unix PAKs. If you know perl, you can hack that out if you don't want to do that when you run it. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'splitpaks' <<'END_OF_FILE' X#!/dcs/bin/perl X X# This perl script takes the reg_paks.com/reg_paks.csh scripts and X# breaks them up into individual paks, making it easier to pick and X# choose which pak you want. X# X# Usage: splitpaks ); X$unix =0; X$unix = 1 if ($PAK[0] =~ /^#!\/bin\/csh/); X Xif ($unix) { X print "Processing unix paks...\n"; X &process_unix; X} Xelse { X print "Processing VMS paks...\n"; X &process_vms; X} X Xexit (0); X X X# process unix paks. We assume that each pak begins with the line X# 'echo ""'. Xsub process_unix { X X# first, write all the lines at the begining of the file into the file X# 'hdr'. X open (OUT,'>hdr') || die "Cannot open output file hdr: $!"; X for ($i = 0; $PAK[$i] !~ /^echo ""/; $i++) { X print OUT $PAK[$i]; X } X X close (OUT); X print "File header saved in hdr\n"; X X# Start processing paks. First, find the line that has '$lmfcom delete' X# on it to get the pak name. X while (1) { X last if ($i > $#PAK); X $j = $i; X while ($j <= $#PAK) { X last if ($PAK[$j] =~ /lmfcom delete/); X $j++; X } X if ($j > $#PAK) { X print "Possible error looking for a pak...\n"; X exit (1); X } X $t = $PAK[$j]; X chop $t; X $t =~ s/(^\$lmfcom delete )(.*)/$2/; X print "$t\n"; X while ($j <= $#PAK && $PAK[$j] !~ /lmfcom load/) { X $j++; X } X open (OUT,">$t") || die "Cannot open PAK file $t: $!"; X for ($k = $i; $k <= $j; $k++) { X print OUT $PAK[$k]; X } X close (OUT); X X last if ($j == $#PAK); X X $i = $j + 1; X } X} X Xsub process_vms { X X# first, write all the lines at the begining of the file into the file X# 'hdr'. X open (OUT,'>hdr') || die "Cannot open output file hdr: $!"; X for ($i = 0; $PAK[$i] !~ /^\$! This PAK/; $i++) { X print OUT $PAK[$i]; X } X X close (OUT); X print "File header saved in hdr\n"; X X# Start processing paks. First, find the line that has '$ LICENSE REGISTER' X# on it to get the pak name. X while (1) { X last if ($i > $#PAK); X $j = $i; X while ($j <= $#PAK) { X last if ($PAK[$j] =~ /LICENSE REGISTER/); X $j++; X } X if ($j > $#PAK) { X print "Possible error looking for a pak...\n"; X exit (1); X } X $t = $PAK[$j]; X chop $t; X $t =~ s/(^\$ LICENSE REGISTER )(\S*) \-/$2/; X print "$t\n"; X while ($j <= $#PAK && $PAK[$j] !~ /license load/) { X $j++; X } X open (OUT,">$t") || die "Cannot open PAK file $t: $!"; X for ($k = $i; $k <= $j; $k++) { X print OUT $PAK[$k]; X } X close (OUT); X X last if ($j == $#PAK); X X# print "$#PAK $j\n"; X $i = $j + 1; X } X} END_OF_FILE if test 2754 -ne `wc -c <'splitpaks'`; then echo shar: \"'splitpaks'\" unpacked with wrong size! fi chmod +x 'splitpaks' # end of 'splitpaks' fi if test -f 'getpaks' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'getpaks'\" else echo shar: Extracting \"'getpaks'\" \(1401 characters\) sed "s/^X//" >'getpaks' <<'END_OF_FILE' X#!/dcs/bin/perl X X# Usage: getpaks -s [vms|unix] -o outputfile X# X# getpaks gets a list of paks (via stdin) and puts the requested paks X# in outputfile. -s must be used to tell whether to use vms or unix X# paks X Xrequire "newgetopt.pl"; X Xselect((select(STDOUT), $| = 1)[0]); X X# Make sure we got called right and parse options Xif (! @ARGV) { X &usage; X} X X&NGetOpt("o=s","s=s") || &usage; X X&usage if (!$opt_s || !$opt_o); X X&usage if (($opt_s ne "vms") && ($opt_s ne "unix")); X X$pak_dir = "/users/cs/ccs/DEC_PAKS/$opt_s"; X X# open the output file Xopen (OUT,">$opt_o") || die "Cannot open output file $opt_o: $!"; X X#if there's a $pak_dir/hdr file put that at the begining of the output file Xif (-e "$pak_dir/hdr") { X print "[Adding $pak_dir/hdr to $opt_o]\n"; X open (IN,"$pak_dir/hdr") || die "Cannot open hdr file $pak_dir/hdr: $!"; X while () { X print OUT $_; X } X close (IN); X} X X# Now get the pak names we need Xprint "\nPAK name: "; Xwhile ($pn = <>) { X chop $pn; X X $pn =~ s/^[ \t]+(\S*)[ \t]+/\1/; # strip leading/trailing spaces X $pn =~ tr/a-z/A-Z/; X if (-e "$pak_dir/$pn") { X open (IN,"$pak_dir/$pn") || die "Cannot open PAK $pn: $!"; X while () { X print OUT $_; X } X close (IN); X print "$pn ... ok\n"; X } X else { X print "$pn: No such PAK\n"; X } X print "\nPAK name: "; X} X Xclose (OUT); X Xexit(0); X Xsub usage { X print "Usage: getpaks -s [vms|unix] -o outputfile\n"; X exit (1); X} END_OF_FILE if test 1401 -ne `wc -c <'getpaks'`; then echo shar: \"'getpaks'\" unpacked with wrong size! fi chmod +x 'getpaks' # end of 'getpaks' fi echo shar: End of shell archive. exit 0 ============================ -- Neil R. Smith, Res. Assoc./Sys. Admin. neils@csrp.tamu.edu Dept. Meteorology, Texas A&M Univ. 409/862-4342