mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
bootctl: add "system-options" verb
This commit is contained in:
parent
28f0aef4c7
commit
4e5aa79185
@ -133,6 +133,15 @@
|
|||||||
and the firmware's boot loader list.</para></listitem>
|
and the firmware's boot loader list.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>is-installed</option></term>
|
||||||
|
|
||||||
|
<listitem><para>Checks whether <command>systemd-boot</command> is installed in the ESP. Note that a
|
||||||
|
single ESP might host multiple boot loaders; this hence checks whether
|
||||||
|
<command>systemd-boot</command> is one (of possibly many) installed boot loaders — and neither
|
||||||
|
whether it is the default nor whether it is registered in any EFI variables.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>random-seed</option></term>
|
<term><option>random-seed</option></term>
|
||||||
|
|
||||||
@ -150,12 +159,13 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>is-installed</option></term>
|
<term><option>system-options</option> <optional><replaceable>VALUE</replaceable></optional></term>
|
||||||
|
|
||||||
<listitem><para>Checks whether <command>systemd-boot</command> is installed in the ESP. Note that a
|
<listitem><para>When called without the optional argument, prints the current value of the
|
||||||
single ESP might host multiple boot loaders; this hence checks whether
|
<literal>SystemdOptions</literal> EFI variable. When called with an argument, sets the
|
||||||
<command>systemd-boot</command> is one (of possibly many) installed boot loaders — and neither
|
variable to that value. See
|
||||||
whether it is the default nor whether it is registered in any EFI variables.</para></listitem>
|
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
||||||
|
for the meaning of that variable.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -452,7 +452,8 @@
|
|||||||
<citerefentry><refentrytitle>systemd-backlight@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>systemd-backlight@.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>systemd-rfkill.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>systemd-rfkill.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>systemd-hibernate-resume-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
<citerefentry><refentrytitle>systemd-hibernate-resume-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
||||||
<citerefentry><refentrytitle>systemd-firstboot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>systemd-firstboot.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
|
||||||
|
<citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -1052,8 +1052,9 @@ static int help(int argc, char *argv[], void *userdata) {
|
|||||||
" install Install systemd-boot to the ESP and EFI variables\n"
|
" install Install systemd-boot to the ESP and EFI variables\n"
|
||||||
" update Update systemd-boot in the ESP and EFI variables\n"
|
" update Update systemd-boot in the ESP and EFI variables\n"
|
||||||
" remove Remove systemd-boot from the ESP and EFI variables\n"
|
" remove Remove systemd-boot from the ESP and EFI variables\n"
|
||||||
" random-seed Initialize random seed in ESP and EFI variables\n"
|
|
||||||
" is-installed Test whether systemd-boot is installed in the ESP\n"
|
" is-installed Test whether systemd-boot is installed in the ESP\n"
|
||||||
|
" random-seed Initialize random seed in ESP and EFI variables\n"
|
||||||
|
" system-options Query or set system options string in EFI variable\n"
|
||||||
"\nBoot Loader Entries Commands:\n"
|
"\nBoot Loader Entries Commands:\n"
|
||||||
" list List boot loader entries\n"
|
" list List boot loader entries\n"
|
||||||
" set-default ID Set default boot loader entry\n"
|
" set-default ID Set default boot loader entry\n"
|
||||||
@ -1710,18 +1711,40 @@ static int verb_random_seed(int argc, char *argv[], void *userdata) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int verb_system_options(int argc, char *argv[], void *userdata) {
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if (argc == 1) {
|
||||||
|
_cleanup_free_ char *line = NULL;
|
||||||
|
|
||||||
|
r = efi_systemd_options_variable(&line);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to query SystemdOptions EFI variable: %m");
|
||||||
|
|
||||||
|
printf("SystemdOptions: %s\n", line);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
r = efi_set_variable_string(EFI_VENDOR_SYSTEMD, "SystemdOptions", argv[1]);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to set SystemdOptions EFI variable: %m");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int bootctl_main(int argc, char *argv[]) {
|
static int bootctl_main(int argc, char *argv[]) {
|
||||||
static const Verb verbs[] = {
|
static const Verb verbs[] = {
|
||||||
{ "help", VERB_ANY, VERB_ANY, 0, help },
|
{ "help", VERB_ANY, VERB_ANY, 0, help },
|
||||||
{ "status", VERB_ANY, 1, VERB_DEFAULT, verb_status },
|
{ "status", VERB_ANY, 1, VERB_DEFAULT, verb_status },
|
||||||
{ "install", VERB_ANY, 1, 0, verb_install },
|
{ "install", VERB_ANY, 1, 0, verb_install },
|
||||||
{ "update", VERB_ANY, 1, 0, verb_install },
|
{ "update", VERB_ANY, 1, 0, verb_install },
|
||||||
{ "remove", VERB_ANY, 1, 0, verb_remove },
|
{ "remove", VERB_ANY, 1, 0, verb_remove },
|
||||||
{ "random-seed", VERB_ANY, 1, 0, verb_random_seed },
|
{ "is-installed", VERB_ANY, 1, 0, verb_is_installed },
|
||||||
{ "is-installed", VERB_ANY, 1, 0, verb_is_installed },
|
{ "list", VERB_ANY, 1, 0, verb_list },
|
||||||
{ "list", VERB_ANY, 1, 0, verb_list },
|
{ "set-default", 2, 2, 0, verb_set_default },
|
||||||
{ "set-default", 2, 2, 0, verb_set_default },
|
{ "set-oneshot", 2, 2, 0, verb_set_default },
|
||||||
{ "set-oneshot", 2, 2, 0, verb_set_default },
|
{ "random-seed", VERB_ANY, 1, 0, verb_random_seed },
|
||||||
|
{ "system-options", VERB_ANY, 2, 0, verb_system_options },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user