mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
add ephemeral to nspawn-settings.
This commit is contained in:
parent
c8758e726c
commit
a2f577fca0
@ -126,6 +126,16 @@
|
||||
<filename>systemd-nspawn@.service</filename> template unit file is used.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>Ephemeral=</varname></term>
|
||||
|
||||
<listitem><para>Takes a boolean argument, which defaults to off, If enabled, the container is run with
|
||||
a temporary snapshot of its file system that is removed immediately when the container terminates.
|
||||
This is equivalent to the <option>--ephemeral</option> command line switch. See
|
||||
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry> for details
|
||||
about the specific options supported.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>ProcessTwo=</varname></term>
|
||||
|
||||
|
@ -19,6 +19,7 @@ struct ConfigPerfItem;
|
||||
%includes
|
||||
%%
|
||||
Exec.Boot, config_parse_boot, 0, 0
|
||||
Exec.Ephemeral, config_parse_bool, 0, offsetof(Settings, ephemeral)
|
||||
Exec.ProcessTwo, config_parse_pid2, 0, 0
|
||||
Exec.Parameters, config_parse_strv, 0, offsetof(Settings, parameters)
|
||||
Exec.Environment, config_parse_strv, 0, offsetof(Settings, environment)
|
||||
|
@ -84,9 +84,10 @@ typedef enum SettingsMask {
|
||||
SETTING_RESOLV_CONF = UINT64_C(1) << 21,
|
||||
SETTING_LINK_JOURNAL = UINT64_C(1) << 22,
|
||||
SETTING_TIMEZONE = UINT64_C(1) << 23,
|
||||
SETTING_RLIMIT_FIRST = UINT64_C(1) << 24, /* we define one bit per resource limit here */
|
||||
SETTING_RLIMIT_LAST = UINT64_C(1) << (24 + _RLIMIT_MAX - 1),
|
||||
_SETTINGS_MASK_ALL = (UINT64_C(1) << (24 + _RLIMIT_MAX)) -1,
|
||||
SETTING_EPHEMERAL = UINT64_C(1) << 24,
|
||||
SETTING_RLIMIT_FIRST = UINT64_C(1) << 25, /* we define one bit per resource limit here */
|
||||
SETTING_RLIMIT_LAST = UINT64_C(1) << (25 + _RLIMIT_MAX - 1),
|
||||
_SETTINGS_MASK_ALL = (UINT64_C(1) << (25 + _RLIMIT_MAX)) -1,
|
||||
_SETTING_FORCE_ENUM_WIDTH = UINT64_MAX
|
||||
} SettingsMask;
|
||||
|
||||
@ -102,6 +103,7 @@ assert_cc(sizeof(SETTING_RLIMIT_LAST) == 8);
|
||||
typedef struct Settings {
|
||||
/* [Run] */
|
||||
StartMode start_mode;
|
||||
bool ephemeral;
|
||||
char **parameters;
|
||||
char **environment;
|
||||
char *user;
|
||||
|
@ -574,6 +574,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
case 'x':
|
||||
arg_ephemeral = true;
|
||||
arg_settings_mask |= SETTING_EPHEMERAL;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
@ -3380,6 +3381,9 @@ static int merge_settings(Settings *settings, const char *path) {
|
||||
strv_free_and_replace(arg_parameters, settings->parameters);
|
||||
}
|
||||
|
||||
if ((arg_settings_mask & SETTING_EPHEMERAL) == 0)
|
||||
arg_ephemeral = settings->ephemeral;
|
||||
|
||||
if ((arg_settings_mask & SETTING_PIVOT_ROOT) == 0 &&
|
||||
settings->pivot_root_new) {
|
||||
free_and_replace(arg_pivot_root_new, settings->pivot_root_new);
|
||||
|
Loading…
x
Reference in New Issue
Block a user