forked from ungleich-public/cdist
		
	Do not use global variable.
Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
This commit is contained in:
		
					parent
					
						
							
								2a20b01a3f
							
						
					
				
			
			
				commit
				
					
						d591b5f2be
					
				
			
		
					 1 changed files with 15 additions and 14 deletions
				
			
		| 
						 | 
					@ -28,16 +28,17 @@ name="$__object_id"
 | 
				
			||||||
# systems (such as *BSD, Darwin) those commands do not handle GNU style long
 | 
					# systems (such as *BSD, Darwin) those commands do not handle GNU style long
 | 
				
			||||||
# options.
 | 
					# options.
 | 
				
			||||||
shorten_property() {
 | 
					shorten_property() {
 | 
				
			||||||
   RET=
 | 
					    local ret=""
 | 
				
			||||||
   case "$1" in
 | 
					    case "$1" in
 | 
				
			||||||
       comment) RET="-c";;
 | 
						comment) ret="-c";;
 | 
				
			||||||
       home) RET="-d";;
 | 
						home) ret="-d";;
 | 
				
			||||||
       gid) RET="-g";;
 | 
						gid) ret="-g";;
 | 
				
			||||||
       groups) RET="-G";;
 | 
						groups) ret="-G";;
 | 
				
			||||||
       password) RET="-p";;
 | 
						password) ret="-p";;
 | 
				
			||||||
       shell) RET="-s";;
 | 
						shell) ret="-s";;
 | 
				
			||||||
       uid) RET="-u";;
 | 
						uid) ret="-u";;
 | 
				
			||||||
   esac
 | 
					    esac
 | 
				
			||||||
 | 
					    echo "$ret"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd "$__object/parameter"
 | 
					cd "$__object/parameter"
 | 
				
			||||||
| 
						 | 
					@ -83,8 +84,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if [ "$new_value" != "$current_value" ]; then
 | 
					      if [ "$new_value" != "$current_value" ]; then
 | 
				
			||||||
	  shorten_property $property
 | 
						  local option=$(shorten_property $property)
 | 
				
			||||||
          set -- "$@" "$RET" \'$new_value\'
 | 
					          set -- "$@" "$option" \'$new_value\'
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
   done
 | 
					   done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,8 +97,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
   for property in $(ls .); do
 | 
					   for property in $(ls .); do
 | 
				
			||||||
      new_value="$(cat "$property")"
 | 
					      new_value="$(cat "$property")"
 | 
				
			||||||
      shorten_property $property
 | 
					      local option=$(shorten_property $property)
 | 
				
			||||||
      set -- "$@" "$RET" \'$new_value\'
 | 
					      set -- "$@" "$option" \'$new_value\'
 | 
				
			||||||
   done
 | 
					   done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   echo useradd "$@" "$name"
 | 
					   echo useradd "$@" "$name"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue