File: postrm

package info (click to toggle)
crowdsec 1.0.9-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 38,344 kB
  • sloc: sh: 1,597; makefile: 228
file content (30 lines) | stat: -rw-r--r-- 887 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e

CAPI=/etc/crowdsec/online_api_credentials.yaml
LAPI=/etc/crowdsec/local_api_credentials.yaml

if [ "$1" = purge ]; then
  # Might have been created by the postinst during CAPI registration,
  # or created by the admin to prevent CAPI registration. Keep only
  # this file if it doesn't seem to have been generated by the CAPI
  # registration. The rest of /etc/crowdsec goes away in all cases:
  if [ -f "$CAPI" ] && ! grep -qs '^url: https://api.crowdsec.net/$' "$CAPI"; then
    mv "$CAPI" /var/lib/crowdsec/online_api_credentials.yaml
    rm -rf /etc/crowdsec
    mkdir -p /etc/crowdsec
    mv /var/lib/crowdsec/online_api_credentials.yaml "$CAPI"
  else
    rm -rf /etc/crowdsec
  fi

  # Local config and hub:
  rm -rf /var/lib/crowdsec/data
  rm -rf /var/lib/crowdsec/hub

  # Logs:
  rm -f /var/log/crowdsec.log
  rm -f /var/log/crowdsec_api.log
fi

#DEBHELPER#