]> andersk Git - gssapi-openssh.git/blob - openssh/contrib/aix/inventory.sh
Import of OpenSSH 3.6.1p1
[gssapi-openssh.git] / openssh / contrib / aix / inventory.sh
1 #!/bin/sh
2 #
3 # inventory.sh
4 #
5 # Originally written by Ben Lindstrom, modified by Darren Tucker to use perl
6 #
7 # This will produce an AIX package inventory file, which looks like:
8 #
9 # /usr/local/bin:
10 #          class=apply,inventory,openssh
11 #          owner=root
12 #          group=system
13 #          mode=755
14 #          type=DIRECTORY
15 # /usr/local/bin/slogin:
16 #          class=apply,inventory,openssh
17 #          owner=root
18 #          group=system
19 #          mode=777
20 #          type=SYMLINK
21 #          target=ssh
22 # /usr/local/share/Ssh.bin:
23 #          class=apply,inventory,openssh
24 #          owner=root
25 #          group=system
26 #          mode=644
27 #          type=FILE
28 #          size=VOLATILE
29 #          checksum=VOLATILE
30
31 find . ! -name . -print | perl -ne '{
32         chomp;
33         if ( -l $_ ) {
34                 ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=lstat;
35         } else {
36                 ($dev,$ino,$mod,$nl,$uid,$gid,$rdev,$sz,$at,$mt,$ct,$bsz,$blk)=stat;
37         }
38
39         # Start to display inventory information
40         $name = $_;
41         $name =~ s|^.||;        # Strip leading dot from path
42         print "$name:\n";
43         print "\tclass=apply,inventory,openssh\n";
44         print "\towner=root\n";
45         print "\tgroup=system\n";
46         printf "\tmode=%lo\n", $mod & 07777;    # Mask perm bits
47         
48         if ( -l $_ ) {
49                 # Entry is SymLink
50                 print "\ttype=SYMLINK\n";
51                 printf "\ttarget=%s\n", readlink($_);
52         } elsif ( -f $_ ) {
53                 # Entry is File
54                 print "\ttype=FILE\n";
55                 print "\tsize=$sz\n";
56                 print "\tchecksum=VOLATILE\n";
57         } elsif ( -d $_ ) {
58                 # Entry is Directory
59                 print "\ttype=DIRECTORY\n";
60         } 
61 }'
This page took 0.035258 seconds and 5 git commands to generate.