view src/pkg-files.pl @ 34:6422228dfea7

better name.
author Robert McIntyre <rlm@mit.edu>
date Sun, 10 Feb 2013 05:52:35 -0500
parents src/pkg-examine.pl@819e950ac8cc
children 4823f88ea3b6
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 }