Mercurial > pkg
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/pkg-files.pl Sun Feb 10 05:52:35 2013 -0500 1.3 @@ -0,0 +1,44 @@ 1.4 +#!/usr/bin/perl 1.5 +use File::stat; 1.6 + 1.7 +if ($ARGV[0] eq "--help"){ 1.8 + print <<"HERE"; 1.9 + 1.10 +pkg-examine -- print package contents. 1.11 + 1.12 +Written by Robert McIntyre. This software is free 1.13 +software and is released to the public domain. 1.14 + 1.15 +HERE 1.16 +exit 0; 1.17 +} 1.18 + 1.19 +$" = " "; 1.20 +$pkg_name = $ARGV[0]; 1.21 + 1.22 +`id -g $pkg_name 2>/dev/null`; 1.23 +if (($pkg_name eq "") || $?){ 1.24 + print "No group named $pkg_name.\n"; 1.25 + exit 0; 1.26 +} 1.27 + 1.28 +@files = split(/\0/, `find /usr /opt /etc -group $pkg_name -print0`); 1.29 + 1.30 + 1.31 +print "All files owned by this package:\n"; 1.32 +foreach (@files){print " $_\n";} 1.33 + 1.34 +print "SetUID/SetGID files:\n"; 1.35 +foreach $file(@files){ 1.36 + 1.37 + $sb = stat($file); 1.38 + $mode = $sb->mode & 07777; 1.39 + if ($mode & 07000){ 1.40 + printf "%s, %04o\n", $file, $mode; 1.41 + } 1.42 +} 1.43 + 1.44 + 1.45 + 1.46 + 1.47 +