[comp.unix.aix] sysck files for LPP's

benson@odi.com (Benson I. Margulies) (02/15/91)

A properly formatted lpp should include an inventory file which is a
complete set of sysck stanzas for all the files it installs.

IBM dosen't seem to supply any automated means of generating this,
except for the awful crock I'm about to describe.

sysck -a seems to be the right thing, but there is no documented
control argument that writes the new stanza's into a file other than
/etc/security/sysck.cfg.

Surely IBM has some tool with which it generates the gobs of sysck
stanzas on each and every installation tape.

I thought of this:

on some machine, temporarily move /etc/security/sysck.cfg to one side.
then run sysck -a on the installation hierarchy.
then move the thus-generated sysck.cfg to someplace else,
and put the old sysck.cfg back.

Surely there's a better way, or there should be.

-- 
Benson I. Margulies

jfh@greenber.austin.ibm.com (John F Haugh II) (02/19/91)

In article <1991Feb15.141628.24143@odi.com> benson@odi.com (Benson I. Margulies) writes:
>A properly formatted lpp should include an inventory file which is a
>complete set of sysck stanzas for all the files it installs.
>
>IBM dosen't seem to supply any automated means of generating this,
>except for the awful crock I'm about to describe.

The "inventory" file that IBM uses when v3 is built is manually
mantained in stanza file format.  There is/was no need to have a
tool to convert XYZ format to "inventory" format.

However, creating stanza files is pretty trivial - all you need is
a command that spews out the appropriate chunks of the inode info
for the files you are interested in.

For example -
--
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mode.h>
#include <stdio.h>
#include <pwd.h>
#include <grp.h>

main ()
{
	char	buf[BUFSIZ];
	struct	stat	sb;
	struct	passwd	*pwd;
	struct	group	*grp;

	while (gets (buf)) {
		if (stat (buf, &sb)) {
			perror (buf);
			continue;
		}
		printf ("%s:\n", buf);
		if (pwd = getpwuid (sb.st_uid))
			printf ("\towner = %s\n", pwd->pw_name);
		else
			printf ("\towner = %d\n", sb.st_uid);

		if (grp = getgrgid (sb.st_gid))
			printf ("\tgroup = %s\n", grp->gr_name);
		else
			printf ("\tgroup = %d\n", sb.st_gid);

		printf ("\tmode = ");
		if (sb.st_mode & 04000)
			printf ("SUID,");
		if (sb.st_mode & 02000)
			printf ("SGID,");
		if (sb.st_mode & 01000)
			printf ("SVTX,");
		printf ("%0.3o\n", sb.st_mode & 0777);

		if (S_ISREG (sb.st_mode)) {
			printf ("\ttype = FILE\n");
			printf ("\tsize = %d\n", sb.st_size);
		} else if (S_ISDIR (sb.st_mode)) {
			printf ("\ttype = DIRECTORY\n");
		} else if (S_ISMPX (sb.st_mode)) {
			printf ("\ttype = MPX_DEV\n");
		} else if (S_ISCHR (sb.st_mode)) {
			printf ("\ttype = CHAR_DEV\n");
		} else if (S_ISBLK (sb.st_mode)) {
			printf ("\ttype = BLK_DEV\n");
		} else if (S_ISFIFO (sb.st_mode)) {
			printf ("\ttype = FIFO\n");
		}
		putchar ('\n');
	}
}
--

>sysck -a seems to be the right thing, but there is no documented
>control argument that writes the new stanza's into a file other than
>/etc/security/sysck.cfg.

That's correct.

>Surely IBM has some tool with which it generates the gobs of sysck
>stanzas on each and every installation tape.

There is - but it input's stanzas in sysck format, and outputs
stanzas in sysck format.

>Surely there's a better way, or there should be.

Try hacking on the above program.  It should be suitable for your
purposes, provided you aren't getting too exotic.  You may want to
add a line for the file class, if you wish to use more than just the
default class the files will be installed with.

ObDisclaimer - I speak for myself only.
-- 
John F. Haugh II      |      I've Been Moved     |    MaBellNet: (512) 838-4340
SneakerNet: 809/1D064 |          AGAIN !         |      VNET: LCCB386 at AUSVMQ
BangNet: ..!cs.utexas.edu!ibmchs!auschs!snowball.austin.ibm.com!jfh (e-i-e-i-o)