forked from ungleich-public/cdist
		
	add template for __package_openbsd_pkg
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								785ec3f36f
							
						
					
				
			
			
				commit
				
					
						654512c209
					
				
			
		
					 5 changed files with 137 additions and 0 deletions
				
			
		
							
								
								
									
										30
									
								
								conf/type/__package_openbsd_pkg/explorer/pkg_version
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										30
									
								
								conf/type/__package_openbsd_pkg/explorer/pkg_version
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist.
 | 
			
		||||
#
 | 
			
		||||
# cdist is free software: you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# cdist is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# Retrieve the status of a package - parsed dpkg output
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/name" ]; then
 | 
			
		||||
   name="$(cat "$__object/parameter/name")"
 | 
			
		||||
else
 | 
			
		||||
   name="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
pacman -Q "$name" 2>/dev/null | awk '{ print $2 }'
 | 
			
		||||
							
								
								
									
										52
									
								
								conf/type/__package_openbsd_pkg/gencode-remote
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										52
									
								
								conf/type/__package_openbsd_pkg/gencode-remote
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist.
 | 
			
		||||
#
 | 
			
		||||
# cdist is free software: you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
# (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# cdist is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# Manage packages with Pacman (mostly archlinux)
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# Debug
 | 
			
		||||
# exec >&2
 | 
			
		||||
# set -x
 | 
			
		||||
 | 
			
		||||
pacopts="--noconfirm --noprogressbar"
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/name" ]; then
 | 
			
		||||
   name="$__object/parameter/name"
 | 
			
		||||
else
 | 
			
		||||
   name="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
state="$(cat "$__object/parameter/state")"
 | 
			
		||||
pkg_version="$(cat "$__object/explorer/pkg_version")"
 | 
			
		||||
 | 
			
		||||
case "$state" in
 | 
			
		||||
   installed)
 | 
			
		||||
 | 
			
		||||
      # Empty? Not installed.
 | 
			
		||||
      if [ -z "$pkg_version" ]; then
 | 
			
		||||
         echo pacman "$pacopts" -S \"$name\"
 | 
			
		||||
      fi
 | 
			
		||||
   ;;
 | 
			
		||||
   uninstalled)
 | 
			
		||||
      if [ "$pkg_version" ]; then
 | 
			
		||||
         echo pacman "$pacopts" -R \"$name\"
 | 
			
		||||
      fi
 | 
			
		||||
   ;;
 | 
			
		||||
esac
 | 
			
		||||
							
								
								
									
										53
									
								
								conf/type/__package_openbsd_pkg/man.text
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								conf/type/__package_openbsd_pkg/man.text
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
cdist-type__package_pacman(7)
 | 
			
		||||
=============================
 | 
			
		||||
Nico Schottelius <nico-cdist--@--schottelius.org>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__package_pacman - Manage packages with pacman
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Pacman is usually used on the Archlinux distribution to manage
 | 
			
		||||
packages.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
state::
 | 
			
		||||
   Either "installed" or "deinstalled".
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
name::
 | 
			
		||||
   If supplied, use the name and not the object id as the package name.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
# Ensure zsh in installed
 | 
			
		||||
__package_pacman zsh --state installed
 | 
			
		||||
 | 
			
		||||
# If you don't want to follow pythonX packages, but always use python
 | 
			
		||||
__package_pacman python --state installed --name python2
 | 
			
		||||
 | 
			
		||||
# Remove obsolete package
 | 
			
		||||
__package_pacman puppet --state deinstalled
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
- cdist-type(7)
 | 
			
		||||
- cdist-type__package(7)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
 | 
			
		||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
 | 
			
		||||
							
								
								
									
										1
									
								
								conf/type/__package_openbsd_pkg/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								conf/type/__package_openbsd_pkg/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
name
 | 
			
		||||
							
								
								
									
										1
									
								
								conf/type/__package_openbsd_pkg/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								conf/type/__package_openbsd_pkg/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
state
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue