diff --git a/conf/explorer/hardware_type b/conf/explorer/hardware_type
index a28f6d08..5966b11e 100755
--- a/conf/explorer/hardware_type
+++ b/conf/explorer/hardware_type
@@ -22,13 +22,10 @@
#
#
-os="$(cat "$__global/explorer/os")"
+os="$($__explorer/os)"
case "$os" in
- archlinux)
- echo $(uname -m)
- ;;
- openbsd)
+ archlinux|*bsd)
echo $(uname -m)
;;
esac
diff --git a/conf/type/__package_pkg_openbsd/gencode-remote b/conf/type/__package_pkg_openbsd/gencode-remote
index a5756c8d..0ad85458 100755
--- a/conf/type/__package_pkg_openbsd/gencode-remote
+++ b/conf/type/__package_pkg_openbsd/gencode-remote
@@ -18,7 +18,7 @@
# along with cdist. If not, see .
#
#
-# Manage packages with Pacman (mostly archlinux)
+# Manage packages with pkg on OpenBSD
#
# Debug
@@ -26,7 +26,7 @@
# set -x
os_version="$(cat "$__global/explorer/os_version")"
-platform="$(cat "$__global/explorer/platform")"
+hardware_type="$(cat "$__global/explorer/hardware_type")"
if [ -f "$__object/parameter/flavor" ]; then
@@ -46,19 +46,40 @@ state="$(cat "$__object/parameter/state")"
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/$platform/
+echo export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$hardware_type/
case "$state" in
installed)
-
# Empty? Not installed.
if [ -z "$pkg_version" ]; then
- echo pkg_add "$pkgopts" \"$name--$flavor\"
+ # 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
;;
- uninstalled)
+ removed)
if [ "$pkg_version" ]; then
- echo pkg_delete "$pkgopts" \"$name--$flavor\"
+ # 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
+ exit 1
+ ;;
esac
diff --git a/conf/type/__package_pkg_openbsd/man.text b/conf/type/__package_pkg_openbsd/man.text
index 613c9045..32501ba8 100644
--- a/conf/type/__package_pkg_openbsd/man.text
+++ b/conf/type/__package_pkg_openbsd/man.text
@@ -1,6 +1,6 @@
cdist-type__package_pkg(7)
=============================
-Andreas Brönnimann
+Andi Brönnimann
NAME
@@ -16,7 +16,7 @@ This type is usually used on OpenBSD to manage packages.
REQUIRED PARAMETERS
-------------------
state::
- Either "installed" or "uninstalled".
+ Either "installed" or "removed".
OPTIONAL PARAMETERS
@@ -42,7 +42,7 @@ __package_pkg_openbsd vim --state installed --flavor no_x11
__package_pkg_openbsd python --state installed --name python2
# Remove obsolete package
-__package_pkg_openbsd puppet --state uninstalled
+__package_pkg_openbsd puppet --state removed
--------------------------------------------------------------------------------