Commit 7418c9ce by Daniel Lezcano

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 158f9982
......@@ -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
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
}
......
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