From c707b72b0356ef556d1fae12aac7bdd130fb858d Mon Sep 17 00:00:00 2001 From: Manuel Sabban Date: Fri, 8 Dec 2023 12:10:23 +0100 Subject: [PATCH] fix lapi credentials creation for debian package (#2646) * fix lapi credentials creation for package s --------- Co-authored-by: mmetc <92726601+mmetc@users.noreply.github.com> --- debian/postinst | 2 +- rpm/SPECS/crowdsec.spec | 10 +--------- windows/installer/product.wxs | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/debian/postinst b/debian/postinst index a862c8875..093e3e34e 100644 --- a/debian/postinst +++ b/debian/postinst @@ -58,7 +58,7 @@ if [ "$1" = configure ]; then db_get crowdsec/capi CAPI=$RET - cscli machines add -a + [ -s /etc/crowdsec/local_api_credentials.yaml ] || cscli machines add -a --force if [ "$CAPI" = true ]; then cscli capi register diff --git a/rpm/SPECS/crowdsec.spec b/rpm/SPECS/crowdsec.spec index 5a3980651..06a721aba 100644 --- a/rpm/SPECS/crowdsec.spec +++ b/rpm/SPECS/crowdsec.spec @@ -167,19 +167,11 @@ if [ $1 == 1 ]; then SILENT=true TMP_ACQUIS_FILE_SKIP=skip genacquisition set +e fi - if [ ! -f "%{_sysconfdir}/crowdsec/online_api_credentials.yaml" ] && [ ! -f "%{_sysconfdir}/crowdsec/local_api_credentials.yaml" ] ; then - install -m 600 /dev/null %{_sysconfdir}/crowdsec/online_api_credentials.yaml - install -m 600 /dev/null %{_sysconfdir}/crowdsec/local_api_credentials.yaml - cscli capi register - cscli machines add -a - fi if [ ! -f "%{_sysconfdir}/crowdsec/online_api_credentials.yaml" ] ; then - touch %{_sysconfdir}/crowdsec/online_api_credentials.yaml cscli capi register fi if [ ! -f "%{_sysconfdir}/crowdsec/local_api_credentials.yaml" ] ; then - touch %{_sysconfdir}/crowdsec/local_api_credentials.yaml - cscli machines add -a + cscli machines add -a --force fi cscli hub update diff --git a/windows/installer/product.wxs b/windows/installer/product.wxs index 0696da34b..a0c1ea11e 100644 --- a/windows/installer/product.wxs +++ b/windows/installer/product.wxs @@ -143,7 +143,7 @@ - +