diff options
Diffstat (limited to 'contrib/aix/inventory.sh')
-rwxr-xr-x | contrib/aix/inventory.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/contrib/aix/inventory.sh b/contrib/aix/inventory.sh new file mode 100755 index 000000000..aa44ab9d4 --- /dev/null +++ b/contrib/aix/inventory.sh | |||
@@ -0,0 +1,61 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # inventory.sh | ||
4 | # | ||
5 | # Originall written by Ben Lindstrom, modified by Darren Tucker to use perl | ||
6 | # | ||
7 | # This will produced and 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=VOLATILE\n"; | ||
56 | print "\tchecksum=VOLATILE\n"; | ||
57 | } elsif ( -d $_ ) { | ||
58 | # Entry is Directory | ||
59 | print "\ttype=DIRECTORY\n"; | ||
60 | } | ||
61 | }' | ||