forked from ungleich-public/cdist
begin changes to __package_luarocks and __package_pkg_openbsd
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
3c19e7ab4c
commit
1713a70428
3 changed files with 46 additions and 30 deletions
|
@ -31,7 +31,6 @@ state_should="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
# Correct pre 2.1 naming - FIXME in 2.1
|
# Correct pre 2.1 naming - FIXME in 2.1
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
# FIXME: print warning to stderr!
|
|
||||||
installed)
|
installed)
|
||||||
echo "WARNING: $state_should is deprecated, please change to present/absent (will be removed in cdist 2.1)" >&2
|
echo "WARNING: $state_should is deprecated, please change to present/absent (will be removed in cdist 2.1)" >&2
|
||||||
state_should="present"
|
state_should="present"
|
||||||
|
|
|
@ -29,7 +29,7 @@ else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
state="$(cat "$__object/parameter/state")"
|
state_should="$(cat "$__object/parameter/state")"
|
||||||
is_installed="$(grep "(installed)" "$__object/explorer/pkg_status" || true)"
|
is_installed="$(grep "(installed)" "$__object/explorer/pkg_status" || true)"
|
||||||
|
|
||||||
case "$state" in
|
case "$state" in
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2011 Andi Brönnimann (andi-cdist at v-net.ch)
|
# 2011 Andi Brönnimann (andi-cdist at v-net.ch)
|
||||||
|
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -42,16 +43,34 @@ else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
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")"
|
pkg_version="$(cat "$__object/explorer/pkg_version")"
|
||||||
|
|
||||||
# TODO: Shouldn't be hardcoded
|
# TODO: Shouldn't be hardcoded
|
||||||
echo export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$machine/
|
echo export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$machine/
|
||||||
|
|
||||||
case "$state" in
|
if [ "$pkg_version" ]; then
|
||||||
installed)
|
state_is="present"
|
||||||
# Empty? Not installed.
|
else
|
||||||
if [ -z "$pkg_version" ]; then
|
state_is="absent"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "$state_is" = "$state_should" ] && exit 0
|
||||||
|
|
||||||
|
case "$state_should" in
|
||||||
|
present)
|
||||||
# use this because pkg_add doesn't properly handle errors
|
# use this because pkg_add doesn't properly handle errors
|
||||||
cat << eof
|
cat << eof
|
||||||
status=\$(pkg_add "$pkgopts" "$name--$flavor")
|
status=\$(pkg_add "$pkgopts" "$name--$flavor")
|
||||||
|
@ -62,10 +81,9 @@ case "$state" in
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
eof
|
eof
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
removed)
|
|
||||||
if [ "$pkg_version" ]; then
|
absent)
|
||||||
# use this because pkg_add doesn't properly handle errors
|
# use this because pkg_add doesn't properly handle errors
|
||||||
cat << eof
|
cat << eof
|
||||||
status=\$(pkg_delete "$pkgopts" "$name--$flavor")
|
status=\$(pkg_delete "$pkgopts" "$name--$flavor")
|
||||||
|
@ -76,10 +94,9 @@ eof
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
eof
|
eof
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown state: $state" >&2
|
echo "Unknown state: $state_should" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue