[lxc-devel] [PATCHES] add "--mask-tmp" to lxc-fedora, plus some template script fixes

Michael Adam obnox at samba.org
Thu Jan 8 10:05:16 UTC 2015


Hi,

below find the output of "git format-patch --stdout "
of a series of trivial patches to fix some minor issues
in the template scripts.

The final patch adds a new parameter to the fedora
template: "--mask-tmp". This is what I actually only
wanted to do, but I found some issues in the parsing of
options and help text, fixed them while at it and
was careless enough to check several other templates
for similar flaws.

The reason for the --mask-tmp is to be able to prevent
systemd from over-mounting /tmp with tmpfs in the container.
My current use-case is that I want to be able to use
vagrant-cachier with vagrant-lxc.

Thanks for review / comments / push, ...

Cheers - Michael


From a243b74f1cf61d3c400a16a7d6d287f15cc7c99a Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 09:32:39 +0100
Subject: [PATCH 01/22] lxc-debian: fix parsing of option "--clean": it takes
 no argument.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-debian.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index a9a1652..603894f 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -475,7 +475,7 @@ do
            --)                shift 1; break ;;
 
         -a|--arch)            arch=$2; shift 2;;
-        -c|--clean)           clean=$2; shift 1;;
+        -c|--clean)           clean=1; shift 1;;
            --mirror)          MIRROR=$2; shift 2;;
         -n|--name)            name=$2; shift 2;;
            --packages)        packages=$2; shift 2;;
-- 
2.1.0


From 9d77c63d5ed19b756b3b0dec7d3d4fa1d9a6a21f Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 09:38:48 +0100
Subject: [PATCH 02/22] lxc-debian: document "--clean" in the usage.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-debian.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index 603894f..d1e4edd 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -438,6 +438,7 @@ usage()
 {
     cat <<EOF
 $1 -h|--help -p|--path=<path> [-a|--arch] [-c|--clean] [--mirror=<mirror>] [-r|--release=<release>] [--security-mirror=<security mirror>]
+clean: purge the download cache after installation
 arch: the container architecture (e.g. amd64): defaults to host arch
 release: the debian release (e.g. wheezy): defaults to current stable
 mirror: debain mirror to use during installation
-- 
2.1.0


From fea9ebdef51e1aaae65326accce805c2b8f02bf9 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 09:57:34 +0100
Subject: [PATCH 03/22] lxc-debian: document --path in usage

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-debian.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index d1e4edd..8fe7d9d 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -439,6 +439,7 @@ usage()
     cat <<EOF
 $1 -h|--help -p|--path=<path> [-a|--arch] [-c|--clean] [--mirror=<mirror>] [-r|--release=<release>] [--security-mirror=<security mirror>]
 clean: purge the download cache after installation
+path: path under which the container will be created
 arch: the container architecture (e.g. amd64): defaults to host arch
 release: the debian release (e.g. wheezy): defaults to current stable
 mirror: debain mirror to use during installation
-- 
2.1.0


From ad326e531cf2bf8c95ed18721472f40d48ebba2f Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 09:58:09 +0100
Subject: [PATCH 04/22] lxc-debian: protect possibly unset variable with quotes
 for -z check

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-debian.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index 8fe7d9d..4ab61e5 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -574,7 +574,7 @@ configure_debian_systemd $path $rootfs
 
 post_process ${rootfs} ${release} ${arch} ${hostarch} ${packages}
 
-if [ ! -z $clean ]; then
+if [ ! -z "$clean" ]; then
     clean || exit 1
     exit 0
 fi
-- 
2.1.0


From 4b06f77f7d8bde83f8a3d30e066d87e21a94f089 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:29:23 +0100
Subject: [PATCH 05/22] lxc-ubuntu: document option "--path" in usage text

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-ubuntu.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index bbe7f7d..55b54bd 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -673,8 +673,9 @@ usage()
 $1 -h|--help [-a|--arch] [-b|--bindhome <user>] [-d|--debug]
    [-F | --flush-cache] [-r|--release <release>] [ -S | --auth-key <keyfile>]
    [--rootfs <rootfs>] [--packages <packages>] [-u|--user <user>] [--password <password>]
-   [--mirror <url>] [--security-mirror <url>]
+   [--mirror <url>] [--security-mirror <url>] [-p|--path <path>]
 release: the ubuntu release (e.g. precise): defaults to host release on ubuntu, otherwise uses latest LTS
+path: path under which the container will be created
 bindhome: bind <user>'s home into the container
           The ubuntu user will not be created, and <user> will have
           sudo access.
-- 
2.1.0


From efcb164003876642b2f55432d80b229848848e4e Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:34:49 +0100
Subject: [PATCH 06/22] lxc-opensuse: fix tab/whitespace mixup in usage text.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-opensuse.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index f727250..89971da 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -403,7 +403,7 @@ do
         -p|--path)      path=$2; shift 2;;
         --rootfs)       rootfs=$2; shift 2;;
         -n|--name)      name=$2; shift 2;;
