update __package_luarocks to new style state checking
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								76a3c20669
							
						
					
				
			
			
				commit
				
					
						9fab782a0c
					
				
			
		
					 1 changed files with 16 additions and 19 deletions
				
			
		| 
						 | 
					@ -24,9 +24,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -f "$__object/parameter/name" ]; then
 | 
					if [ -f "$__object/parameter/name" ]; then
 | 
				
			||||||
   name="$(cat "$__object/parameter/name")"
 | 
					    name="$(cat "$__object/parameter/name")"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
   name="$__object_id"
 | 
					    name="$__object_id"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
state_should="$(cat "$__object/parameter/state")"
 | 
					state_should="$(cat "$__object/parameter/state")"
 | 
				
			||||||
| 
						 | 
					@ -49,21 +49,18 @@ else
 | 
				
			||||||
    state_is="absent"
 | 
					    state_is="absent"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$state" in
 | 
					# Leave if nothing is to be done
 | 
				
			||||||
   installed)
 | 
					[ "$state_is" = "$state_should" ] && exit 0
 | 
				
			||||||
      # Install only if non-existent
 | 
					
 | 
				
			||||||
      if [ -z "$is_installed" ]; then
 | 
					case "$state_should" in
 | 
				
			||||||
         echo luarocks install \"$name\"
 | 
					    present)
 | 
				
			||||||
      fi
 | 
					        echo luarocks install \"$name\"
 | 
				
			||||||
   ;;
 | 
					    ;;
 | 
				
			||||||
   removed)
 | 
					    absent)
 | 
				
			||||||
      # Remove only if existent
 | 
					        echo luarocks remove \"$name\"
 | 
				
			||||||
      if [ -n "$is_installed" ]; then
 | 
					    ;;
 | 
				
			||||||
         echo luarocks remove \"$name\"
 | 
					    *)
 | 
				
			||||||
      fi
 | 
					        echo "Unknown state: $state" >&2
 | 
				
			||||||
   ;;
 | 
					        exit 1
 | 
				
			||||||
   *)
 | 
					    ;;
 | 
				
			||||||
      echo "Unknown state: $state" >&2
 | 
					 | 
				
			||||||
      exit 1
 | 
					 | 
				
			||||||
   ;;
 | 
					 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue