Commit 6ae9ea0 1 parent dc4dd9b commit 6ae9ea0 Copy full SHA for 6ae9ea0
File tree 3 files changed +19
-12
lines changed
3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -eu
4
+
5
+ BOUNCER=" crowdsec-custom-bouncer"
6
+ CONFIG=" /etc/crowdsec/bouncers/$BOUNCER .yaml"
7
+
8
+ if [ " $1 " = " purge" ]; then
9
+ if [ -f " $CONFIG .id" ]; then
10
+ bouncer_id=$( cat " $CONFIG .id" )
11
+ cscli -oraw bouncers delete " $bouncer_id " 2> /dev/null || true
12
+ rm -f " $CONFIG .id"
13
+ fi
14
+ fi
Original file line number Diff line number Diff line change 4
4
5
5
BOUNCER=" crowdsec-custom-bouncer"
6
6
7
- # shellcheck source=./scripts/_bouncer.sh
8
- . " /usr/lib/$DPKG_MAINTSCRIPT_PACKAGE /_bouncer.sh"
9
-
10
- systemctl stop " $SERVICE " || echo " cannot stop service"
11
- systemctl disable " $SERVICE " || echo " cannot disable service"
12
-
13
- if [ " $1 " = " purge" ]; then
14
- delete_bouncer
15
- fi
7
+ systemctl stop " $BOUNCER " || echo " cannot stop service"
8
+ systemctl disable " $BOUNCER " || echo " cannot disable service"
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ config_not_set() {
89
89
90
90
before=$( cat " $CONFIG " )
91
91
# shellcheck disable=SC2016
92
- after=$( envsubst ' \$$varname' < " $CONFIG " )
92
+ after=$( envsubst " \$ $varname " < " $CONFIG " )
93
93
94
94
if [ " $before " = " $after " ]; then
95
95
return 1
@@ -99,9 +99,9 @@ config_not_set() {
99
99
100
100
need_api_key () {
101
101
if config_not_set ' API_KEY' ; then
102
- return 1
102
+ return 0
103
103
fi
104
- return 0
104
+ return 1
105
105
}
106
106
107
107
# Interpolate a variable in the config file with a value.
You can’t perform that action at this time.
0 commit comments