From 8e8ece4a7c3f96199f391e220848c2c9615f9002 Mon Sep 17 00:00:00 2001
From: Dimitris Aragiorgis <dimara@grnet.gr>
Date: Fri, 4 Apr 2014 14:46:15 +0300
Subject: [PATCH] Use env var for state dir

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
---
 common.sh  | 6 +++---
 ifup-extra | 9 ++++-----
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/common.sh b/common.sh
index 6fa773e..73418bf 100755
--- a/common.sh
+++ b/common.sh
@@ -43,13 +43,13 @@ function try {
 
 function clear_log {
 
-  rm -f /var/lib/snf-network/$INTERFACE
+  rm -f $STATE_DIR/$INTERFACE
 
 }
 
 function init_log {
 
-    cat > /var/lib/snf-network/$INTERFACE <<EOF
+    cat > $STATE_DIR/$INTERFACE <<EOF
 INSTANCE=$INSTANCE
 IP=$IP
 EUI64=$EUI64
@@ -64,7 +64,7 @@ EOF
 
 function log {
 
-  echo $@ >> /var/lib/snf-network/$INTERFACE
+  echo $@ >> $STATE_DIR/$INTERFACE
 
 }
 
diff --git a/ifup-extra b/ifup-extra
index 71966b3..d1dc9d2 100755
--- a/ifup-extra
+++ b/ifup-extra
@@ -96,11 +96,10 @@ function setup_extra () {
 
 function save_all_tables () {
 
-  mkdir -p /etc/iptables
-  date > /etc/iptables/date
-  iptables-save > /etc/iptables/snf-network.v4
-  ip6tables-save > /etc/iptables/snf-network.v6
-  arptables-save > /etc/iptables/snf-network.arp
+  date > $STATE_DIR/date
+  iptables-save > $STATE_DIR/snf-network.v4
+  ip6tables-save > $STATE_DIR/snf-network.v6
+  arptables-save > $STATE_DIR/snf-network.arp
 
 }
 
-- 
GitLab