[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Take advantage of the jail_XXX_ip_mutliX variables



Hello again, list,

After the previous patch, please also consider [1], which utilizes the
jail_XXX_ip_multiY feature. After looking at it and at the result I
was no longer sure of its usefulness; however, I can see[2] that some
people would be glad to have all those IPs splitted over the
_ip_multiX vars, so there *is* a case for this patch. Do what you want
with this one.

[2] https://elektropost.org/ezjail/msg00554.html

-- 
Fred

[1]
--- ezjail-admin.orig   2010-04-23 21:04:38.000000000 +0200
+++ ezjail-admin        2010-04-23 22:03:55.000000000 +0200
@@ -159,7 +159,18 @@
   fi
   
   echo export jail_${ezjail_safename}_hostname=\"${ezjail_hostname}\"
-  echo export jail_${ezjail_safename}_ip=\"${ezjail_ips}\"
+  TIFS=$IFS
+  IFS=,
+  i="-1"
+  for ezjail_ip in ${ezjail_ips}; do
+    if [ $i -lt 0 ]; then
+      echo export jail_${ezjail_safename}_ip=\"${ezjail_ip}\"
+    else
+      echo export jail_${ezjail_safename}_ip_multi${i}=\"${ezjail_ip}\"
+    fi
+    i=$((${i} + 1))
+  done
+  IFS=$TIFS
   echo export jail_${ezjail_safename}_rootdir=\"${ezjail_rootdir}\"
   echo export jail_${ezjail_safename}_exec_start=\"${ezjail_exec_start}\"
   echo export jail_${ezjail_safename}_exec_stop=\"${ezjail_exec_stop}\"


-- 
Fred