#!/bin/sh

os=$(cat "$__global/explorer/os")

case "$os" in
    alpine)
        os_pkgs="netcat-openbsd and tshark"
    ;;
    debian|devuan)
        os_pkgs="netcat tshark"
    ;;
    fedora)
        os_pkgs="nmap-ncat wireshark-cli"
    ;;
    *)
        echo "OS $os currently not supported" >&2
        exit 1
    ;;
esac

base_pkgs="socat sipcalc sudo"


if [! -f ${__object}/parameter/with-x ]; then
    for bpkg in ${base_pkgs}; do
	__package ${bpkg} --state present
    done

    for opkg in ${os_pkgs}; do
        __package ${opkg} --state present
    done
fi

if [ -f "$__object/parameter/extra-packages" ]; then
   for epkg in $(cat $__object/parameter/extra-packages); do
      __package $epkg --state present
   done
fi
