diff options
Diffstat (limited to 'src/gitjoe/adduser.pl')
-rwxr-xr-x | src/gitjoe/adduser.pl | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gitjoe/adduser.pl b/src/gitjoe/adduser.pl index 844000e..8107155 100755 --- a/src/gitjoe/adduser.pl +++ b/src/gitjoe/adduser.pl @@ -3,25 +3,28 @@ use strict; use warnings; use Term::ANSIColor; +use constant { + DASH_PATH => '/usr/local/bin/dash', + ADDUSER_PATH => '/usr/sbin/adduser', +}; sub main { my $argc = $#ARGV + 1; - if ($argc < 3) { + if ($argc < 2) { print colored("Failed!\n", 'bold red') - . "Missing argument, 3 needed " - . colored("[user - password - ssh public key]", 'bold') + . "Missing argument, 2 needed " + . colored("[user - ssh public key]", 'bold') . "\n"; exit 1; } my $usr = $ARGV[0]; - my $pass = $ARGV[1]; my $sshkey = "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty "; - $sshkey = $sshkey . $ARGV[2]; + $sshkey = $sshkey . $ARGV[1]; my $home_dir = '/usr/home/' . $usr . '/'; system( - '/usr/local/bin/dash', + DASH_PATH, '-c', - "adduser << EOF + ADDUSER_PATH . " << EOF " . $usr . " |