begin changes to __package_luarocks and __package_pkg_openbsd

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
remotes/origin/feature_files_export
Nico Schottelius 13 years ago
parent 3c19e7ab4c
commit 1713a70428
  1. 1
      conf/type/__package_apt/gencode-remote
  2. 2
      conf/type/__package_luarocks/gencode-remote
  3. 71
      conf/type/__package_pkg_openbsd/gencode-remote

@ -31,7 +31,6 @@ state_should="$(cat "$__object/parameter/state")"
# Correct pre 2.1 naming - FIXME in 2.1
case "$state_should" in
# FIXME: print warning to stderr!
installed)
echo "WARNING: $state_should is deprecated, please change to present/absent (will be removed in cdist 2.1)" >&2
state_should="present"

@ -29,7 +29,7 @@ else
name="$__object_id"
fi
state="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
is_installed="$(grep "(installed)" "$__object/explorer/pkg_status" || true)"
case "$state" in

@ -1,6 +1,7 @@
#!/bin/sh
#
# 2011 Andi Brönnimann (andi-cdist at v-net.ch)
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.
#
@ -42,44 +43,60 @@ else
name="$__object_id"
fi
state="$(cat "$__object/parameter/state")"
state_should="$(cat "$__object/parameter/state")"
# Correct pre 2.1 naming - FIXME in 2.1
case "$state_should" in
installed)
echo "WARNING: $state_should is deprecated, please change to present/absent (will be removed in cdist 2.1)" >&2
state_should="present"
;;
removed)
echo "WARNING: $state_should is deprecated, please change to present/absent (will be removed in cdist 2.1)" >&2
state_should="absent"
;;
esac
pkg_version="$(cat "$__object/explorer/pkg_version")"
# TODO: Shouldn't be hardcoded
echo export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$machine/
case "$state" in
installed)
# Empty? Not installed.
if [ -z "$pkg_version" ]; then
# use this because pkg_add doesn't properly handle errors
cat << eof
status=\$(pkg_add "$pkgopts" "$name--$flavor")
if [ "$pkg_version" ]; then
state_is="present"
else
state_is="absent"
fi
[ "$state_is" = "$state_should" ] && exit 0
# no error
if [ -n "\$status" ]; then
echo "Error: \$status"
exit 1
fi
case "$state_should" in
present)
# use this because pkg_add doesn't properly handle errors
cat << eof
status=\$(pkg_add "$pkgopts" "$name--$flavor")
# no error
if [ -n "\$status" ]; then
echo "Error: \$status"
exit 1
fi
eof
fi
;;
removed)
if [ "$pkg_version" ]; then
# use this because pkg_add doesn't properly handle errors
cat << eof
status=\$(pkg_delete "$pkgopts" "$name--$flavor")
;;
# no error
if [ -n "\$status" ]; then
echo "Error: \$status"
exit 1
fi
absent)
# use this because pkg_add doesn't properly handle errors
cat << eof
status=\$(pkg_delete "$pkgopts" "$name--$flavor")
# no error
if [ -n "\$status" ]; then
echo "Error: \$status"
exit 1
fi
eof
fi
;;
*)
echo "Unknown state: $state" >&2
echo "Unknown state: $state_should" >&2
exit 1
;;
esac

Loading…
Cancel
Save