-	-r|--release)   DISTRO=$2; shift 2;;
+        -r|--release)   DISTRO=$2; shift 2;;
         -c|--clean)     clean=$2; shift 2;;
         --)             shift 1; break ;;
         *)              break ;;
-- 
2.1.0


From 0f04581821cff394913daa4ff34bbbe41c57710b Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:35:20 +0100
Subject: [PATCH 07/22] lxc-opensuse: fix parsing of option "--clean": it takes
 no argument

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-opensuse.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 89971da..20ffdbd 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -404,7 +404,7 @@ do
         --rootfs)       rootfs=$2; shift 2;;
         -n|--name)      name=$2; shift 2;;
         -r|--release)   DISTRO=$2; shift 2;;
-        -c|--clean)     clean=$2; shift 2;;
+        -c|--clean)     clean=1; shift 1;;
         --)             shift 1; break ;;
         *)              break ;;
     esac
-- 
2.1.0


From 167d90b621fc4340987e8d980e18df8f66afb59e Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:36:06 +0100
Subject: [PATCH 08/22] lxc-opensuse: protect possibly unset variable with
 quotes in -z check

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-opensuse.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 20ffdbd..bb015c8 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -489,7 +489,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-if [ ! -z $clean ]; then
+if [ ! -z "$clean" ]; then
     clean || exit 1
     exit 0
 fi
-- 
2.1.0


From 9f7db00ea47e775045aaca2aeccc1779f22d83be Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:40:34 +0100
Subject: [PATCH 09/22] lxc-archlinux: fix paths printed in helptext.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-archlinux.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in
index fc6f714..20d0663 100644
--- a/templates/lxc-archlinux.in
+++ b/templates/lxc-archlinux.in
@@ -193,8 +193,8 @@ usage:
 Mandatory args:
   -n,--name           container name, used to as an identifier for that container from now on
 Optional args:
-  -p,--path           path to where the container rootfs will be created (${default_path})
-  --rootfs            path for actual container rootfs, (${default_path/rootfs)
+  -p,--path           path to where the container rootfs will be created (${default_path}/<container_name>)
+  --rootfs            path for actual container rootfs, (${default_path/<container_name>/rootfs)
   -P,--packages       preinstall additional packages, comma-separated list
   -e,--enable_units   enable systemd services, comma-separated list
   -d,--disable_units  disable systemd services, comma-separated list
-- 
2.1.0


From 6f3dc9d73b24512efc28836a240625759e0af9bc Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:43:12 +0100
Subject: [PATCH 10/22] lxc-altlinux: fix parsing of option "--clean": it takes
 no argument

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-altlinux.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in
index 1c5084e..9e78125 100644
--- a/templates/lxc-altlinux.in
+++ b/templates/lxc-altlinux.in
@@ -398,7 +398,7 @@ do
         --rootfs)       rootfs_path=$2; shift 2;;
         -n|--name)      name=$2; shift 2;;
         -P|--profile)   profile=$2; shift 2;;
