move fix-permissions to linux/bin

This commit is contained in:
jysperm
2014-11-29 01:16:12 +08:00
parent f0b985424b
commit 9ee19227bc
3 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env coffee
child_process = require 'child_process'
async = require 'async'
fs = require 'fs'
fs.readdir '/home', (err, files) ->
throw err if err
async.eachSeries files, (file, callback) ->
async.parallel [
(callback) ->
child_process.exec "sudo chown -R #{file}:#{file} /home/#{file}", (err) ->
callback err
(callback) ->
child_process.exec "sudo chmod -R o-rwx /home/#{file}", (err) ->
callback err
], (err) ->
throw err if err
console.log "finish chown/chmod for #{file}"
callback()
, ->
process.exit 0