forked from ungleich-public/cdist
		
	Merge pull request #408 from jakllsch/netbsd-user-groups
add some NetBSD support in __user_groups
This commit is contained in:
		
				commit
				
					
						7731dccbae
					
				
			
		
					 3 changed files with 15 additions and 2 deletions
				
			
		|  | @ -20,4 +20,4 @@ | |||
| 
 | ||||
| user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" | ||||
| 
 | ||||
| (id --groups --name "$user" | tr ' ' '\n' | sort) 2>/dev/null || true | ||||
| (id -G -n "$user" | tr ' ' '\n' | sort) 2>/dev/null || true | ||||
|  |  | |||
|  | @ -18,4 +18,11 @@ | |||
| # along with cdist. If not, see <http://www.gnu.org/licenses/>. | ||||
| # | ||||
| 
 | ||||
| os="$($__explorer/os)" | ||||
| 
 | ||||
| if [ "$os" = "netbsd" ]; then | ||||
|     echo netbsd | ||||
|     exit | ||||
| fi | ||||
| 
 | ||||
| usermod --help | grep -q -- '-A group' && echo true || echo false | ||||
|  |  | |||
|  | @ -21,8 +21,14 @@ | |||
| user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")" | ||||
| state_should="$(cat "$__object/parameter/state")" | ||||
| oldusermod="$(cat "$__object/explorer/oldusermod")" | ||||
| os=$(cat "$__global/explorer/os") | ||||
| 
 | ||||
| if [ "$oldusermod" = "true" ]; then | ||||
| if [ "$os" = "netbsd" ]; then | ||||
| 	# NetBSD does not have a command to remove a user from a group | ||||
| 	oldusermod="true" | ||||
| 	addparam="-G" | ||||
| 	delparam=";;#" | ||||
| elif [ "$oldusermod" = "true" ]; then | ||||
|         addparam="-A" | ||||
|         delparam="-R" | ||||
| else | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue