Disks.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 13 Oct 2015 10:18:44 +0000 (12:18 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 13 Oct 2015 10:18:44 +0000 (12:18 +0200)
lxc.sh

diff --git a/lxc.sh b/lxc.sh
index fbbed84..d8c8864 100755 (executable)
--- a/lxc.sh
+++ b/lxc.sh
@@ -39,7 +39,7 @@ image() {
 setup() {
        cd ${IMAGE_FILE} || exit 1
 
-    cp -vp /etc/{resolv.conf,apt/sources.list,krb5.conf} ./etc/
+    cp -vp /etc/resolv.conf /etc/apt/sources.list /etc/krb5.conf ./etc/
     echo "pts/0" >> etc/securetty
 
        echo "${FACTER_hostname}" > etc/hostname
@@ -104,15 +104,23 @@ __EOF__
 
 
 xml() {
-       i=1
-       for d in ${DISKS}; do
-               XML_DISK="${XML_DISK}
-    <filesystem type='block' accessmode='passthrough'>
-      <source dev='${d}'/>
-      <target dir='/data/${i}'/>
-    </filesystem>"
-               i=$((i+1))
-       done
+    if -n "${DISKS}"; then
+               i=1
+        if echo ${DISKS} | grep -q '^/dev/sda'; then
+            src_i=1
+        else
+            src_i=7
+        fi
+               for d in ${DISKS}; do
+                       XML_DISK="${XML_DISK}
+        <filesystem type='mount' accessmode='passthrough'>
+          <source dir='/data/${src_i}'/>
+          <target dir='/data/${i}'/>
+        </filesystem>"
+                       i=$((i+1))
+                       src_i=$((src_i+1))
+               done
+    fi
        if [ -n "${XENBR}" ]; then
                XML_NET="
     <interface type='bridge'>