Mercurial > pkg
annotate src/pkg-examine.pl @ 33:4c49f8e6d79d
update makefile; general cleanup.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 10 Feb 2013 05:51:54 -0500 |
parents | 819e950ac8cc |
children |
rev | line source |
---|---|
rlm@25 | 1 #!/usr/bin/perl |
rlm@28 | 2 use File::stat; |
rlm@25 | 3 |
rlm@25 | 4 if ($ARGV[0] eq "--help"){ |
rlm@25 | 5 print <<"HERE"; |
rlm@25 | 6 |
rlm@25 | 7 pkg-examine -- print package contents. |
rlm@25 | 8 |
rlm@25 | 9 Written by Robert McIntyre. This software is free |
rlm@25 | 10 software and is released to the public domain. |
rlm@25 | 11 |
rlm@25 | 12 HERE |
rlm@25 | 13 exit 0; |
rlm@25 | 14 } |
rlm@25 | 15 |
rlm@25 | 16 $" = " "; |
rlm@25 | 17 $pkg_name = $ARGV[0]; |
rlm@25 | 18 |
rlm@25 | 19 `id -g $pkg_name 2>/dev/null`; |
rlm@29 | 20 if (($pkg_name eq "") || $?){ |
rlm@29 | 21 print "No group named $pkg_name.\n"; |
rlm@29 | 22 exit 0; |
rlm@29 | 23 } |
rlm@25 | 24 |
rlm@25 | 25 @files = split(/\0/, `find /usr /opt /etc -group $pkg_name -print0`); |
rlm@25 | 26 |
rlm@28 | 27 |
rlm@28 | 28 print "All files owned by this package:\n"; |
rlm@28 | 29 foreach (@files){print " $_\n";} |
rlm@28 | 30 |
rlm@28 | 31 print "SetUID/SetGID files:\n"; |
rlm@28 | 32 foreach $file(@files){ |
rlm@28 | 33 |
rlm@28 | 34 $sb = stat($file); |
rlm@28 | 35 $mode = $sb->mode & 07777; |
rlm@28 | 36 if ($mode & 07000){ |
rlm@28 | 37 printf "%s, %04o\n", $file, $mode; |
rlm@28 | 38 } |
rlm@28 | 39 } |
rlm@28 | 40 |
rlm@28 | 41 |
rlm@28 | 42 |
rlm@28 | 43 |
rlm@28 | 44 |