forked from ungleich-public/cdist
		
	call systemctl in subshell to prevent the explorer from failing if it exits non zero
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								48e2468c56
							
						
					
				
			
			
				commit
				
					
						127c512f84
					
				
			
		
					 1 changed files with 4 additions and 9 deletions
				
			
		| 
						 | 
					@ -28,14 +28,9 @@ name="$__object_id"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
    archlinux)
 | 
					    archlinux)
 | 
				
			||||||
        # convert bash array to shell
 | 
					        state=$(systemctl is-enabled "$name" >/dev/null 2>&1 \
 | 
				
			||||||
        systemctl is-enabled "$name" >/dev/null 2>&1; ret=$?
 | 
					            && echo present \
 | 
				
			||||||
 | 
					            || echo absent)
 | 
				
			||||||
        if [ "$ret" = 0 ]; then
 | 
					 | 
				
			||||||
            state="present"
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
            state="absent"
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    debian|ubuntu|openwrt)
 | 
					    debian|ubuntu|openwrt)
 | 
				
			||||||
| 
						 | 
					@ -48,7 +43,7 @@ case "$os" in
 | 
				
			||||||
        [ "$state" ] || state="present"
 | 
					        [ "$state" ] || state="present"
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    *)  
 | 
					    *)
 | 
				
			||||||
       echo "Unsupported os: $os" >&2
 | 
					       echo "Unsupported os: $os" >&2
 | 
				
			||||||
       exit 1
 | 
					       exit 1
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue