4 # $Id: inventory.sh,v 1.6 2003/11/21 12:48:56 djm Exp $
6 # Originally written by Ben Lindstrom, modified by Darren Tucker to use perl
7 # This file is placed into the public domain.
9 # This will produce an AIX package inventory file, which looks like:
12 # class=apply,inventory,openssh
17 # /usr/local/bin/slogin:
18 # class=apply,inventory,openssh
24 # /usr/local/share/Ssh.bin:
25 # class=apply,inventory,openssh
33 find .
! -name .
-print | perl
-ne '{
36 ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=lstat;
38 ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=stat;
41 # Start to display inventory information
43 $name =~ s|^.||; # Strip leading dot from path
45 print "\tclass=apply,inventory,openssh\n";
46 print "\towner=root\n";
47 print "\tgroup=system\n";
48 printf "\tmode=%lo\n", $mod & 07777; # Mask perm bits
52 print "\ttype=SYMLINK\n";
53 printf "\ttarget=%s\n", readlink($_);
56 print "\ttype=FILE\n";
58 print "\tchecksum=VOLATILE\n";
61 print "\ttype=DIRECTORY\n";