This commit is contained in:
hl committed 2026-01-29 01:57:09 +08:00
1 parent ecd39d2098
commit b0fb358124
1 file changed
+7 -28
+7 -28
View File
@@ -1,22 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
OS_ARCH=$(dpkg --print-architecture) || (echo "Not Debian Based Distro" && exit 1)
OS_CODE=$(source /etc/os-release && echo "$VERSION_CODENAME")
SCRIPT=$(readlink -f "$0")
AWD=$(dirname "$SCRIPT")
main(){
echo "deb https://packagecloud.io/crowdsec/crowdsec/debian/ $OS_CODE main" | \
tee /etc/apt/sources.list.d/crowdsec_crowdsec.list
curl -fsSL "https://packagecloud.io/crowdsec/crowdsec/gpgkey" $SET_PROXY | \
gpg --dearmor | tee /etc/apt/trusted.gpg.d/crowdsec_crowdsec-archive-keyring.gpg > /dev/null
echo "crowdsec crowdsec-firewall-bouncer-iptables" | $AWD/install.sh
}
setup(){ setup(){
echo "crowdsec crowdsec-firewall-bouncer-iptables" | $AWD/install.sh
echo -e "db_config: echo -e "db_config:
use_wal: true" | tee /etc/crowdsec/config.yaml.local use_wal: true" | tee /etc/crowdsec/config.yaml.local
@@ -44,19 +32,13 @@ whitelist:
usage(){ usage(){
echo "Usage: $0 [OPTIONS]"; echo "Usage: $0 [OPTIONS]";
echo "OPTIONS:"; echo "OPTIONS:";
echo " -s skip setup"; echo " -h show this help";
echo " -x <PROXY> Proxy [protocol://]host[:port]";
} }
DO_SETUP=true; while getopts ":h" OPT; do
SET_PROXY=;
while getopts ":sx:" OPT; do
case $OPT in case $OPT in
s) h)
DO_SETUP=false; usage;
;;
x)
SET_PROXY="-x $OPTARG";
;; ;;
?) ?)
echo "Invalid Option: -$OPTARG"; echo "Invalid Option: -$OPTARG";
@@ -65,7 +47,4 @@ while getopts ":sx:" OPT; do
esac; esac;
done; done;
main setup;
if $DO_SETUP; then
setup
fi;