mirror of
https://github.com/systemd/systemd.git
synced 2024-10-27 18:55:40 +03:00
systemctl: allow suppress the warning of no install info using --no-warn
In cases like packaging scripts, it might be desired to use enable/disable on units without install info. So, adding an option '--no-warn' to suppress the warning.
This commit is contained in:
parent
bf1bea43f1
commit
108d35ac7d
@ -771,6 +771,9 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
|
|||||||
account.
|
account.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>When using this operation on units without install information, a warning about it is shown.
|
||||||
|
<option>--no-warn</option> can be used to suppress the warning.</para>
|
||||||
|
|
||||||
<para>Enabling units should not be confused with starting (activating) units, as done by the
|
<para>Enabling units should not be confused with starting (activating) units, as done by the
|
||||||
<command>start</command> command. Enabling and starting units is orthogonal: units may be enabled without
|
<command>start</command> command. Enabling and starting units is orthogonal: units may be enabled without
|
||||||
being started and started without being enabled. Enabling simply hooks the unit into various suggested
|
being started and started without being enabled. Enabling simply hooks the unit into various suggested
|
||||||
@ -814,8 +817,8 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
|
|||||||
executed. This output may be suppressed by passing <option>--quiet</option>.
|
executed. This output may be suppressed by passing <option>--quiet</option>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>This command honors <option>--system</option>, <option>--user</option>, <option>--runtime</option>
|
<para>This command honors <option>--system</option>, <option>--user</option>, <option>--runtime</option>,
|
||||||
and <option>--global</option> in a similar way as <command>enable</command>.</para>
|
<option>--global</option> and <option>--no-warn</option> in a similar way as <command>enable</command>.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -1997,6 +2000,17 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--no-warn</option></term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>Don't generate the warning shown by default when using
|
||||||
|
<command>enable</command> or <command>disable</command> on units
|
||||||
|
without install information (i.e. don't have or have an empty
|
||||||
|
[Install] section).</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--no-block</option></term>
|
<term><option>--no-block</option></term>
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ int verb_enable(int argc, char *argv[], void *userdata) {
|
|||||||
InstallChange *changes = NULL;
|
InstallChange *changes = NULL;
|
||||||
size_t n_changes = 0;
|
size_t n_changes = 0;
|
||||||
int carries_install_info = -1;
|
int carries_install_info = -1;
|
||||||
bool ignore_carries_install_info = arg_quiet;
|
bool ignore_carries_install_info = arg_quiet || arg_no_warn;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!argv[1])
|
if (!argv[1])
|
||||||
|
@ -84,6 +84,7 @@ bool arg_show_types = false;
|
|||||||
int arg_check_inhibitors = -1;
|
int arg_check_inhibitors = -1;
|
||||||
bool arg_dry_run = false;
|
bool arg_dry_run = false;
|
||||||
bool arg_quiet = false;
|
bool arg_quiet = false;
|
||||||
|
bool arg_no_warn = false;
|
||||||
bool arg_full = false;
|
bool arg_full = false;
|
||||||
bool arg_recursive = false;
|
bool arg_recursive = false;
|
||||||
bool arg_with_dependencies = false;
|
bool arg_with_dependencies = false;
|
||||||
@ -277,6 +278,8 @@ static int systemctl_help(void) {
|
|||||||
" kexec, suspend, hibernate, suspend-then-hibernate,\n"
|
" kexec, suspend, hibernate, suspend-then-hibernate,\n"
|
||||||
" hybrid-sleep, default, rescue, emergency, and exit.\n"
|
" hybrid-sleep, default, rescue, emergency, and exit.\n"
|
||||||
" -q --quiet Suppress output\n"
|
" -q --quiet Suppress output\n"
|
||||||
|
" --no-warn Don't generate warning when trying to enable/disable\n"
|
||||||
|
" units without install information\n"
|
||||||
" --wait For (re)start, wait until service stopped again\n"
|
" --wait For (re)start, wait until service stopped again\n"
|
||||||
" For is-system-running, wait until startup is completed\n"
|
" For is-system-running, wait until startup is completed\n"
|
||||||
" --no-block Do not wait until operation finished\n"
|
" --no-block Do not wait until operation finished\n"
|
||||||
@ -433,6 +436,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
|||||||
ARG_READ_ONLY,
|
ARG_READ_ONLY,
|
||||||
ARG_MKDIR,
|
ARG_MKDIR,
|
||||||
ARG_MARKED,
|
ARG_MARKED,
|
||||||
|
ARG_NO_WARN,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct option options[] = {
|
static const struct option options[] = {
|
||||||
@ -465,6 +469,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
|||||||
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
|
{ "no-wall", no_argument, NULL, ARG_NO_WALL },
|
||||||
{ "dry-run", no_argument, NULL, ARG_DRY_RUN },
|
{ "dry-run", no_argument, NULL, ARG_DRY_RUN },
|
||||||
{ "quiet", no_argument, NULL, 'q' },
|
{ "quiet", no_argument, NULL, 'q' },
|
||||||
|
{ "no-warn", no_argument, NULL, ARG_NO_WARN },
|
||||||
{ "root", required_argument, NULL, ARG_ROOT },
|
{ "root", required_argument, NULL, ARG_ROOT },
|
||||||
{ "image", required_argument, NULL, ARG_IMAGE },
|
{ "image", required_argument, NULL, ARG_IMAGE },
|
||||||
{ "force", no_argument, NULL, 'f' },
|
{ "force", no_argument, NULL, 'f' },
|
||||||
@ -926,6 +931,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
|||||||
arg_marked = true;
|
arg_marked = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_NO_WARN:
|
||||||
|
arg_no_warn = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case '.':
|
case '.':
|
||||||
/* Output an error mimicking getopt, and print a hint afterwards */
|
/* Output an error mimicking getopt, and print a hint afterwards */
|
||||||
log_error("%s: invalid option -- '.'", program_invocation_name);
|
log_error("%s: invalid option -- '.'", program_invocation_name);
|
||||||
|
@ -65,6 +65,7 @@ extern bool arg_show_types;
|
|||||||
extern int arg_check_inhibitors;
|
extern int arg_check_inhibitors;
|
||||||
extern bool arg_dry_run;
|
extern bool arg_dry_run;
|
||||||
extern bool arg_quiet;
|
extern bool arg_quiet;
|
||||||
|
extern bool arg_no_warn;
|
||||||
extern bool arg_full;
|
extern bool arg_full;
|
||||||
extern bool arg_recursive;
|
extern bool arg_recursive;
|
||||||
extern bool arg_with_dependencies;
|
extern bool arg_with_dependencies;
|
||||||
|
Loading…
Reference in New Issue
Block a user