From: Daniel Lezcano Date: Fri, 20 Nov 2009 14:01:30 +0000 (+0100) Subject: rollback configuration is a file X-Git-Tag: lxc_0_6_4~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7418c9ced124f54e5683a448386d7dc5a8011778;p=thirdparty%2Flxc.git rollback configuration is a file The container will be a directory where the user can store everything, so we create one directory and store a configuration file inside. Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in index 115e52d09..ee0f3d1e8 100644 --- a/src/lxc/lxc-create.in +++ b/src/lxc/lxc-create.in @@ -80,18 +80,20 @@ if [ -z "$lxc_name" ]; then exit 1 fi -if [ -f "$lxc_path/$lxc_name" ]; then +if [ -d "$lxc_path/$lxc_name" ]; then echo "'$lxc_name' already exists" exit 1 fi +mkdir -p $lxc_path/$lxc_name + if [ -z "$lxc_config" ]; then - touch $lxc_path/$lxc_name + touch $lxc_path/$lxc_name/config else if [ ! -r "$lxc_config" ]; then echo "'$lxc_config' configuration file not found" exit 1 fi - cp $lxc_config $lxc_path/$lxc_name + cp $lxc_config $lxc_path/$lxc_name/config fi \ No newline at end of file diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in index 18d95b8f6..565d89d6c 100644 --- a/src/lxc/lxc-destroy.in +++ b/src/lxc/lxc-destroy.in @@ -70,7 +70,7 @@ if [ -z "$lxc_name" ]; then exit 1 fi -if [ ! -f "$lxc_path/$lxc_name" ]; then +if [ ! -d "$lxc_path/$lxc_name" ]; then echo "'$lxc_name' does not exist" exit 1 fi diff --git a/src/lxc/lxc_execute.c b/src/lxc/lxc_execute.c index efc03ebfa..846a96fad 100644 --- a/src/lxc/lxc_execute.c +++ b/src/lxc/lxc_execute.c @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) if (my_args.rcfile) rcfile = (char *)my_args.rcfile; else { - if (!asprintf(&rcfile, LXCPATH "/%s", my_args.name)) { + if (!asprintf(&rcfile, LXCPATH "/%s/config", my_args.name)) { SYSERROR("failed to allocate memory"); return -1; } diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c index c2c5fa41a..cf87abfb0 100644 --- a/src/lxc/lxc_start.c +++ b/src/lxc/lxc_start.c @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) if (my_args.rcfile) rcfile = (char *)my_args.rcfile; else { - if (!asprintf(&rcfile, LXCPATH "/%s", my_args.name)) { + if (!asprintf(&rcfile, LXCPATH "/%s/config", my_args.name)) { SYSERROR("failed to allocate memory"); return err; }