[Devel] scripts: use absolute binaries paths nfs-ports-allow.sh

Submitted by Stanislav Kinsburskiy on June 1, 2017, 3 p.m.

Details

Message ID 20170601145616.556345.44860.stgit@skinsbursky-vz7.qa.sw.ru
State New
Series "scripts: use absolute binaries paths nfs-ports-allow.sh"
Headers show

Commit Message

Stanislav Kinsburskiy June 1, 2017, 3 p.m.
That's the way to support multiple distributions.

https://jira.sw.ru/browse/PSBM-66901

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 scripts/nfs-ports-allow.sh |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

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

Comments

Dmitry Safonov June 1, 2017, 6:31 p.m.
On 06/01/2017 06:00 PM, Stanislav Kinsburskiy wrote:
> That's the way to support multiple distributions.
> 
> https://jira.sw.ru/browse/PSBM-66901
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
> ---
>   scripts/nfs-ports-allow.sh |   21 ++++++++++++---------
>   1 file changed, 12 insertions(+), 9 deletions(-)

Applied to vz-criu, released in criu-3.0.0.7-1.vz7