create-user.pl now pulls shell enum from conf file
This commit is contained in:
parent
d952598f08
commit
b1557ae5f5
@ -2,16 +2,26 @@
|
|||||||
|
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
|
use JSON;
|
||||||
|
|
||||||
my $WORKING_DIR = "/home/gashapwn/lyadmin/";
|
my $WORKING_DIR = "/home/gashapwn/lyadmin/";
|
||||||
my $ACCOUNT_DIR = "test/";
|
my $ACCOUNT_DIR = "test/";
|
||||||
|
|
||||||
my $FULL_PATH = "$WORKING_DIR$ACCOUNT_DIR";
|
my $FULL_PATH = "$WORKING_DIR$ACCOUNT_DIR";
|
||||||
|
my $CONF_PATH = $WORKING_DIR."lyadmin.conf.json";
|
||||||
|
my $SHELL_ENUM;
|
||||||
|
|
||||||
my $SHELL_ENUM = {
|
open FILE, $CONF_PATH or die "could not open file $CONF_PATH";
|
||||||
"SHELL_BASH" => "/usr/local/bin/bash",
|
{
|
||||||
"SHELL_KSH" => "/bin/ksh"
|
my $conf_str;
|
||||||
|
my $conf_obj;
|
||||||
|
local $/=undef;
|
||||||
|
$conf_str = <FILE>;
|
||||||
|
chomp $conf_str;
|
||||||
|
$conf_obj = decode_json($conf_str);
|
||||||
|
$SHELL_ENUM = $conf_obj->{"shell"};
|
||||||
};
|
};
|
||||||
|
close FILE;
|
||||||
|
|
||||||
my @g;
|
my @g;
|
||||||
|
|
||||||
@ -28,13 +38,16 @@ sub create($){
|
|||||||
open FILE, $fn1 or die "could not open file $fn1";
|
open FILE, $fn1 or die "could not open file $fn1";
|
||||||
$username = <FILE>;
|
$username = <FILE>;
|
||||||
chomp $username;
|
chomp $username;
|
||||||
|
|
||||||
$user_email = <FILE>;
|
$user_email = <FILE>;
|
||||||
chomp $user_email;
|
chomp $user_email;
|
||||||
|
|
||||||
{
|
{
|
||||||
my $s0 = <FILE>;
|
my $s0 = <FILE>;
|
||||||
chomp $s0;
|
chomp $s0;
|
||||||
|
unless($SHELL_ENUM->{$s0}){
|
||||||
|
die "invalid shell setting $s0 in file $id.ident";
|
||||||
|
}
|
||||||
$shell_pref = $SHELL_ENUM->{$s0};
|
$shell_pref = $SHELL_ENUM->{$s0};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user