Debian Codegraph @

debian/patches/0004-Fixes-path-variable-in-some-templates.patch

raw
1 From: =?utf-8?q?Pierre-Elliott_B=C3=A9cue?= <[email protected]>
2 Date: Fri, 12 Mar 2021 11:50:00 +0100
3 Subject: Fixes path variable in some templates
4
5 The behaviour of the path variable is somewhat inconsistent with a
6 relevant way of generating containers. path now points to a directory,
7 where ${path}/${name} will be created and handle the new container's
8 config/rootfs
9 ---
10 templates/lxc-archlinux.in | 8 +++++---
11 templates/lxc-centos.in | 6 ++++--
12 templates/lxc-fedora-legacy.in | 8 +++++---
13 templates/lxc-fedora.in | 8 +++++---
14 templates/lxc-pld.in | 7 +++++--
15 templates/lxc-voidlinux.in | 8 +++++++-
16 6 files changed, 31 insertions(+), 14 deletions(-)
17
18 diff --git a/templates/lxc-archlinux.in b/templates/lxc-archlinux.in
19 index 4a5c271..5fe2c55 100644
20 --- a/templates/lxc-archlinux.in
21 +++ b/templates/lxc-archlinux.in
22 @@ -206,8 +206,8 @@ usage:
23 Mandatory args:
24 -n,--name container name, used to as an identifier for that container from now on
25 Optional args:
26 - -p,--path path to where the container rootfs will be created (${default_path})
27 - --rootfs path for actual container rootfs, (${default_path}/rootfs)
28 + -p,--path path the directory where the container directory will be created (${default_path})
29 + --rootfs path for actual container rootfs, (${default_path}/{container_name}/rootfs)
30 -P,--packages preinstall additional packages, comma-separated list
31 -e,--enable_units enable systemd services, comma-separated list
32 -d,--disable_units disable systemd services, comma-separated list
33 @@ -256,9 +256,11 @@ if [ ${?} -ne 0 ]; then
34 fi
35
36 if [ -z "${path}" ]; then
37 - path="${default_path}/${name}"
38 + path="${default_path}"
39 fi
40
41 +path="${path}/${name}"
42 +
43 if [ "${EUID}" != "0" ]; then
44 echo "This script should be run as 'root'"
45 exit 1
46 diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in
47 index deccfe5..eb17168 100644
48 --- a/templates/lxc-centos.in
49 +++ b/templates/lxc-centos.in
50 @@ -708,7 +708,7 @@ usage:
51 Mandatory args:
52 -n,--name container name, used to as an identifier for that container from now on
53 Optional args:
54 - -p,--path path to where the container rootfs will be created, defaults to /var/lib/lxc/name.
55 + -p,--path path to where the container directory will be created, defaults to /var/lib/lxc.
56 -c,--clean clean the cache
57 -R,--release CentOS release for the new container. If the host is CentOS, then it will default to the host's release.
58 --fqdn fully qualified domain name (FQDN) for DNS and system naming
59 @@ -847,9 +847,11 @@ if [ $? -ne 0 ]; then
60 fi
61
62 if [ -z "$path" ]; then
63 - path=$default_path/$name
64 + path=$default_path
65 fi
66
67 +path="${path}/${name}"
68 +
69 if [ -z "$release" ]; then
70 if [ "$is_centos" -a "$centos_host_ver" ]; then
71 release=$centos_host_ver
72 diff --git a/templates/lxc-fedora-legacy.in b/templates/lxc-fedora-legacy.in
73 index 3ef3415..d42d6a6 100644
74 --- a/templates/lxc-fedora-legacy.in
75 +++ b/templates/lxc-fedora-legacy.in
76 @@ -1187,8 +1187,8 @@ usage:
77 Mandatory args:
78 -n,--name container name, used to as an identifier for that container
79 Optional args:
80 - -p,--path path to where the container will be created,
81 - defaults to @LXCPATH@.
82 + -p,--path path to the directory where the container'directory will be
83 + created, defaults to @LXCPATH@.
84 --rootfs path for actual rootfs.
85 -c,--clean clean the cache
86 -R,--release Fedora release for the new container.
87 @@ -1348,9 +1348,11 @@ if [ -n "$needed_pkgs" ]; then
88 fi
89
90 if [ -z "$path" ]; then
91 - path=$default_path/$name
92 + path=$default_path
93 fi
94
95 +path="${path}/${name}"
96 +
97 if [ -z "$release" ]; then
98 if [ "$is_fedora" -a "$fedora_host_ver" ]; then
99 release=$fedora_host_ver
100 diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
101 index 51868a6..f6e5191 100644
102 --- a/templates/lxc-fedora.in
103 +++ b/templates/lxc-fedora.in
104 @@ -983,8 +983,8 @@ Template options:
105 -h, --help Print this help text
106 --mask-tmp Prevent systemd from over-mounting /tmp with tmpfs.
107 -M, --mirror=MIRROR Fedora mirror to use during installation.
108 - -p, --path=PATH Path to where the container will be created,
109 - defaults to ${lxc_path}.
110 + -p, --path=PATH Path to the directory where the container's directory
111 + will be created, defaults to ${lxc_path}.
112 -P, --packages=PKGS Comma-separated list of additional RPM packages to
113 install into the container.
114 -R, --release=RELEASE Fedora release number of the container, defaults
115 @@ -1216,9 +1216,11 @@ fi
116 # set container directory
117 if [ -z "${path}" ]
118 then
119 - path="${lxc_path}/${name}"
120 + path="${lxc_path}"
121 fi
122
123 +path="${path}/${name}"
124 +
125 # set container rootfs and configuration path
126 config="${path}/config"
127 if [ -z "${rootfs}" ]
128 diff --git a/templates/lxc-pld.in b/templates/lxc-pld.in
129 index c7aa132..0a2665a 100644
130 --- a/templates/lxc-pld.in
131 +++ b/templates/lxc-pld.in
132 @@ -319,7 +319,8 @@ usage:
133 Mandatory args:
134 -n,--name container name, used to as an identifier for that container from now on
135 Optional args:
136 - -p,--path path to where the container will be created, defaults to @LXCPATH@. The container config will go under @LXCPATH@ in that case
137 + -p,--path path to the directory where the container's directory will be created, defaults to @LXCPATH@.
138 + The container config will go under @LXCPATH@ in that case
139 --rootfs path for actual rootfs.
140 -c,--clean clean the cache
141 -R,--release PLD Linux release for the new container. if the host is PLD Linux, then it will default to the host's release.
142 @@ -397,9 +398,11 @@ if [ -n "$needed_pkgs" ]; then
143 fi
144
145 if [ -z "$path" ]; then
146 - path=$default_path/$name
147 + path=$default_path
148 fi
149
150 +path="${path}/${name}"
151 +
152 if [ -z "$release" ]; then
153 if [ "$is_pld" -a "$pld_host_ver" ]; then
154 release=$pld_host_ver
155 diff --git a/templates/lxc-voidlinux.in b/templates/lxc-voidlinux.in
156 index 00ff917..c2d7836 100644
157 --- a/templates/lxc-voidlinux.in
158 +++ b/templates/lxc-voidlinux.in
159 @@ -103,7 +103,7 @@ usage:
160 Mandatory args:
161 -n,--name container name, used to as an identifier for that container from now on
162 Optional args:
163 - -p,--path path to where the container rootfs will be created (${default_path})
164 + -p,--path path to the directory where the container's directory will be created (${default_path})
165 --rootfs path for actual container rootfs, (${default_path}/rootfs)
166 -P,--packages preinstall additional packages, comma-separated list
167 -c,--config use specified pacman config when installing container packages
168 @@ -152,6 +152,12 @@ if [ ${?} -ne 0 ]; then
169 echo "'xbps-query' command is missing."
170 fi
171
172 +if [ -z "${path}" ]; then
173 + path="${default_path}"
174 +fi
175 +
176 +path="${path}/${name}"
177 +
178 if [ -z "${rootfs_path}" ]; then
179 rootfs_path="${path}/rootfs"
180 fi