-        -c|--clean)     clean=$2; shift 2;;
+        -c|--clean)     clean=1; shift 1;;
         -R|--release)   release=$2; shift 2;;
         -4|--ipv4)      ipv4=$2; shift 2;;
         -6|--ipv6)      ipv6=$2; shift 2;;
-- 
2.1.0


From 7d58ecd08e7d25da51945caa78d240388efdbbe2 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:43:52 +0100
Subject: [PATCH 11/22] lxc-altlinux: protect possibly unset variable with
 quotes for -z check

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-altlinux.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in
index 9e78125..ac4527b 100644
--- a/templates/lxc-altlinux.in
+++ b/templates/lxc-altlinux.in
@@ -478,7 +478,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-if [ ! -z $clean ]; then
+if [ ! -z "$clean" ]; then
     clean || exit 1
     exit 0
 fi
-- 
2.1.0


From 9e49e0ecc308be0f490f04e358ae7948505b1b75 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:48:40 +0100
Subject: [PATCH 12/22] lxc-openmandriva: fix parsing of option "--clean": it
 takes no argument

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-openmandriva.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-openmandriva.in b/templates/lxc-openmandriva.in
index 45e2efa..4656177 100644
--- a/templates/lxc-openmandriva.in
+++ b/templates/lxc-openmandriva.in
@@ -377,7 +377,7 @@ do
         --rootfs)       rootfs_path=$2; shift 2;;
         -n|--name)      name=$2; shift 2;;
         -P|--profile)   profile=$2; shift 2;;
-        -c|--clean)     clean=$2; shift 2;;
+        -c|--clean)     clean=1; shift 1;;
         -R|--release)   release=$2; shift 2;;
         -A|--arch)      arch=$2; shift 2;;
         -4|--ipv4)      ipv4=$2; shift 2;;
-- 
2.1.0


From 257cfeaa233c24a33d93785956c2969750416869 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:49:19 +0100
Subject: [PATCH 13/22] lxc-openmandriva: protect possibly unset variable with
 quotes in -z check

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-openmandriva.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-openmandriva.in b/templates/lxc-openmandriva.in
index 4656177..be8023e 100644
--- a/templates/lxc-openmandriva.in
+++ b/templates/lxc-openmandriva.in
@@ -483,7 +483,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-if [ ! -z $clean ]; then
+if [ ! -z "$clean" ]; then
     clean || exit 1
     exit 0
 fi
-- 
2.1.0


From baec0433c6d87c2df2b1cd455277d55248882497 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:01:48 +0100
Subject: [PATCH 14/22] lxc-centos: fix documentation of default value for
 --path.

Use macro @LXCPATH@ not only in code but also in corresponding usage text.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-centos.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in
index ee88178..7a7f36d 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -671,7 +671,8 @@ usage:
 Mandatory args:
   -n,--name         container name, used to as an identifier for that container from now on
 Optional args:
-  -p,--path         path to where the container rootfs will be created, defaults to /var/lib/lxc/name.
+  -p,--path         path to where the container rootfs will be created, defaults to @LXCPATH@/<name>.
+
   -c,--clean        clean the cache
   -R,--release      Centos release for the new container. if the host is Centos, then it will defaultto the host's release.
      --fqdn         fully qualified domain name (FQDN) for DNS and system naming
-- 
2.1.0


From 9d0ed6b06ba00ecfbe9fcbdb47e1f0efd58fbdd1 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:03:05 +0100
Subject: [PATCH 15/22] lxc-centos: fix parsing of option "--clean": it takes
 no argument

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-centos.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in
index 7a7f36d..8b70aa0 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -698,7 +698,7 @@ do
         -p|--path)      path=$2; shift 2;;
         --rootfs)       rootfs=$2; shift 2;;
         -n|--name)      name=$2; shift 2;;
-        -c|--clean)     clean=$2; shift 2;;
+        -c|--clean)     clean=1; shift 1;;
         -R|--release)   release=$2; shift 2;;
 	--repo)		repo="$2"; shift 2;;
         -a|--arch)      newarch=$2; shift 2;;
