diff --git a/add-crowdsec.sh b/add-crowdsec.sh index 3caa8e2..387d0a7 100755 --- a/add-crowdsec.sh +++ b/add-crowdsec.sh @@ -10,7 +10,7 @@ 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" | \ + 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 @@ -45,14 +45,19 @@ usage(){ echo "Usage: $0 [OPTIONS]"; echo "OPTIONS:"; echo " -s skip setup"; + echo " -x Proxy [protocol://]host[:port]"; } DO_SETUP=true; -while getopts ":s" OPT; do +SET_PROXY=; +while getopts ":sx:" OPT; do case $OPT in s) DO_SETUP=false; ;; + x) + SET_PROXY="-x $OPTARG"; + ;; ?) echo "Invalid Option: -$OPTARG"; usage; diff --git a/init.sh b/init.sh index 9fe04bc..b2aa123 100755 --- a/init.sh +++ b/init.sh @@ -80,7 +80,7 @@ Components: stable Signed-By: /etc/apt/trusted.gpg.d/docker.gpg Architectures: $OS_ARCH " | tee /etc/apt/sources.list.d/docker.sources - curl -fsSL $DOCKER_PGP | \ + curl -fsSL $DOCKER_PGP $SET_PROXY | \ gpg --dearmor | tee /etc/apt/trusted.gpg.d/docker.gpg > /dev/null #For docker-ctop @@ -91,7 +91,7 @@ Components: main Signed-By: /etc/apt/trusted.gpg.d/azlux-archive-keyring.gpg Architectures: $OS_ARCH " | tee /etc/apt/sources.list.d/azlux.sources - curl -fsSL "https://azlux.fr/repo.gpg.key" | \ + curl -fsSL "https://azlux.fr/repo.gpg.key" $SET_PROXY | \ gpg --dearmor | tee /etc/apt/trusted.gpg.d/azlux-archive-keyring.gpg > /dev/null echo -e "Types: deb @@ -101,7 +101,7 @@ Components: main Signed-By: /etc/apt/trusted.gpg.d/crowdsec-archive-keyring.gpg Architectures: $OS_ARCH " | tee /etc/apt/sources.list.d/crowdsec.sources - curl -fsSL "https://packagecloud.io/crowdsec/crowdsec/gpgkey" | \ + curl -fsSL "https://packagecloud.io/crowdsec/crowdsec/gpgkey" $SET_PROXY | \ gpg --dearmor | tee /etc/apt/trusted.gpg.d/crowdsec-archive-keyring.gpg > /dev/null fi } @@ -122,12 +122,14 @@ usage(){ echo " * official" echo " 1 cernet (default)" echo " 2 aliyun" + echo " -x Proxy [protocol://]host[:port]"; } PKG_BASE="$AWD/packages-base" DO_INSTALL=true; MIRROR_SOURCE=1; -while getopts ":f:sm:" OPT; do +SET_PROXY=; +while getopts ":f:sm:x:" OPT; do case $OPT in f) PKG_BASE=$OPTARG; @@ -138,6 +140,9 @@ while getopts ":f:sm:" OPT; do m) MIRROR_SOURCE=$OPTARG; ;; + x) + SET_PROXY="-x $OPTARG"; + ;; ?) echo "Invalid Option: -$OPTARG"; usage;