# File lib/rudy/routines/handlers/user.rb, line 19 19: def adduser(user, robj) 20: 21: # On Solaris, the user's home directory needs to be specified 22: # explicitly so we do it for linux too for fun. 23: homedir = robj.guess_user_home(user.to_s) 24: 25: # When more than one machine is running, this will be an Array 26: homedir = homedir.first if homedir.kind_of?(Array) 27: 28: args = [:m, :d, homedir, :s, '/bin/bash', user.to_s] 29: 30: # NOTE: We'll may to use platform specific code here. 31: # Linux has adduser and useradd commands: 32: # adduser can prompt for info which we don't want. 33: # useradd does not prompt (on Debian/Ubuntu at least). 34: # We need to specify bash b/c the default is /bin/sh 35: 36: if robj.user.to_s == 'root' 37: robj.useradd args 38: else 39: robj.sudo do 40: useradd args 41: end 42: end 43: 44: end