Permalink
Browse files

Improve 'permit' tool: we apparently don't need the ugly hack for pre…

…serving executable bits, we can use the 'X' modifier instead.
  • Loading branch information...
1 parent f48d0ce commit 312b3e201f1476d466390b7a33789afa2623ba0a @FooBarWidget FooBarWidget committed Dec 9, 2012
Showing with 4 additions and 11 deletions.
  1. +4 −11 permit
View
15 permit
@@ -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.