Skip to content

Commit

Permalink
docker_helper.sh: Fix install iptables hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Markson Hon committed Dec 16, 2023
1 parent c5979fd commit 9775d89
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 29 deletions.
19 changes: 8 additions & 11 deletions install/docker/docker_helper.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh
set -x
current_dir=$(pwd)
mkdir "$current_dir"/cache && cd "$current_dir"/cache || exit
case "$(arch)" in
x86_64)
v2ray_arch="64"
Expand Down Expand Up @@ -33,14 +32,12 @@ ln -s /usr/local/share/v2raya /usr/local/share/xray
wget -O /usr/local/share/v2raya/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat
wget -O /usr/local/share/v2raya/geosite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat
wget -O /usr/local/share/v2raya/geoip.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geoip.dat
cd "$current_dir" && rm -rf "$current_dir"/cache
apk add --no-cache tzdata iptables-legacy nftables
cd ..
cd "$current_dir" || exit
rm -rf build
[ -d /usr/local/sbin ] || mkdir -p /usr/local/sbin
install ./iptables.sh /usr/local/sbin/iptables
install ./ip6tables.sh /usr/local/sbin/ip6tables
install ./iptables.sh /usr/local/sbin/iptables-nft
install ./ip6tables.sh /usr/local/sbin/ip6tables-nft
install ./iptables.sh /usr/local/sbin/iptables-legacy
install ./ip6tables.sh /usr/local/sbin/ip6tables-legacy
apk add --no-cache iptables iptables-legacy nftables tzdata
install ./iptables.sh /usr/local/bin/iptables
install ./ip6tables.sh /usr/local/bin/ip6tables
install ./iptables.sh /usr/local/bin/iptables-nft
install ./ip6tables.sh /usr/local/bin/ip6tables-nft
install ./iptables.sh /usr/local/bin/iptables-legacy
install ./ip6tables.sh /usr/local/bin/ip6tables-legacy
16 changes: 7 additions & 9 deletions install/docker/ip6tables.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/sh

if [ "$V2RAYA_NFTABLES_SUPPORT" != on ]; then
if [ "$IPTABLES_MODE" = "nftables" ]; then
/sbin/ip6tables-nft "$@"
elif [ "$IPTABLES_MODE" = "legacy" ]; then
/sbin/ip6tables-legacy "$@"
else
/sbin/ip6tables "$@"
fi
fi
if [ "$IPTABLES_MODE" = "nftables" ]; then
/sbin/ip6tables-nft "$@"
elif [ "$IPTABLES_MODE" = "legacy" ]; then
/sbin/ip6tables-legacy "$@"
else
/sbin/ip6tables "$@"
fi
16 changes: 7 additions & 9 deletions install/docker/iptables.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/sh

if [ "$V2RAYA_NFTABLES_SUPPORT" != on ]; then
if [ "$IPTABLES_MODE" = "nftables" ]; then
/sbin/iptables-nft "$@"
elif [ "$IPTABLES_MODE" = "legacy" ]; then
/sbin/iptables-legacy "$@"
else
/sbin/iptables "$@"
fi
fi
if [ "$IPTABLES_MODE" = "nftables" ]; then
/sbin/iptables-nft "$@"
elif [ "$IPTABLES_MODE" = "legacy" ]; then
/sbin/iptables-legacy "$@"
else
/sbin/iptables "$@"
fi

0 comments on commit 9775d89

Please sign in to comment.