Commit ded04267 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

scripts: set CRIU_IMAGE_DIR when running scripts

When doing a restore for LXC, we store some other metadata (which bridge a veth
was on) in the image directory so that the restore script can correctly unlock
a network device and attach it to the right interface. This patch is needed so
that the script can find this metadata.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 44926184
......@@ -460,6 +460,7 @@ int run_scripts(char *action)
{
struct script *script;
int ret = 0;
char image_dir[PATH_MAX];
pr_debug("Running %s scripts\n", action);
......@@ -468,6 +469,12 @@ int run_scripts(char *action)
return -1;
}
sprintf(image_dir, "/proc/%ld/fd/%d", (long) getpid(), get_service_fd(IMG_FD_OFF));
if (setenv("CRTOOLS_IMAGE_DIR", image_dir, 1)) {
pr_perror("Can't set CRTOOLS_IMAGE_DIR=%s", image_dir);
return -1;
}
list_for_each_entry(script, &opts.scripts, node) {
if (script->path == SCRIPT_RPC_NOTIFY) {
pr_debug("\tRPC\n");
......
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