Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
185cfc05
Commit
185cfc05
authored
Apr 21, 2016
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
actions: Move shell scripts into helper
Signed-off-by:
Pavel Emelyanov
<
xemul@virtuozzo.com
>
parent
ac78f13b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
14 deletions
+27
-14
action-scripts.c
criu/action-scripts.c
+27
-14
No files found.
criu/action-scripts.c
View file @
185cfc05
...
@@ -39,25 +39,13 @@ static int scripts_mode = SCRIPTS_NONE;
...
@@ -39,25 +39,13 @@ static int scripts_mode = SCRIPTS_NONE;
static
int
rpc_sk
;
static
int
rpc_sk
;
static
LIST_HEAD
(
scripts
);
static
LIST_HEAD
(
scripts
);
int
run_scripts
(
enum
script_actions
act
)
static
int
run_shell_scripts
(
const
char
*
action
)
{
{
struct
script
*
script
;
int
ret
=
0
;
int
ret
=
0
;
struct
script
*
script
;
char
image_dir
[
PATH_MAX
];
char
image_dir
[
PATH_MAX
];
const
char
*
action
=
action_names
[
act
];
char
root_item_pid
[
16
];
char
root_item_pid
[
16
];
pr_debug
(
"Running %s scripts
\n
"
,
action
);
if
(
scripts_mode
==
SCRIPTS_NONE
)
return
0
;
if
(
scripts_mode
==
SCRIPTS_RPC
)
{
pr_debug
(
"
\t
RPC
\n
"
);
ret
=
send_criu_rpc_script
(
act
,
(
char
*
)
action
,
rpc_sk
);
goto
out
;
}
if
(
setenv
(
"CRTOOLS_SCRIPT_ACTION"
,
action
,
1
))
{
if
(
setenv
(
"CRTOOLS_SCRIPT_ACTION"
,
action
,
1
))
{
pr_perror
(
"Can't set CRTOOLS_SCRIPT_ACTION=%s"
,
action
);
pr_perror
(
"Can't set CRTOOLS_SCRIPT_ACTION=%s"
,
action
);
return
-
1
;
return
-
1
;
...
@@ -84,6 +72,31 @@ int run_scripts(enum script_actions act)
...
@@ -84,6 +72,31 @@ int run_scripts(enum script_actions act)
unsetenv
(
"CRTOOLS_SCRIPT_ACTION"
);
unsetenv
(
"CRTOOLS_SCRIPT_ACTION"
);
return
ret
;
}
int
run_scripts
(
enum
script_actions
act
)
{
int
ret
=
0
;
const
char
*
action
=
action_names
[
act
];
pr_debug
(
"Running %s scripts
\n
"
,
action
);
if
(
scripts_mode
==
SCRIPTS_NONE
)
return
0
;
if
(
scripts_mode
==
SCRIPTS_RPC
)
{
pr_debug
(
"
\t
RPC
\n
"
);
ret
=
send_criu_rpc_script
(
act
,
(
char
*
)
action
,
rpc_sk
);
goto
out
;
}
if
(
scripts_mode
==
SCRIPTS_SHELL
)
{
ret
=
run_shell_scripts
(
action
);
goto
out
;
}
BUG
();
out:
out:
if
(
ret
)
if
(
ret
)
pr_err
(
"One of more action scripts failed
\n
"
);
pr_err
(
"One of more action scripts failed
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment