File prepare-crowdsec of Package crowdsec
#!/usr/bin/sh
# License: MIT
if [ ! -f "/var/lib/crowdsec/data/crowdsec.db" ] ; then
touch /var/lib/crowdsec/data/crowdsec.db
fi
if [ ! -f "/etc/crowdsec/online_api_credentials.yaml" ] ; then
install -m0600 /dev/null /etc/crowdsec/online_api_credentials.yaml
/usr/bin/cscli capi register --error
fi
if [ ! -f "/etc/crowdsec/local_api_credentials.yaml" ] ; then
install -m0600 /dev/null /etc/crowdsec/local_api_credentials.yaml
/usr/bin/cscli machines add -a --force --error
fi
/usr/bin/cscli hub update