forked from ungleich-public/cdist
		
	__update_alternatives: add state explorer
This commit is contained in:
		
					parent
					
						
							
								c09165d122
							
						
					
				
			
			
				commit
				
					
						b891bb05d5
					
				
			
		
					 2 changed files with 12 additions and 0 deletions
				
			
		
							
								
								
									
										8
									
								
								cdist/conf/type/__update_alternatives/explorer/state
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										8
									
								
								cdist/conf/type/__update_alternatives/explorer/state
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					#!/bin/sh -e
 | 
				
			||||||
 | 
					path="$(cat "$__object/parameter/path")"
 | 
				
			||||||
 | 
					name="$__object_id"
 | 
				
			||||||
 | 
					link="$(readlink "/etc/alternatives/$name")"
 | 
				
			||||||
 | 
					if [ "$path" = "$link" ]
 | 
				
			||||||
 | 
					then echo present
 | 
				
			||||||
 | 
					else echo absent
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,10 @@
 | 
				
			||||||
# Setup alternative - no standard way to create, always set
 | 
					# Setup alternative - no standard way to create, always set
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "$(cat "$__object/explorer/state")" = 'present' ]
 | 
				
			||||||
 | 
					then exit 0
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
path="$(cat "$__object/parameter/path")"
 | 
					path="$(cat "$__object/parameter/path")"
 | 
				
			||||||
name="$__object_id"
 | 
					name="$__object_id"
 | 
				
			||||||
echo "update-alternatives --quiet --set '$name' '$path'"
 | 
					echo "update-alternatives --quiet --set '$name' '$path'"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue