]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Cleanup partial container if -h was passed to template
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 17 Aug 2012 02:11:50 +0000 (21:11 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 25 Oct 2012 08:06:41 +0000 (10:06 +0200)
If user calls 'lxc-create -t ubuntu -- -h' (as opposed to
'lxc-create -t ubuntu -h') then the ubuntu template will print its
help then exit 0.  Then lxc-create does not cleanup.  So detect this
in lxc-create.

src/lxc/lxc-create.in

index 39d6f5475af8b1a3ccc888438e39fe61b4c045dd..cca415730733aebc4546035b1834e98aea9e5069 100644 (file)
@@ -136,6 +136,18 @@ while true; do
         esac
 done
 
+# If -h or --help was passed into the container, we'll want to cleanup
+# afterward
+wantedhelp=0
+for var in "$@"
+do
+if [ "$var" = "-h" -o "$var" = "--help" ]; then
+    help
+    exit 1
+fi
+done
+
+
 if [ -z "$lxc_path" ]; then
     echo "$(basename $0): no configuration path defined" >&2
     exit 1