confile: lxc.rootfs --> lxc.rootfs.path

parent 3e01c200
......@@ -79,7 +79,7 @@ quite restricted. Just to highlight the two most common problems:
LXC is configured via a simple set of keys. For example,
- `lxc.rootfs`
- `lxc.rootfs.path`
- `lxc.mount.entry`
LXC namespaces configuration keys by using single dots. This means complex
......
......@@ -1042,7 +1042,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist>
<varlistentry>
<term>
<option>lxc.rootfs</option>
<option>lxc.rootfs.path</option>
</term>
<listitem>
<para>
......@@ -1076,7 +1076,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</term>
<listitem>
<para>
where to recursively bind <option>lxc.rootfs</option>
where to recursively bind <option>lxc.rootfs.path</option>
before pivoting. This is to ensure success of the
<citerefentry>
<refentrytitle><command>pivot_root</command></refentrytitle>
......@@ -1426,7 +1426,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<listitem><para> LXC_ROOTFS_MOUNT: the path to the mounted root filesystem. </para></listitem>
<listitem><para> LXC_CONFIG_FILE: the path to the container configuration file. </para></listitem>
<listitem><para> LXC_SRC_NAME: in the case of the clone hook, this is the original container's name. </para></listitem>
<listitem><para> LXC_ROOTFS_PATH: this is the lxc.rootfs entry for the container. Note this is likely not where the mounted rootfs is to be found, use LXC_ROOTFS_MOUNT for that. </para></listitem>
<listitem><para> LXC_ROOTFS_PATH: this is the lxc.rootfs.path entry for the container. Note this is likely not where the mounted rootfs is to be found, use LXC_ROOTFS_MOUNT for that. </para></listitem>
</itemizedlist>
</para>
<para>
......@@ -1662,7 +1662,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<para>
The host relative path to the container root which has been
mounted to the rootfs.mount location.
[<option>lxc.rootfs</option>]
[<option>lxc.rootfs.path</option>]
</para>
</listitem>
</varlistentry>
......@@ -1989,7 +1989,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
lxc.cgroup.devices.allow = b 8:0 rw
lxc.mount = /etc/fstab.complex
lxc.mount.entry = /lib /root/myrootfs/lib none ro,bind 0 0
lxc.rootfs = /mnt/rootfs.complex
lxc.rootfs.path = dir:/mnt/rootfs.complex
lxc.cap.drop = sys_module mknod setuid net_raw
lxc.cap.drop = mac_override
</programlisting>
......
......@@ -91,7 +91,7 @@ lxc_config_define(fstab);
lxc_config_define(rootfs_mount);
lxc_config_define(rootfs_options);
lxc_config_define(rootfs_backend);
lxc_config_define(rootfs);
lxc_config_define(rootfs_path);
lxc_config_define(uts_name);
lxc_config_define(hooks);
lxc_config_define(net_type);
......@@ -162,13 +162,17 @@ static struct lxc_config_t config[] = {
{ "lxc.mount", set_config_fstab, get_config_fstab, clr_config_fstab, },
{ "lxc.rootfs.mount", set_config_rootfs_mount, get_config_rootfs_mount, clr_config_rootfs_mount, },
{ "lxc.rootfs.options", set_config_rootfs_options, get_config_rootfs_options, clr_config_rootfs_options, },
{ "lxc.rootfs.path", set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, },
/* REMOVE IN LXC 3.0
legacy rootfs.backend key
*/
{ "lxc.rootfs.backend", set_config_rootfs_backend, get_config_rootfs_backend, clr_config_rootfs_backend, },
{ "lxc.rootfs", set_config_rootfs, get_config_rootfs, clr_config_rootfs, },
/* REMOVE IN LXC 3.0
legacy rootfs key
*/
{ "lxc.rootfs", set_config_rootfs_path, get_config_rootfs_path, clr_config_rootfs_path, },
/* REMOVE IN LXC 3.0
legacy utsname key
......@@ -2035,8 +2039,8 @@ static int set_config_includefiles(const char *key, const char *value,
return lxc_config_read(value, lxc_conf, true);
}
static int set_config_rootfs(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
static int set_config_rootfs_path(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
return set_config_path_item(&lxc_conf->rootfs.path, value);
}
......@@ -3026,8 +3030,8 @@ static int get_config_mount(const char *key, char *retv, int inlen,
return fulllen;
}
static int get_config_rootfs(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
static int get_config_rootfs_path(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return lxc_get_conf_str(retv, inlen, c->rootfs.path);
}
......@@ -3440,8 +3444,8 @@ static inline int clr_config_fstab(const char *key, struct lxc_conf *c,
return 0;
}
static inline int clr_config_rootfs(const char *key, struct lxc_conf *c,
void *data)
static inline int clr_config_rootfs_path(const char *key, struct lxc_conf *c,
void *data)
{
free(c->rootfs.path);
c->rootfs.path = NULL;
......
......@@ -1071,8 +1071,8 @@ static struct bdev *do_bdev_create(struct lxc_container *c, const char *type,
return NULL;
}
if (!c->set_config_item(c, "lxc.rootfs", bdev->src)) {
ERROR("Failed to set config item \"lxc.rootfs\" to \"%s\"",
if (!c->set_config_item(c, "lxc.rootfs.path", bdev->src)) {
ERROR("Failed to set config item \"lxc.rootfs.path\" to \"%s\"",
bdev->src);
return NULL;
}
......@@ -2936,15 +2936,22 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c,
return -1;
}
/* Append a new lxc.rootfs entry to the unexpanded config. */
/* REMOVE IN LXC 3.0
* legacy rootfs key
*/
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs", false);
if (!do_append_unexp_config_line(c->lxc_conf, "lxc.rootfs",
/* Append a new lxc.rootfs.path entry to the unexpanded config. */
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.path", false);
if (!do_append_unexp_config_line(c->lxc_conf, "lxc.rootfs.path",
c->lxc_conf->rootfs.path)) {
ERROR("Error saving new rootfs to cloned config.");
return -1;
}
/* Append a new lxc.rootfs.backend entry to the unexpanded config. */
/* REMOVE IN LXC 3.0
* legacy rootfs.backend key
*/
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.backend", false);
if (flags & LXC_CLONE_SNAPSHOT)
......@@ -3165,7 +3172,13 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
fclose(fout);
goto out;
}
/* REMOVE IN LXC 3.0
* legacy rootfs key
*/
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs", false);
clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.path", false);
write_config(fout, c->lxc_conf);
fclose(fout);
c->lxc_conf->rootfs.path = origroot;
......
......@@ -546,7 +546,12 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
* need a path-extractor function. We face the same
* problem with the ovl_mkdir() function in
* lxcoverlay.{c,h}. */
char *curr_path = ls_get_config_item(c, "lxc.rootfs", running);
char *curr_path = ls_get_config_item(c, "lxc.rootfs.path", running);
/* REMOVE IN LXC 3.0
legacy rootfs key
*/
if (!curr_path)
curr_path = ls_get_config_item(c, "lxc.rootfs", running);
if (!curr_path)
goto put_and_next;
......
......@@ -56,7 +56,7 @@ if [ -f /etc/lsb-release ]; then
fi
lxc-create -t download -n $CONTAINER_NAME -B dir -- -d ubuntu -r $release -a $ARCH
CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs -H) | sed -e 's/dir://')
CONTAINER_PATH=$(dirname $(lxc-info -n $CONTAINER_NAME -c lxc.rootfs.path -H) | sed -e 's/dir://')
cp $CONTAINER_PATH/config $CONTAINER_PATH/config.bak
# Ensure it's not in lxc-autostart
......
......@@ -109,7 +109,7 @@ EOF
# We need this in 5.conf
lxc-destroy -n lxctestb || true
lxc-create -t busybox -n lxctestb -B dir
CONTAINER_PATH=$(dirname $(lxc-info -n lxctestb -c lxc.rootfs -H) | sed 's/dir://')
CONTAINER_PATH=$(dirname $(lxc-info -n lxctestb -c lxc.rootfs.path -H) | sed 's/dir://')
lxc-destroy -n lxctestb
# No nics, one clone hook in $container
......
......@@ -503,13 +503,22 @@ int main(int argc, char *argv[])
goto non_test_error;
}
/* lxc.rootfs */
/* REMOVE IN LXC 3.0
legacy lxc.rootfs key
*/
if (set_get_compare_clear_save_load(c, "lxc.rootfs", "/some/path", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.rootfs");
goto non_test_error;
}
/* lxc.rootfs.path */
if (set_get_compare_clear_save_load(c, "lxc.rootfs.path", "/some/path", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.rootfs.path");
goto non_test_error;
}
/* lxc.rootfs.mount */
if (set_get_compare_clear_save_load(c, "lxc.rootfs.mount", "/some/path",
tmpf, true) < 0) {
......
......@@ -483,7 +483,7 @@ readonly MIRROR_URL="${mirror_url:-$DEFAULT_MIRROR_URL}"
[ -n "$path" ] || die 1 'Missing required option --path'
if [ -z "$rootfs" ] && [ -f "$path/config" ]; then
rootfs="$(sed -nE 's/^lxc.rootfs\s*=\s*(.*)$/\1/p' "$path/config")"
rootfs="$(sed -nE 's/^lxc.rootfs.path\s*=\s*(.*)$/\1/p' "$path/config")"
fi
if [ -z "$rootfs" ]; then
rootfs="$path/rootfs"
......
......@@ -274,7 +274,7 @@ copy_configuration()
{
mkdir -p $config_path
grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config
cat <<EOF >> $config_path/config
lxc.uts.name = $name
lxc.tty = 4
......@@ -460,10 +460,10 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
# check for 'lxc.rootfs' passed in through default config by lxc-create
# check for 'lxc.rootfs.path' passed in through default config by lxc-create
if [ -z "$rootfs_path" ]; then
if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config)
if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then
rootfs_path=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config)
else
rootfs_path=$path/rootfs
fi
......
......@@ -151,8 +151,8 @@ copy_configuration() {
echo "lxc.uts.name = ${name}" >> "${config}"
grep -q "^lxc.arch" "${config}" 2>/dev/null \
|| echo "lxc.arch = ${arch}" >> "${config}"
grep -q "^lxc.rootfs" "${config}" 2>/dev/null \
|| echo "lxc.rootfs = ${rootfs_path}" >> "${config}"
grep -q "^lxc.rootfs.path" "${config}" 2>/dev/null \
|| echo "lxc.rootfs.path = ${rootfs_path}" >> "${config}"
[ -e "${shared_config}" ] \
&& echo "lxc.include = ${shared_config}" >> "${config}"
if [ $? -ne 0 ]; then
......
......@@ -339,7 +339,7 @@ copy_configuration()
rootfs=$2
name=$3
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.signal.halt = SIGUSR1
lxc.rebootsignal = SIGTERM
......@@ -427,8 +427,8 @@ fi
# detect rootfs
config="$path/config"
if [ -z "$rootfs" ]; then
if grep -q '^lxc.rootfs' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config)
if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config)
else
rootfs=$path/rootfs
fi
......
......@@ -598,8 +598,8 @@ copy_configuration()
{
mkdir -p $config_path
grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "
lxc.rootfs = $rootfs_path
grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "
lxc.rootfs.path = $rootfs_path
" >> $config_path/config
# The following code is to create static MAC addresses for each
......@@ -861,10 +861,10 @@ fi
if [ -z "$rootfs_path" ]; then
rootfs_path=$path/rootfs
# check for 'lxc.rootfs' passed in through default config by lxc-create
if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
rootfs_path=$(sed -e '/^lxc.rootfs\s*=/!d' -e 's/\s*#.*//' \
-e 's/^lxc.rootfs\s*=\s*//' -e q $path/config)
# check for 'lxc.rootfs.path' passed in through default config by lxc-create
if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then
rootfs_path=$(sed -e '/^lxc.rootfs.path\s*=/!d' -e 's/\s*#.*//' \
-e 's/^lxc.rootfs.path\s*=\s*//' -e q $path/config)
fi
fi
config_path=$path
......
......@@ -118,7 +118,7 @@ copy_configuration()
cat >> "$path/config" <<EOF
# Template used to create this container: cirros
lxc.rootfs = $rootfs
lxc.rootfs.path = $rootfs
lxc.tty = 4
lxc.pts = 1024
......
......@@ -511,7 +511,7 @@ copy_configuration()
## Add the container-specific config
echo "" >> "$path/config"
echo "# Container specific configuration" >> "$path/config"
grep -q "^lxc.rootfs" "$path/config" 2> /dev/null || echo "lxc.rootfs = $rootfs" >> "$path/config"
grep -q "^lxc.rootfs.path" "$path/config" 2> /dev/null || echo "lxc.rootfs.path = $rootfs" >> "$path/config"
cat <<EOF >> $path/config
lxc.tty = $num_tty
......@@ -787,8 +787,8 @@ fi
# detect rootfs
config="$path/config"
if [ -z "$rootfs" ]; then
if grep -q '^lxc.rootfs' "$config" 2> /dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs[ \t]+=/{ print $2 }' "$config")
if grep -q '^lxc.rootfs.path' "$config" 2> /dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs.path[ \t]+=/{ print $2 }' "$config")
else
rootfs=$path/rootfs
fi
......
......@@ -1082,8 +1082,8 @@ copy_configuration()
{
mkdir -p $config_path
grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "
lxc.rootfs = $rootfs_path
grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "
lxc.rootfs.path = $rootfs_path
" >> $config_path/config
# The following code is to create static MAC addresses for each
......@@ -1367,10 +1367,10 @@ fi
if [ -z "$rootfs_path" ]; then
rootfs_path=$path/rootfs
# check for 'lxc.rootfs' passed in through default config by lxc-create
if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
rootfs_path=$(sed -e '/^lxc.rootfs\s*=/!d' -e 's/\s*#.*//' \
-e 's/^lxc.rootfs\s*=\s*//' -e q $path/config)
# check for 'lxc.rootfs.path' passed in through default config by lxc-create
if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then
rootfs_path=$(sed -e '/^lxc.rootfs.path\s*=/!d' -e 's/\s*#.*//' \
-e 's/^lxc.rootfs.path\s*=\s*//' -e q $path/config)
fi
fi
config_path=$path
......
......@@ -439,8 +439,8 @@ copy_configuration()
# include configuration from default.conf if available
grep -q "^lxc." "${lxc_default_conf}" > "${config}" 2>/dev/null
grep -q "^lxc.rootfs" "${config}" 2>/dev/null || echo "
lxc.rootfs = ${rootfs}
grep -q "^lxc.rootfs.path" "${config}" 2>/dev/null || echo "
lxc.rootfs.path = ${rootfs}
" >> "${config}"
# The following code is to create static MAC addresses for each
......@@ -1185,10 +1185,10 @@ fi
config="${path}/config"
if [ -z "${rootfs}" ]
then
# check for 'lxc.rootfs' passed in through default config by lxc-create
if grep -q '^lxc.rootfs' "${config}" 2>/dev/null
# check for 'lxc.rootfs.path' passed in through default config by lxc-create
if grep -q '^lxc.rootfs.path' "${config}" 2>/dev/null
then
rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' "${config}")
rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' "${config}")
else
rootfs="${path}/rootfs"
fi
......
......@@ -282,9 +282,9 @@ container_setup() {
echo '### lxc-gentoo template stuff starts here' >> "$path/config"
#Determine rootfs
#If backingstore was specified, lxc.rootfs should be present or --rootfs did the rootfs var creation
#If backingstore was specified, lxc.rootfs.path should be present or --rootfs did the rootfs var creation
if [ -z "${rootfs}" ]; then
rootfs=`awk -F= '$1 ~ /^lxc.rootfs/ { print $2 }' "$path/config" 2>/dev/null`
rootfs=`awk -F= '$1 ~ /^lxc.rootfs.path/ { print $2 }' "$path/config" 2>/dev/null`
if [ -z "${rootfs}" ]; then
#OK it's default
rootfs="${path}/rootfs"
......@@ -686,11 +686,11 @@ container_conf()
grep -q "^lxc.net.0.hwaddr" ${conf_file} || sed -i -e "/^lxc\.net\.0\.type[ \t]*=[ \t]*veth/a lxc.net.0.hwaddr = 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')" ${conf_file}
fi
if grep -q "^lxc.rootfs" "${conf_file}" ; then
if grep -q "^lxc.rootfs.path" "${conf_file}" ; then
#lxc-create already provided one
conf_rootfs_line=""
else
conf_rootfs_line="lxc.rootfs = $(readlink -f "${rootfs}")"
conf_rootfs_line="lxc.rootfs.path = $(readlink -f "${rootfs}")"
fi
if [[ "${arch}" == "x86" || "${arch}" == "amd64" ]]; then
local conf_arch_line="lxc.arch = ${arch}"
......
......@@ -226,7 +226,7 @@ copy_configuration()
{
mkdir -p $config_path
grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config
cat <<EOF >> $config_path/config
lxc.uts.name = $name
lxc.tty = 4
......@@ -424,10 +424,10 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi
# check for 'lxc.rootfs' passed in through default config by lxc-create
# check for 'lxc.rootfs.path' passed in through default config by lxc-create
if [ -z "$rootfs_path" ]; then
if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config)
if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then
rootfs_path=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config)
else
rootfs_path=$path/$name/rootfs
fi
......
......@@ -303,8 +303,8 @@ copy_configuration()
rootfs=$2
name=$3
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "
lxc.rootfs = $rootfs_path
grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "
lxc.rootfs.path = $rootfs_path
" >> $path/config
# The following code is to create static MAC addresses for each
......@@ -504,8 +504,8 @@ fi
# detect rootfs
config="$path/config"
if [ -z "$rootfs" ]; then
if grep -q '^lxc.rootfs' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config)
if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config)
else
rootfs=$path/rootfs
fi
......
......@@ -484,7 +484,7 @@ container_config_create()
lxc.arch = $arch
lxc.uts.name = $name
EOF
grep -q "^lxc.rootfs" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs = $container_rootfs" >> $cfg_dir/config
grep -q "^lxc.rootfs.path" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs.path = $container_rootfs" >> $cfg_dir/config
if [ $container_release_major != "4" ]; then
echo "lxc.cap.drop = sys_resource" >>$cfg_dir/config
......
......@@ -346,8 +346,8 @@ ptcache=$cache/partial-${prog##*-}-$release-$arch
dlcache=$cache/cache-${prog##*-}-$release-$arch
rtcache=$cache/rootfs-${prog##*-}-$release-$arch
if [ -z "$rootfs" ] ; then
if grep -q "^lxc.rootfs" $path/config ; then
rootfs=`awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config`
if grep -q "^lxc.rootfs.path" $path/config ; then
rootfs=`awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config`
else
rootfs=$path/rootfs
fi
......
......@@ -234,7 +234,7 @@ copy_configuration()
{
mkdir -p $config_path
grep -q "^lxc.rootfs" $config_path/config 2>/dev/null || echo "lxc.rootfs = $rootfs_path" >> $config_path/config
grep -q "^lxc.rootfs.path" $config_path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs_path" >> $config_path/config
cat <<EOF >> $config_path/config
# Most of below settings should be taken as defaults from
# lxc.include = /usr/share/lxc/config/common.conf
......@@ -423,10 +423,10 @@ fi
if [ -z "$rootfs" ]; then
rootfs_path=$path/rootfs
# check for 'lxc.rootfs' passed in through default config by lxc-create
# check for 'lxc.rootfs.path' passed in through default config by lxc-create
# TODO: should be lxc.rootfs.mount used instead?
if grep -q '^lxc.rootfs' $path/config 2>/dev/null ; then
rootfs_path=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $path/config)
if grep -q '^lxc.rootfs.path' $path/config 2>/dev/null ; then
rootfs_path=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $path/config)
fi
else
rootfs_path=$rootfs
......
......@@ -743,8 +743,8 @@ fi
# detect rootfs
config="$path/config"
if [ -z "$rootfs" ]; then
if grep -q '^lxc.rootfs' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config)
if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config)
else
rootfs=$path/rootfs
fi
......
......@@ -318,7 +318,7 @@ container_config_create()
lxc.arch = $arch
lxc.uts.name = $name
EOF
grep -q "^lxc.rootfs" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs = $container_rootfs" >> $cfg_dir/config
grep -q "^lxc.rootfs.path" $cfg_dir/config 2>/dev/null || echo "lxc.rootfs.path = $container_rootfs" >> $cfg_dir/config
echo "lxc.cap.drop = sys_resource" >>$cfg_dir/config
......
......@@ -127,7 +127,7 @@ copy_configuration()
init_path=$(realpath --relative-to=/ $(readlink -f /sbin/init))
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.uts.name = $name
lxc.pts = 1024
......@@ -250,8 +250,8 @@ fi
# detect rootfs
config="$path/config"
if [ -z "$rootfs" ]; then
if grep -q '^lxc.rootfs' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config)
if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config)
else
rootfs=$path/rootfs
fi
......
......@@ -89,7 +89,7 @@ copy_configuration()
echo "" >> $path/config
echo "# Container specific configuration" >> $path/config
[ -e "$path/config-auto" ] && cat $path/config-auto >> $path/config && rm $path/config-auto
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.uts.name = $name
lxc.arch = $arch
......@@ -263,8 +263,8 @@ fi
# detect rootfs
config="$path/config"
if [ -z "$rootfs" ]; then
if grep -q '^lxc.rootfs' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config)
if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config)
else
rootfs=$path/rootfs
fi
......
......@@ -529,7 +529,7 @@ copy_configuration()
echo "" >> $path/config
echo "# Container specific configuration" >> $path/config
[ -e "$path/config-auto" ] && cat $path/config-auto >> $path/config && rm $path/config-auto
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
grep -q "^lxc.rootfs.path" $path/config 2>/dev/null || echo "lxc.rootfs.path = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.uts.name = $name
lxc.arch = $arch
......@@ -809,8 +809,8 @@ fi
config="$path/config"
# if $rootfs exists here, it was passed in with --rootfs
if [ -z "$rootfs" ]; then
if grep -q '^lxc.rootfs' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs =/{ print $2 }' $config)
if grep -q '^lxc.rootfs.path' $config 2>/dev/null ; then
rootfs=$(awk -F= '/^lxc.rootfs.path =/{ print $2 }' $config)
else
rootfs=$path/rootfs
fi
......
......@@ -69,8 +69,8 @@ copy_configuration() {
mkdir -p "${config_path}"
local config="${config_path}/config"
echo "lxc.uts.name = ${name}" >> "${config}"
grep -q "^lxc.rootfs" "${config}" 2>/dev/null \
|| echo "lxc.rootfs = ${rootfs_path}" >> "${config}"
grep -q "^lxc.rootfs.path" "${config}" 2>/dev/null \
|| echo "lxc.rootfs.path = ${rootfs_path}" >> "${config}"
# Detect if were in a UserNS and include the right config
if [ -z "${LXC_MAPPED_GID+x}" ] || [ -z "${LXC_MAPPED_UID+x}" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment