Merge remote-tracking branch 'sans/master'
This commit is contained in:
commit
baea18be5f
11 changed files with 56 additions and 50 deletions
|
@ -20,13 +20,14 @@ case "$__target_host" in
|
|||
__package_pacman wireshark-cli --state installed
|
||||
__package_pacman zsh --state installed
|
||||
;;
|
||||
cdist-gentoo)
|
||||
__package tree --state installed
|
||||
;;
|
||||
|
||||
# Real machines
|
||||
ikq*)
|
||||
__package_apt zsh --state installed
|
||||
;;
|
||||
|
||||
icarus)
|
||||
__package tree --ensure installed
|
||||
;;
|
||||
|
||||
esac
|
||||
|
|
|
@ -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
|
||||
|
|
@ -23,21 +23,28 @@
|
|||
# system.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
|
||||
object_id="$1"; shift
|
||||
|
||||
if [ -f type ]; then
|
||||
type="$(cat type)"
|
||||
type="$__object/parameter/type"
|
||||
if [ -f "$type" ]; then
|
||||
type="$(cat "$type")"
|
||||
else
|
||||
# Default to value taken from explorer
|
||||
type="$(cat $__cdist_out_explorers/pkg_system)"
|
||||
# By default determine package manager based on operating 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
|
||||
|
||||
set -- "$@" "$object_id"
|
||||
set -- "$@" "$__object_id"
|
||||
cd "$__object/parameter"
|
||||
for property in $(ls .); do
|
||||
if [ "$property" != "type" ]; then
|
||||
set -- "$@" "--$property" "$(cat $property)"
|
||||
set -- "$@" "--$property" "$(cat "$property")"
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
name
|
||||
version
|
||||
type
|
||||
|
|
|
@ -1 +1 @@
|
|||
ensure
|
||||
state
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#
|
||||
|
||||
if [ -f "$__object/parameter/name" ]; then
|
||||
name="$__object/parameter/name"
|
||||
name="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
name="$__object_id"
|
||||
fi
|
||||
|
|
|
@ -21,18 +21,24 @@
|
|||
# Manage packages on gentoo.
|
||||
#
|
||||
|
||||
. cdist-config
|
||||
|
||||
object_id="$1"; shift
|
||||
|
||||
if [ -f name ]; then
|
||||
name="$(cat name)"
|
||||
if [ -f "$__object/parameter/name" ]; then
|
||||
name="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
name="$object_id"
|
||||
name="$__object_id"
|
||||
fi
|
||||
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
|
||||
# FIXME: super simple proof of concept
|
||||
case "$state" in
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2010 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
|
@ -18,15 +18,19 @@
|
|||
# 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
|
|
@ -1 +1,2 @@
|
|||
name
|
||||
version
|
||||
|
|
|
@ -1 +1 @@
|
|||
ensure
|
||||
state
|
||||
|
|
Loading…
Reference in a new issue