--- loncom/build/verifymodown.pl 2001/11/17 22:46:00 1.1 +++ loncom/build/verifymodown.pl 2004/06/08 23:14:16 1.3 @@ -5,9 +5,9 @@ # verifymodown.pl - script to enforce file mode and ownership # # YEAR=2001 -# 11/17 Scott Harrison +# 11/17,12/6 Scott Harrison # -# $Id: verifymodown.pl,v 1.1 2001/11/17 22:46:00 harris41 Exp $ +# $Id: verifymodown.pl,v 1.3 2004/06/08 23:14:16 albertel Exp $ ### my $filename=shift @ARGV; @@ -19,6 +19,8 @@ my $arguments=shift @ARGV; my ($user)=($arguments=~/\-o (\S+)/); my ($group)=($arguments=~/\-g (\S+)/); my ($mode)=($arguments=~/\-m (\S+)/); +my $nofix; +$nofix=1 if $arguments=~/\-N/; my $currentmode=(stat($filename))[2]; my $currentuser=getpwuid((stat($filename))[4]); @@ -31,16 +33,19 @@ unless (-l $filename) { $cflag.="[MODE IS $currentmode SHOULD BE $mode]" if $mode ne $currentmode; } - $cflag.="[USER IS $currentuser SHOULD BE $user]" if $user ne $currentuser; - $cflag.="[GROUP IS $currentgroup SHOULD BE $group]" - if $group ne $currentgroup; +$cflag.="[USER IS $currentuser SHOULD BE $user]" if $user ne $currentuser; +$cflag.="[GROUP IS $currentgroup SHOULD BE $group]" + if $group ne $currentgroup; + +if ($nofix) { + print $cflag; exit; +} if ($cflag) { - `chmod $mode $filename`; - `chown $user:$group $filename`; + system("chmod $mode $filename"); + system("chown $user:$group $filename"); } -print <