#!/bin/sh
# syno-balance postinst — set up config, start daemon
PKG_DIR="/var/packages/syno-balance/target"
CONF="/etc/syno-balance/syno-balance.conf"
LOG_TAG="syno-balance"

log() { logger -t "$LOG_TAG" -p local0.warn "$*"; }

mkdir -p /etc/syno-balance "$PKG_DIR/var"

# If config doesn't exist, create from template
if [ ! -f "$CONF" ]; then
	cp "$PKG_DIR/etc/syno-balance.conf" "$CONF"
	log "config created from template"
fi

log "postinst complete"
exit 0
