#!/usr/bin/with-contenv bash

# copy config
if [[ ! -e /config/diskover.conf.d ]]; then
	cp -r /app/diskover/configs_sample /config/diskover.conf.d
fi

ls /config/diskover.conf.d | \
    xargs -I {} \
    ln -sf /config/diskover.conf.d/{} /etc/{}

# install crontab
[[ ! -e "/config/crontab" ]] && \
    cp /defaults/crontabs/abc /config/crontab

crontab -u abc /config/crontab

chown -R abc:abc /config
