#!/bin/bash

set -x

VERSION=1
SERVICE="Minio"

. /usr/share/univention-join/joinscripthelper.lib
. /usr/share/univention-appcenter/joinscripthelper.sh
. /usr/share/univention-lib/base.sh

joinscript_init
eval "$(ucr shell)"

DATADIR="/var/lib/univention-appcenter/apps/minio/data"

# add custom ports to firewall
ucr set \
	security/packetfilter/package/mattermost/tcp/8345/all="ACCEPT" \
	ecurity/packetfilter/package/mattermost/tcp/8345/all/en="Minio http" \
	security/packetfilter/package/mattermost/tcp/8456/all="ACCEPT" \
	security/packetfilter/package/mattermost/tcp/8456/all/en="Minio https" \
[ -x "/etc/init.d/univention-firewall" ] && invoke-rc.d univention-firewall restart

ucs_addServiceToLocalhost "${SERVICE}" "$@"

joinscript_save_current_version
exit 0
