That's the way to support multiple distributions. https://jira.sw.ru/browse/PSBM-66901
Signed-off-by: Stanislav Kinsburskiy <[email protected]> --- scripts/nfs-ports-allow.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/nfs-ports-allow.sh b/scripts/nfs-ports-allow.sh index b16a788..97541dc 100644 --- a/scripts/nfs-ports-allow.sh +++ b/scripts/nfs-ports-allow.sh @@ -25,7 +25,10 @@ JOIN_CT="${NS_ENTER} -t $CRTOOLS_INIT_PID -m -u -p -n" ${JOIN_CT} test -e /proc/self/net/nfsfs || exit 0 -servers=$($JOIN_CT cat /proc/self/net/nfsfs/servers | sed -e '1d' | awk '{ printf $5" ";}') +IPTABLES=/sbin/iptables +CAT=/bin/cat + +servers=$($JOIN_CT ${CAT} /proc/self/net/nfsfs/servers | sed -e '1d' | awk '{ printf $5" ";}') [ -n "$servers" ] || exit 0 @@ -33,10 +36,10 @@ function add_accept_rules { local server=$1 local port=$2 - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT && - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT && - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT && - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT && + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT && + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT && + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT } function iptables_allow_nfs_ports { @@ -60,10 +63,10 @@ function allow_portmapper_port { local server=$1 local port=111 - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT && - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT && - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT && - ${JOIN_CT} iptables -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p udp -s $server --sport $port -j ACCEPT && + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p udp -d $server --dport $port -j ACCEPT && + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -s $server --sport $port -j ACCEPT && + ${JOIN_CT} ${IPTABLES} -I ${CRTOOLS_IPTABLES_TABLE} -p tcp -d $server --dport $port -j ACCEPT } for s in $servers; do _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