-- 
2.1.0


From e4a3bc73b6feb23c8ce1c13092175c350d3826fe Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:03:31 +0100
Subject: [PATCH 16/22] lxc-centos: fix tab/space mixup in help text.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-centos.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in
index 8b70aa0..94a2170 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -700,7 +700,7 @@ do
         -n|--name)      name=$2; shift 2;;
         -c|--clean)     clean=1; shift 1;;
         -R|--release)   release=$2; shift 2;;
-	--repo)		repo="$2"; shift 2;;
+        --repo)         repo="$2"; shift 2;;
         -a|--arch)      newarch=$2; shift 2;;
         --fqdn)         utsname=$2; shift 2;;
         --)             shift 1; break ;;
-- 
2.1.0


From 57f4500f73d16a81eb99599b72e1ef62fb3f4277 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:03:53 +0100
Subject: [PATCH 17/22] lxc-centos: protect possibly unset variable with quotes
 for -z check

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-centos.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in
index 94a2170..72ff143 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -888,7 +888,7 @@ fi
 
 configure_centos_init
 
-if [ ! -z $clean ]; then
+if [ ! -z "$clean" ]; then
     clean || exit 1
     exit 0
 fi
-- 
2.1.0


From 75642717e9638547b1600b9f525d9273b80920e8 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 09:59:20 +0100
Subject: [PATCH 18/22] lxc-fedora: fix documentation of default value of
 --path in usage

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-fedora.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index adfaab2..5dbf57f 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -1189,7 +1189,7 @@ usage:
 Mandatory args:
   -n,--name         container name, used to as an identifier for that container from now on
 Optional args:
-  -p,--path         path to where the container will be created, defaults to @LXCPATH at . The container config will go under @LXCPATH@ in that case
+  -p,--path         path to where the container will be created, defaults to @LXCPATH@/<name>.
   --rootfs          path for actual rootfs.
   -c,--clean        clean the cache
   -R,--release      Fedora release for the new container. if the host is Fedora, then it will default to the host's release.
-- 
2.1.0


From 30c4cc747533c23a71217e180b104759539e103f Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:00:06 +0100
Subject: [PATCH 19/22] lxc-fedora: fix parsing of option "--clean": it takes
 no argument

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-fedora.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 5dbf57f..3b9e1e7 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -1215,7 +1215,7 @@ do
         -p|--path)      path=$2; shift 2;;
         --rootfs)       rootfs=$2; shift 2;;
         -n|--name)      name=$2; shift 2;;
-        -c|--clean)     clean=$2; shift 2;;
+        -c|--clean)     clean=1; shift 1;;
         -R|--release)   release=$2; shift 2;;
         -a|--arch)      newarch=$2; shift 2;;
         --fqdn)         utsname=$2; shift 2;;
-- 
2.1.0


From 16fe5ef14f99a026aef1f663d6b2fc8f47e6c323 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:01:18 +0100
Subject: [PATCH 20/22] lxc-fedora: protect possibly unset variable with quotes
 for -z check

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-fedora.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 3b9e1e7..4f35b81 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -1415,7 +1415,7 @@ then
     configure_fedora_init
 fi
 
-if [ ! -z $clean ]; then
+if [ ! -z "$clean" ]; then
     clean || exit 1
     exit 0
 fi
-- 
2.1.0


From ec8a837f209dfae827bcf2afbd0406ea888a7300 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:22:18 +0100
Subject: [PATCH 21/22] lxc-fedora: break overly long lines in the help text.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-fedora.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 4f35b81..823921b 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -1184,15 +1184,18 @@ usage()
     cat <<EOF
 usage:
     $1 -n|--name=<container_name>
