|
|
|
@ -18,7 +18,7 @@ |
|
|
|
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
# |
|
|
|
|
# |
|
|
|
|
# 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 |
|
|
|
|