Skip to content

Commit

Permalink
Improve 'permit' tool: we apparently don't need the ugly hack for pre…
Browse files Browse the repository at this point in the history
…serving executable bits, we can use the 'X' modifier instead.
  • Loading branch information
FooBarWidget committed Dec 9, 2012
1 parent f48d0ce commit 312b3e2
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions permit
Expand Up @@ -42,19 +42,12 @@ username, *dirs = ARGV
dirs.each do |dir|
print_activity "cd #{dir}"
Dir.chdir(dir) do
executable_files = "/tmp/executable-files.#{$$}"
sh "find -type f -executable -print0 > #{executable_files}"
if options[:read_write]
sh "find -type f -print0 | xargs -0 -n 1000 -r setfacl -m user:#{username}:rw-"
sh "find -type d -print0 | xargs -0 -n 1000 -r setfacl -m user:#{username}:rwx"
sh "find -type d -print0 | xargs -0 -n 1000 -r setfacl -d -m user:#{username}:rwx"
sh "setfacl -R -m user:#{username}:rwX ."
sh "find -type d -print0 | xargs -0 -n 1000 -r setfacl -d -m user:#{username}:rwX"
else
sh "find -type f -print0 | xargs -0 -n 1000 -r setfacl -m user:#{username}:r-"
sh "find -type d -print0 | xargs -0 -n 1000 -r setfacl -m user:#{username}:r-x"
sh "find -type d -print0 | xargs -0 -n 1000 -r setfacl -d -m user:#{username}:r-x"
sh "setfacl -R -m user:#{username}:r-X ."
sh "find -type d -print0 | xargs -0 -n 1000 -r setfacl -d -m user:#{username}:r-X"
end
sh "find -type f -print0 | xargs -0 -n 1000 -r chmod -x"
sh "cat #{executable_files} | xargs -0 -n 1000 -r chmod +x"
sh "rm -f #{executable_files}"
end
end

0 comments on commit 312b3e2

Please sign in to comment.