Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions debian/crowdsec-hubupdate.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,5 @@ Description=CrowdSec Hub update
[Service]
Type=oneshot
Environment=LC_ALL=C LANG=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=/bin/sh -ceu '
test -x /usr/bin/cscli || exit 0

/usr/bin/cscli --error hub update >/dev/null

upgraded="$(/usr/bin/cscli --error hub upgrade)"
if [ -n "$upgraded" ]; then
systemctl reload crowdsec.service
fi
'
ExecStart=/usr/lib/crowdsec/hubupdate.sh

12 changes: 12 additions & 0 deletions debian/hubupdate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -eu

test -x /usr/bin/cscli || exit 0

/usr/bin/cscli --error hub update >/dev/null

upgraded="$(/usr/bin/cscli --error hub upgrade)"
if [ -n "$upgraded" ]; then
systemctl reload crowdsec.service
fi
2 changes: 2 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ if [ "$1" = configure ]; then

systemctl --quiet is-enabled crowdsec || systemctl unmask crowdsec && systemctl enable crowdsec

systemctl enable --now crowdsec-hubupdate.timer >/dev/null 2>&1 || true

LAPI=true
API=$(cscli config show --key "Config.API.Server")
if [ "$API" = "nil" ] ; then
Expand Down
6 changes: 6 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ override_dh_auto_install:
cp config/console.yaml debian/crowdsec/etc/crowdsec/console.yaml
cp -a config/patterns debian/crowdsec/etc/crowdsec
cp config/detect.yaml debian/crowdsec/var/lib/crowdsec/data/detect.yaml
install -m 755 debian/hubupdate.sh debian/crowdsec/usr/lib/crowdsec/hubupdate.sh

override_dh_fixperms:
dh_fixperms
chmod 600 debian/crowdsec/etc/crowdsec/notifications/*
chmod 600 debian/crowdsec/etc/crowdsec/config.yaml

override_dh_installsystemd:
install -D -m 644 debian/crowdsec-hubupdate.service debian/crowdsec/usr/lib/systemd/system/crowdsec-hubupdate.service
install -D -m 644 debian/crowdsec-hubupdate.timer debian/crowdsec/usr/lib/systemd/system/crowdsec-hubupdate.timer
dh_installsystemd
1 change: 1 addition & 0 deletions rpm/SPECS/crowdsec.spec
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ mkdir -p %{buildroot}%{_libdir}/%{name}/plugins/

install -m 755 -D cmd/crowdsec/crowdsec %{buildroot}%{_bindir}/%{name}
install -m 755 -D cmd/crowdsec-cli/cscli %{buildroot}%{_bindir}/cscli
install -m 755 -D debian/hubupdate.sh %{buildroot}%{_libdir}/%{name}/
install -m 644 -D debian/crowdsec.service %{buildroot}%{_unitdir}/%{name}.service
install -m 644 -D debian/crowdsec-hubupdate.service %{buildroot}%{_unitdir}/%{name}-hubupdate.service
install -m 644 -D debian/crowdsec-hubupdate.timer %{buildroot}%{_unitdir}/%{name}-hubupdate.timer
Expand Down