update to work with new tree layout and variables

Signed-off-by: Steven Armstrong <steven.armstrong@inf.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-03-03 08:39:37 +01:00
parent fe5e0c7541
commit 0d88bccead
5 changed files with 53 additions and 17 deletions

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

@ -0,0 +1,36 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
#
# __package is an abstract type which dispatches to the lower level
# __package_$name types which do the actual interaction with the packaging
# system.
#
# 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:
#

View file

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

View file

@ -1 +1 @@
ensure state