Most scripts don't check if required parameter 'name' is
specified and proceed without it, which results in using an
unexpected directory /var/lib/lxc/ while we expect
to use /var/lib/lxc/NAME/.

Signed-off-by: Ryota Ozaki <ozaki.ry...@gmail.com>
---
 templates/lxc-altlinux.in     | 5 +++++
 templates/lxc-busybox.in      | 5 +++++
 templates/lxc-debian.in       | 5 +++++
 templates/lxc-fedora.in       | 5 +++++
 templates/lxc-opensuse.in     | 5 +++++
 templates/lxc-sshd.in         | 5 +++++
 templates/lxc-ubuntu-cloud.in | 5 +++++
 templates/lxc-ubuntu.in       | 5 +++++
 8 files changed, 40 insertions(+)

diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in
index fac545c..f2c3fc6 100644
--- a/templates/lxc-altlinux.in
+++ b/templates/lxc-altlinux.in
@@ -393,6 +393,11 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     path=$default_path
 fi
diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
index cb425ec..a2a2f7c 100644
--- a/templates/lxc-busybox.in
+++ b/templates/lxc-busybox.in
@@ -291,6 +291,11 @@ if [ "$(id -u)" != "0" ]; then
     exit 1
 fi
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     echo "'path' parameter is required"
     exit 1
diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index 7bbc46b..71f0c57 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -302,6 +302,11 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     echo "'path' parameter is required"
     exit 1
diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 684bb9c..53bfa9e 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -369,6 +369,11 @@ if [ -n "$needed_pkgs" ]; then
     exit 1
 fi
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     path=$default_path
 fi
diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 77ef6b2..5081072 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -372,6 +372,11 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     echo "'path' parameter is required"
     exit 1
diff --git a/templates/lxc-sshd.in b/templates/lxc-sshd.in
index b704723..d6364e0 100644
--- a/templates/lxc-sshd.in
+++ b/templates/lxc-sshd.in
@@ -202,6 +202,11 @@ EOF
     exit 1
 fi
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     echo "'path' parameter is required"
     exit 1
diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in
index 8673e4c..313d503 100644
--- a/templates/lxc-ubuntu-cloud.in
+++ b/templates/lxc-ubuntu-cloud.in
@@ -255,6 +255,11 @@ if [ -n "$auth_key" ]; then
         { echo "failed to get full path for auth_key"; exit 1; }
 fi
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     echo "'path' parameter is required"
     exit 1
diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index f011633..375b37f 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -678,6 +678,11 @@ fi
 
 which debootstrap >/dev/null 2>&1 || { echo "'debootstrap' command is missing" 
>&2; false; }
 
+if [ -z "$name" ]; then
+    echo "'name' parameter is required"
+    exit 1
+fi
+
 if [ -z "$path" ]; then
     echo "'path' parameter is required"
     exit 1
-- 
1.8.1.4


------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to