forked from ungleich-public/cdist
		
	add --url support for __package_yum
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								066d0bf15a
							
						
					
				
			
			
				commit
				
					
						bbd451433f
					
				
			
		
					 3 changed files with 16 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
# 2011-2014 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +27,14 @@ else
 | 
			
		|||
   name="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Support installing from an URL
 | 
			
		||||
if [ -f "$__object/parameter/url" ]; then
 | 
			
		||||
   install_name="$(cat "$__object/parameter/url")"
 | 
			
		||||
else
 | 
			
		||||
   install_name="$name"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
 | 
			
		||||
if grep -q -E "(centos|redhat|amazon)" "$__global/explorer/os"; then
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +55,7 @@ fi
 | 
			
		|||
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    present)
 | 
			
		||||
        echo yum $opts install \"$name\"
 | 
			
		||||
        echo yum $opts install \"$install_name\"
 | 
			
		||||
    ;;
 | 
			
		||||
    absent)
 | 
			
		||||
        echo yum $opts remove \"$name\"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,8 @@ name::
 | 
			
		|||
 | 
			
		||||
state::
 | 
			
		||||
    Either "present" or "absent", defaults to "present"
 | 
			
		||||
url::
 | 
			
		||||
    URL to use for the package
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
| 
						 | 
				
			
			@ -41,6 +43,9 @@ __package_yum python --state present --name python2
 | 
			
		|||
 | 
			
		||||
# Remove obsolete package
 | 
			
		||||
__package_yum puppet --state absent
 | 
			
		||||
 | 
			
		||||
__package epel-release-6-8 \
 | 
			
		||||
    --url http://mirror.switch.ch/ftp/mirror/epel/6/i386/epel-release-6-8.noarch.rpm
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,2 +1,3 @@
 | 
			
		|||
name
 | 
			
		||||
state
 | 
			
		||||
url
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue