File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,41 @@ SYSTEMD_PATH_FILE="/etc/systemd/system/crowdsec-custom-bouncer.service"
77API_KEY=" "
88BINARY_PATH=" "
99
10+ usage () {
11+ echo " Usage: ./install.sh [options]"
12+ echo " -h|--help Display this help message."
13+ echo " -b|--binary <path> Specify the binary path"
14+
15+ exit 0
16+ }
17+
18+ while [[ $# -gt 0 ]]
19+ do
20+ key=" ${1} "
21+ case ${key} in
22+ -b|--binary)
23+ if ! [ -f " ${2} " ]; then
24+ echo " ${key} need a path"
25+ usage
26+ exit 1
27+ fi
28+ BINARY_PATH=" $2 "
29+ shift # past argument
30+ BINARY_PATH=$( readlink -f $BINARY_PATH )
31+ shift
32+ ;;
33+ -h|--help)
34+ usage
35+ exit 0
36+ ;;
37+ * ) # unknown option
38+ echo " Unknown argument ${key} ."
39+ usage
40+ exit 1
41+ ;;
42+ esac
43+ done
44+
1045gen_apikey () {
1146 which cscli > /dev/null
1247 if [[ $? == 0 ]]; then
4883echo " Installing crowdsec-custom-bouncer"
4984install_custom_bouncer
5085gen_apikey
51- gen_binary_path
86+ if ! [ -f " $BINARY_PATH " ]; then
87+ gen_binary_path
88+ fi
5289gen_config_file
5390systemctl enable crowdsec-custom-bouncer.service
5491if ! [ -f " $BINARY_PATH " ]; then
You can’t perform that action at this time.
0 commit comments