diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2008-05-08 17:11:57 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2008-05-08 17:11:57 +0000 |
commit | e4efed6d1612fd52327c6e3002880baf398d1db6 (patch) | |
tree | f499c9d7fecd3f620e9e40805beccbb3112a3c4e /compress_files | |
parent | 63fb6398455347084df0a39dd488bb94f84a96e9 (diff) | |
download | spec-helper-e4efed6d1612fd52327c6e3002880baf398d1db6.tar spec-helper-e4efed6d1612fd52327c6e3002880baf398d1db6.tar.gz spec-helper-e4efed6d1612fd52327c6e3002880baf398d1db6.tar.bz2 spec-helper-e4efed6d1612fd52327c6e3002880baf398d1db6.tar.xz spec-helper-e4efed6d1612fd52327c6e3002880baf398d1db6.zip |
no more external chmod command use
Diffstat (limited to 'compress_files')
-rwxr-xr-x | compress_files | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compress_files b/compress_files index d95000e..90d092b 100755 --- a/compress_files +++ b/compress_files @@ -7,6 +7,7 @@ use warnings; use Cwd; use File::Find; use File::Basename; +use Fcntl ':mode'; my $ext = $ARGV[0] ||= '.gz'; die "Unknown extension $ext" unless $ext =~ /^\.(?:gz|bz2|lzma)$/; @@ -123,8 +124,11 @@ foreach (@files) { } if (@f) { - # Make executables not be anymore. - xargs(\@f, "chmod", "a-x"); + # drop executable bits + foreach my $file (@f) { + my $mode = (stat($file))[2]; + chmod $mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH, $file; + } my @command = $ext eq '.gz' ? qw/gzip -9f/ : $ext eq '.bz2' ? qw/bzip2 -9f/ |