Merge remote-tracking branch 'sans/master'

This commit is contained in:
Nico Schottelius 2011-03-03 08:51:22 +01:00
commit baea18be5f
11 changed files with 56 additions and 50 deletions

View file

@ -20,13 +20,14 @@ case "$__target_host" in
__package_pacman wireshark-cli --state installed __package_pacman wireshark-cli --state installed
__package_pacman zsh --state installed __package_pacman zsh --state installed
;; ;;
cdist-gentoo)
__package tree --state installed
;;
# Real machines
ikq*) ikq*)
__package_apt zsh --state installed __package_apt zsh --state installed
;; ;;
icarus)
__package tree --ensure installed
;;
esac esac

View file

@ -1,7 +0,0 @@
install/pacman:
pacman --noconfirm --noprogressbar -S
--------------------------------------------------------------------------------
ensure: What state the package should be in: present | absent | latest | versionstring (1.0.3)
name: The package name as used by the packaging system

View file

@ -23,21 +23,28 @@
# system. # system.
# #
. cdist-config type="$__object/parameter/type"
if [ -f "$type" ]; then
object_id="$1"; shift type="$(cat "$type")"
if [ -f type ]; then
type="$(cat type)"
else else
# Default to value taken from explorer # By default determine package manager based on operating system
type="$(cat $__cdist_out_explorers/pkg_system)" os="$(cat "out/explorer/os")"
case "$os" in
archlinux) type="pacman" ;;
debian|ubuntu) type="apt" ;;
gentoo) type="emerge" ;;
*)
echo "Don't know how to manage packages on: $os" >&2
exit 1
;;
esac
fi fi
set -- "$@" "$object_id" set -- "$@" "$__object_id"
cd "$__object/parameter"
for property in $(ls .); do for property in $(ls .); do
if [ "$property" != "type" ]; then if [ "$property" != "type" ]; then
set -- "$@" "--$property" "$(cat $property)" set -- "$@" "--$property" "$(cat "$property")"
fi fi
done done

View file

@ -1,2 +1,3 @@
name name
version
type type

View file

@ -1 +1 @@
ensure state

View file

@ -22,7 +22,7 @@
# #
if [ -f "$__object/parameter/name" ]; then if [ -f "$__object/parameter/name" ]; then
name="$__object/parameter/name" name="$(cat "$__object/parameter/name")"
else else
name="$__object_id" name="$__object_id"
fi fi

View file

@ -21,18 +21,24 @@
# Manage packages on gentoo. # Manage packages on gentoo.
# #
. cdist-config if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
object_id="$1"; shift
if [ -f name ]; then
name="$(cat name)"
else else
name="$object_id" name="$__object_id"
fi fi
state="$(cat "$__object/parameter/state")"
# FIXME: super simple proof of concept case "$state" in
echo "emerge -q \"$name\"" installed)
# FIXME: only install if not already installed
echo "emerge -q \"$name\""
;;
deinstalled)
# FIXME: only uninstall if currently installed
# FIXME: rename deinstalled to uninstalled
echo "emerge -q -C \"$name\""
;;
esac
exit 0 exit 0

View file

@ -1,7 +0,0 @@
install/pacman:
pacman --noconfirm --noprogressbar -S
--------------------------------------------------------------------------------
ensure: What state the package should be in: present | absent | latest | versionstring (1.0.3)
name: The package name as used by the packaging system

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2010 Nico Schottelius (nico-cdist at schottelius.org) # 2011 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -18,15 +18,19 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# __package is an abstract type which dispatches to the lower level
# __package_$name types which do the actual interaction with the packaging
# system.
#
os="$("$__explorer/os")" # TODO: depend on package gentoolkit for qpkg
# TODO:
# if /var/cache/eix is older then /usr/portage/metadata/timestamp
# then run /usr/bin/eix-update
#
# check if package is installed:
#
# get currently installed version:
#
case "$os" in
archlinux) echo pacman ;;
debian|ubuntu) echo apt ;;
gentoo) echo emerge ;;
*)
echo "Unknown OS: $os" >&2
exit 1
;;
esac

View file

@ -1 +1,2 @@
name name
version

View file

@ -1 +1 @@
ensure state