(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:KOALEPHANT_ENVIRONMENT_PREFIX) op: assign_op.Equal rhs: {(DQ )} spids: [19] ) ] ) (command.ShFunction name: k_env_safename body: (BraceGroup children: [ (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name KOALEPHANT_ENVIRONMENT_PREFIX) (${ Id.VSub_Number 1))}) (C {<tr>} {<-cd>} {(SQ <'[:alnum:]_'>)}) ] negated: F ) ] ) ) (command.ShFunction name: k_env_set body: (BraceGroup children: [ (C {<local>} {<name>} {<value>} {<msg>} {<tmpN>} {<existing>} {<nsName>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-lt>} {<2>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} { (DQ <'Not enough arguments passed to k_env_set: \''> ($ Id.VSub_At '$@') <'\''> ) } ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<1>} ) ] spids: [114 127] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_env_safename>} {(DQ (${ Id.VSub_Number 1))}) ) } spids: [151] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:value) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 2))} spids: [163] ) ] ) (C {<k_debug>} {<2>} { (DQ <'Setting \''> (${ Id.VSub_Name name) <'\' environment variable to \''> (${ Id.VSub_Name value) <'\''> ) } ) (C {<export>} {(DQ (${ Id.VSub_Name name) <'='> (${ Id.VSub_Name value))}) ] ) ) (command.ShFunction name: k_env_unset body: (BraceGroup children: [ (C {<local>} {<name>}) (command.ForEach iter_name: name iter_words: [{(DQ ($ Id.VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [ (C {<k_debug>} {<2>} {(DQ <'Unsetting \''> (${ Id.VSub_Name name) <'\' environment variable'>)} ) (C {<unset>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_env_safename>} {(DQ (${ Id.VSub_Name name))}) ) ) } ) ] ) ) ] ) ) (command.ShFunction name: k_env_export body: (BraceGroup children: [ (C {<local>} {<name>}) (command.ForEach iter_name: name iter_words: [{(DQ ($ Id.VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [ (C {<echo>} { (DQ <'export '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) (${ Id.VSub_Name name) <'='> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<eval>} { (DQ <'echo '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ) <'{'> (${ Id.VSub_Name name) <'}'> ) } ) ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ) } ) ] ) ) ] ) ) (command.ShFunction name: k_env_unexport body: (BraceGroup children:[(C {<echo>} {(DQ <'unset '> ($ Id.VSub_At '$@'))})]) ) (command.ShFunction name: k_env_import_gecos body: (BraceGroup children: [ (C {<local>} {<userName>} {<passwdEntry>} {<gecos>} {<i>} {<name>} {<value>}) (C {<k_debug>} {<2>} {(DQ <'Importing Environment Variables from GECOS field'>)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:userName) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Number 1> suffix_op: (suffix_op.Unary tok: <Id.VTest_ColonHyphen ':-'> arg_word: {(${ Id.VSub_Name USER)} ) ) ) } spids: [425] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:passwdEntry) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<getent>} {<passwd>} {(DQ (${ Id.VSub_Name userName))}) ) } spids: [437] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_QMark '$?'))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <0>)} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {($ Id.VSub_QMark '$?')} ) ] spids: [452 470] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:gecos) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name passwdEntry))}) (C {<cut>} {<-d>} {(DQ <':'>)} {<-f>} {<5>}) ] negated: F ) ) } spids: [481] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: {<1>} spids: [508] ) ] ) (command.ForEach iter_name: name iter_words: [{<NAME>} {<ROOM>} {<TELEPHONE_WORK>} {<TELEPHONE_HOME>} {<EMAIL>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<k_env_set>} {(DQ (${ Id.VSub_Name name))} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name gecos))}) (C {<cut>} {<-d>} {(DQ <','>)} {<-f>} {(DQ (${ Id.VSub_Name i))}) ] negated: F ) ) ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (C {<k_string_contains>} {(DQ (${ Id.VSub_Name name))} {(DQ (${ Id.VSub_Name KOALEPHANT_ENV_NS_GECOS))} ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<export>} {<Id.Lit_VarLike 'KOALEPHANT_ENV_NS_GECOS='> (DQ (${ Id.VSub_Name KOALEPHANT_ENV_NS_GECOS) <' '> (${ Id.VSub_Name name) ) } ) ] spids: [572 591] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {(${ Id.VSub_Name i)} right: {<Id.Lit_Digits 1>} ) ) } spids: [612] ) ] ) ] ) ) ] ) ) (command.ShFunction name: k_env_export_gecos body: (BraceGroup children:[(C {<k_env_export>} {(${ Id.VSub_Name KOALEPHANT_ENV_NS_GECOS)})]) ) (command.ShFunction name: k_env_unset_gecos body: (BraceGroup children: [ (C {<k_env_unset>} {(${ Id.VSub_Name KOALEPHANT_ENV_NS_GECOS)} {<KOALEPHANT_ENV_NS_GECOS>}) ] ) ) (command.ShFunction name: k_env_import_apache body: (BraceGroup children: [ (C {<local>} {<lines>} {<line>} {<name>} {<value>}) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<local>} {<Id.Lit_VarLike 'IFS='> (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(SQ <'\\n '>)}) ) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:IFS) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name IFS> suffix_op: (suffix_op.Unary tok:<Id.VOp1_Percent '%'> arg_word:{<' '>}) ) ) } spids: [717] ) ] ) ] ) (C {<local>} {<Id.Lit_VarLike 'file='> (DQ (${ Id.VSub_Number 1))}) (C {<local>} {<Id.Lit_VarLike 'setMode='> (DQ (braced_var_sub token: <Id.VSub_Number 2> suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<true>}) ) ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-f>} {(DQ (${ Id.VSub_Name file))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [ {<echo>} {(DQ <'Invalid file supplied: \''> (${ Id.VSub_Name file) <'\''>)} ] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [750 767] ) ] ) (C {<k_debug>} {<2>} { (DQ <'Importing Environment Variables from Apache Config: \''> (${ Id.VSub_Name file) <'\''> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:lines) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<grep>} {<-o>} {<-E>} {(DQ <'SetEnv[[:space:]].*'>)} {(DQ (${ Id.VSub_Name file))} ) ) } spids: [807] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<0>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {($ Id.VSub_QMark '$?')} ) ] spids: [828 842] ) ] ) (command.ForEach iter_name: line iter_words: [{(${ Id.VSub_Name lines)}] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name line))}) (C {<cut>} {<-d>} {(DQ <' '>)} {<-f>} {<2>}) ] negated: F ) ) } spids: [868] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:value) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name line))}) (C {<cut>} {<-d>} {(DQ <' '>)} {<-f>} {<3->}) (C {<perl>} {<-e>} {(SQ <'s/^"//g; s/(?<!\\\\)"$//g; s/"/\\"/g'>)} {<-p>} ) ] negated: F ) ) } spids: [894] ) ] ) (C {<k_env_set>} {(DQ (${ Id.VSub_Name name))} {(DQ (${ Id.VSub_Name value))}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (C {<k_string_contains>} {(DQ (${ Id.VSub_Name name))} {(DQ (${ Id.VSub_Name KOALEPHANT_ENV_NS_APACHE))} ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<export>} {<Id.Lit_VarLike 'KOALEPHANT_ENV_NS_APACHE='> (DQ (${ Id.VSub_Name KOALEPHANT_ENV_NS_APACHE) <' '> (${ Id.VSub_Name name) ) } ) ] spids: [949 968] ) ] ) ] ) ) ] ) ) (command.ShFunction name: k_env_export_apache body: (BraceGroup children: [ (C {<k_env_export>} {(${ Id.VSub_Name KOALEPHANT_ENV_NS_APACHE)} {<KOALEPHANT_ENV_NS_APACHE>} ) ] ) ) (command.ShFunction name: k_env_unset_apache body: (BraceGroup children: [ (C {<k_env_unset>} {(${ Id.VSub_Name KOALEPHANT_ENV_NS_APACHE)} {<KOALEPHANT_ENV_NS_APACHE>}) ] ) ) (command.ShFunction name: k_env_unexport_apache body: (BraceGroup children: [ (C {<k_env_unexport>} {(${ Id.VSub_Name KOALEPHANT_ENV_NS_APACHE)} {<KOALEPHANT_ENV_NS_APACHE>} ) ] ) ) (command.ShFunction name: k_env_import_ldap body: (BraceGroup children: [ (C {<local>} {<filter>} {<i>} {<line>} {<name>} {<origName>} {<longName>} {<value>} {<result>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:filter) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Number 1))} spids: [1096] ) ] ) (C {<shift>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ (${ Id.VSub_Name filter))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Simple words: [{<echo>} {(DQ <'No filter supplied'>)}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [1108 1123] ) ] ) (C {<k_debug>} {<2>} { (DQ <'Importing Environment Variables from LDAP with Filter: \''> (${ Id.VSub_Name filter) <'\''> ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-d>} {(DQ (${ Id.VSub_Name KOALEPHANT_LIB_PATH) <'/ldap-attr-maps'>)} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ForEach iter_name: i iter_words: [ {(DQ (${ Id.VSub_Name KOALEPHANT_LIB_PATH) <'/ldap-attr-maps/'>) <Id.Lit_Star '*'> <.attrs> } ] do_arg_iter: F body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<-r>} {(DQ (${ Id.VSub_Name i))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ForEach iter_name: line iter_words: [ { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<grep>} {<--only-matching>} { (SQ < '^\\(ATTR_[a-zA-Z0-9\\-]\\+\\)=\\([a-zA-Z0-9\\-]\\+\\)$' > ) } {(DQ (${ Id.VSub_Name i))} ) ) } ] do_arg_iter: F body: (command.DoGroup children: [ (C {<eval>} {(DQ <'local '> (${ Id.VSub_Name line))}) ] ) ) ] spids: [1201 1216] ) ] ) ] ) ) ] spids: [1163 1179] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:result) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<ldapsearch>} {<-x>} {<-LLL>} {<-o>} {<ldif-wrap> <Id.Lit_Equals '='> <no>} {(DQ <'('> (${ Id.VSub_Name filter) <')'>)} {(DQ ($ Id.VSub_At '$@'))} ) ) } spids: [1268] ) ] ) (command.ForEach iter_name: line iter_words: [{(${ Id.VSub_Name result)}] do_arg_iter: F body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name line))}) (C {<grep>} {<--only-matching>} {(DQ <'^[^:]*'>)}) ] negated: F ) ) } spids: [1311] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:origName) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name name))} spids: [1333] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:longName) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<eval>} {<echo>} { (DQ (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>) <ATTR_> (${ Id.VSub_Name name) ) } ) ) } spids: [1341] ) ] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-z>} {(DQ (${ Id.VSub_Name longName))} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name longName))} spids: [1377] ) ] ) ] spids: [1357 1374] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_string_upper>} { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<k_string_split_camelcase>} {(DQ (${ Id.VSub_Name name))} {(DQ <_>)} ) ) } ) ) } spids: [1389] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:value) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ (${ Id.VSub_Name line))}) (C {<cut>} {<-b>} { (DQ (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: { (braced_var_sub token: <Id.VSub_Name origName> prefix_op: (Id.VSub_Pound) ) } right: {<Id.Lit_Digits 3>} ) ) <-> ) } ) ] negated: F ) ) } spids: [1410] ) ] ) (C {<k_env_set>} {(DQ (${ Id.VSub_Name name))} {(DQ (${ Id.VSub_Name value))} {(DQ <LDAP>)} ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [ (C {<k_string_contains>} {(DQ (${ Id.VSub_Name name))} {(DQ (${ Id.VSub_Name KOALEPHANT_ENV_NS_LDAP))} ) ] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<export>} {<Id.Lit_VarLike 'KOALEPHANT_ENV_NS_LDAP='> (DQ (${ Id.VSub_Name KOALEPHANT_ENV_NS_LDAP) <' '> (${ Id.VSub_Name name) ) } ) ] spids: [1464 1483] ) ] ) ] ) ) ] ) ) (command.ShFunction name: k_env_export_ldap body: (BraceGroup children:[(C {<k_env_export>} {(${ Id.VSub_Name KOALEPHANT_ENV_NS_LDAP)})]) ) (command.ShFunction name: k_env_unset_ldap body: (BraceGroup children: [ (C {<k_env_unset>} {(${ Id.VSub_Name KOALEPHANT_ENV_NS_LDAP)} {<KOALEPHANT_ENV_NS_LDAP>}) ] ) ) ] )