[lxc-devel] [PATCHES] add "--mask-tmp" to lxc-fedora, plus some template script fixes
Michael Adam
obnox at samba.org
Sat Jan 10 12:08:37 UTC 2015
Hi Serge,
Thanks for your comments.
On 2015-01-10 at 04:05 +0000, Serge Hallyn wrote:
> Hi,
>
> thanks.
>
> the trivial ones look almost all correct to me - the only worry I have
> is about adding -p to the help output. -p is not meant to be used by
> users, only by lxc-create in calling the templates. It looks like you
> only added that to the ubuntu template (so that's the only part of those
> that I object to).
Not quite: Added to ubuntu and debian templates, because it was
not documented there, and fixed the printed paths in archlinux,
centos and fedora.
It also seems that templates for fedora, centos and friends treat
the path parameter differently than debian and ubuntu in that
they do provide a default. Debian and ubuntu templates don't
and fail if --path is not specified.
> Actually a patch to remove '-p|--path' from the
> help statement in all other templates would be appreciated.
Ok, so the reasoning is that the template script should only
be called from lxc-create and that lxc-create adds the --path
parameter to the call, correct?
> The less controversial one is adding mask-tmp to the fedora template.
> It looks fine to me, but that should go separately to mwarfield, our
> fedora template maintainer :)
I had notified mhw of my patches on irc, but apparently he is
currently very busy.
For a start, following is an update of the uncontroversial fix
patches, i.e. the fix patche without the path ones, and without
the mask-tmp patch.
Cheers - Michael
From d7c0574f6deae345ddaa58e9cd3d85018d1a6908 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/16] 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 31347d5bd8f405f42e17d375de85b92c72963a65 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/16] 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 48f3faa90ee6e599281ca7e09fa6386961db9067 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 03/16] 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 d1e4edd..65093f3 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -573,7 +573,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 4be2378d34aa89b39a04d3379d340212499e0075 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 04/16] 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 9523398ff4a28b3c819c8cd26108807ce64c9330 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 05/16] 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 1c847d4c71c79a6bcade46f9743fdb9006fe79bc 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 06/16] 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 e91db6d594ff522a8915477797138daa26d201a9 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 07/16] 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 932ec3418d5b3a2c8f8713fd6f86946671e74598 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 08/16] 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 ff67ced9bfb6965f8372138fa9f0ffe300d2fbc3 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 09/16] 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 890cb7e0c19da78d8ed5758ea0cce10b790bda39 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 10/16] 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 07ce7a2617686de304addbacdec1ae417eb63433 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 11/16] 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 ee88178..ee34289 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -697,7 +697,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 778477c7a67043c747f20c08a7d9fa0c8fcef43d 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 12/16] 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 ee34289..6610a1b 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -699,7 +699,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 a0a754c78e2b34edd23826c6674501f5b166ffd8 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 13/16] 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 6610a1b..c7d2b89 100644
--- a/templates/lxc-centos.in
+++ b/templates/lxc-centos.in
@@ -887,7 +887,7 @@ fi
configure_centos_init
-if [ ! -z $clean ]; then
+if [ ! -z "$clean" ]; then
clean || exit 1
exit 0
fi
--
2.1.0
From fbb71f821c9269f2f36119e1b5c526b800e8ffa2 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 14/16] 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 adfaab2..7789a02 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 017310aff1f45d6467ab1f88a0696eba9cf0004a 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 15/16] 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 7789a02..8d8b0b7 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 854bee3acf6d9bdbe23de4b77fe606d9777df9ef 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 16/16] lxc-fedora: let help text fit into 80 columns
by breaking and shortening some lines.
Signed-off-by: Michael Adam <obnox at samba.org>
---
templates/lxc-fedora.in | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 8d8b0b7..210f2e7 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
+ -n,--name container name, used to as an identifier for that container
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 at .
--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
-------------- 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/20150110/7d80d439/attachment.sig>
More information about the lxc-devel
mailing list