view src/pkg-examine.pl @ 32:426344e3e639

replace shebang.
author Robert McIntyre <rlm@mit.edu>
date Tue, 15 Jan 2013 12:47:33 +0000
parents 819e950ac8cc
children
line wrap: on
line source
1 #!/usr/bin/perl
2 use File::stat;
4 if ($ARGV[0] eq "--help"){
5 print <<"HERE";
7 pkg-examine -- print package contents.
9 Written by Robert McIntyre. This software is free
10 software and is released to the public domain.
12 HERE
13 exit 0;
14 }
16 $" = " ";
17 $pkg_name = $ARGV[0];
19 `id -g $pkg_name 2>/dev/null`;
20 if (($pkg_name eq "") || $?){
21 print "No group named $pkg_name.\n";
22 exit 0;
23 }
25 @files = split(/\0/, `find /usr /opt /etc -group $pkg_name -print0`);
28 print "All files owned by this package:\n";
29 foreach (@files){print " $_\n";}
31 print "SetUID/SetGID files:\n";
32 foreach $file(@files){
34 $sb = stat($file);
35 $mode = $sb->mode & 07777;
36 if ($mode & 07000){
37 printf "%s, %04o\n", $file, $mode;
38 }
39 }