-        [-p|--path=<path>] [-c|--clean] [-R|--release=<Fedora_release>] [--fqdn=<network name of container>] [-a|--arch=<arch of the container>]
+        [-p|--path=<path>] [-c|--clean] [-R|--release=<Fedora_release>]
+        [--fqdn=<network name of container>] [-a|--arch=<arch of the container>]
         [-h|--help]
 Mandatory args:
   -n,--name         container name, used to as an identifier for that container from now on
 Optional args:
-  -p,--path         path to where the container will be created, defaults to @LXCPATH@/<name>.
+  -p,--path         path to where the container will be created,
+                    defaults to @LXCPATH@/<name>.
   --rootfs          path for actual rootfs.
   -c,--clean        clean the cache
-  -R,--release      Fedora release for the new container. if the host is Fedora, then it will default to the host's release.
+  -R,--release      Fedora release for the new container.
+                    Defaults to host's release if the host is Fedora.
      --fqdn         fully qualified domain name (FQDN) for DNS and system naming
   -a,--arch         Define what arch the container will be [i686,x86_64]
   -h,--help         print this help
-- 
2.1.0


From 66ce44a145745f4ea439f0a1b3c9809d680f1a9d Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Thu, 8 Jan 2015 10:25:24 +0100
Subject: [PATCH 22/22] lxc-fedora: add a new option --mask-tmp

This will configure the container to prevent the standard
behaviour of over-mounting /tmp with tmpfs, which can be
undesirable in some cases.

My personal use case is vagrant-lxc in combination with
vagrant-cachier.

Signed-off-by: Michael Adam <obnox at samba.org>
---
 templates/lxc-fedora.in | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 823921b..f4067e8 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -372,6 +372,12 @@ configure_fedora_systemd()
     chroot ${rootfs_path} ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
     # Make systemd honor SIGPWR
     chroot ${rootfs_path} ln -s /usr/lib/systemd/system/halt.target /etc/systemd/system/sigpwr.target
+
+    # if desired, prevent systemd from over-mounting /tmp with tmpfs
+    if [ $masktmp -eq 1 ]; then
+        chroot ${rootfs_path} ln -s /dev/null /etc/systemd/system/tmp.mount
+    fi
+
     #dependency on a device unit fails it specially that we disabled udev
     # sed -i 's/After=dev-%i.device/After=/' ${rootfs_path}/lib/systemd/system/getty\@.service
     #
@@ -1186,6 +1192,7 @@ usage:
     $1 -n|--name=<container_name>
         [-p|--path=<path>] [-c|--clean] [-R|--release=<Fedora_release>]
         [--fqdn=<network name of container>] [-a|--arch=<arch of the container>]
+        [--mask-tmp]
         [-h|--help]
 Mandatory args:
   -n,--name         container name, used to as an identifier for that container from now on
@@ -1198,18 +1205,21 @@ Optional args:
                     Defaults to host's release if the host is Fedora.
      --fqdn         fully qualified domain name (FQDN) for DNS and system naming
   -a,--arch         Define what arch the container will be [i686,x86_64]
+  --mask-tmp        Prevent systemd from over-mounting /tmp with tmpfs.
   -h,--help         print this help
 EOF
     return 0
 }
 
-options=$(getopt -o a:hp:n:cR: -l help,path:,rootfs:,name:,clean,release:,arch:,fqdn: -- "$@")
+options=$(getopt -o a:hp:n:cR: -l help,path:,rootfs:,name:,clean,release:,arch:,fqdn:,mask-tmp -- "$@")
 if [ $? -ne 0 ]; then
     usage $(basename $0)
     exit 1
 fi
 
 arch=$(uname -m)
+masktmp=0
+
 eval set -- "$options"
 while true
 do
@@ -1222,6 +1232,7 @@ do
         -R|--release)   release=$2; shift 2;;
         -a|--arch)      newarch=$2; shift 2;;
         --fqdn)         utsname=$2; shift 2;;
+        --mask-tmp)     masktmp=1; shift 1;;
         --)             shift 1; break ;;
         *)              break ;;
     esac
-- 
2.1.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20150108/c19e2c4a/attachment.sig>


More information about the lxc-devel mailing list