Add support for mechanisms with no integrity
[openssh.git] / contrib / aix / inventory.sh
1 #!/bin/sh
2 #
3 # inventory.sh
4 # $Id: inventory.sh,v 1.6 2003/11/21 12:48:56 djm Exp $
5 #
6 # Originally written by Ben Lindstrom, modified by Darren Tucker to use perl
7 # This file is placed into the public domain.
8 #
9 # This will produce an AIX package inventory file, which looks like:
10 #
11 # /usr/local/bin:
12 #          class=apply,inventory,openssh
13 #          owner=root
14 #          group=system
15 #          mode=755
16 #          type=DIRECTORY
17 # /usr/local/bin/slogin:
18 #          class=apply,inventory,openssh
19 #          owner=root
20 #          group=system
21 #          mode=777
22 #          type=SYMLINK
23 #          target=ssh
24 # /usr/local/share/Ssh.bin:
25 #          class=apply,inventory,openssh
26 #          owner=root
27 #          group=system
28 #          mode=644
29 #          type=FILE
30 #          size=VOLATILE
31 #          checksum=VOLATILE
32
33 find . ! -name . -print | perl -ne '{
34         chomp;
35         if ( -l $_ ) {
36                 ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=lstat;
37         } else {
38                 ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=stat;
39         }
40
41         # Start to display inventory information
42         $name = $_;
43         $name =~ s|^.||;        # Strip leading dot from path
44         print "$name:\n";
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
49         
50         if ( -l $_ ) {
51                 # Entry is SymLink
52                 print "\ttype=SYMLINK\n";
53                 printf "\ttarget=%s\n", readlink($_);
54         } elsif ( -f $_ ) {
55                 # Entry is File
56                 print "\ttype=FILE\n";
57                 print "\tsize=$sz\n";
58                 print "\tchecksum=VOLATILE\n";
59         } elsif ( -d $_ ) {
60                 # Entry is Directory
61                 print "\ttype=DIRECTORY\n";
62         }
63 }'