mirror of
https://github.com/systemd/systemd
synced 2025-11-21 09:44:44 +01:00
Compare commits
29 Commits
ea44302b29
...
b49bff0da7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b49bff0da7 | ||
|
|
60597825ef | ||
|
|
4a3620c55a | ||
|
|
5fc94cc6d9 | ||
|
|
b8efd65975 | ||
|
|
273cb33b61 | ||
|
|
9ce3ef1304 | ||
|
|
5fd9939789 | ||
|
|
1e737d44d1 | ||
|
|
29832663dc | ||
|
|
675bfef837 | ||
|
|
188049d38c | ||
|
|
365399c4e4 | ||
|
|
65c4347d6e | ||
|
|
99df84ef23 | ||
|
|
25f1473c81 | ||
|
|
1da7dcf427 | ||
|
|
f29f6b6b7d | ||
|
|
a5fada5d5d | ||
|
|
292928e964 | ||
|
|
9033f923f9 | ||
|
|
9b3041d9fe | ||
|
|
048d813fcd | ||
|
|
3a21f6aa6e | ||
|
|
0b89d8cfec | ||
|
|
aaa3e6880d | ||
|
|
5fb90fa319 | ||
|
|
4a94a1b83f | ||
|
|
854789543b |
@ -166,7 +166,7 @@
|
|||||||
command line or <filename>/etc/fstab</filename>, or otherwise configured. If true, full state-less boot mode
|
command line or <filename>/etc/fstab</filename>, or otherwise configured. If true, full state-less boot mode
|
||||||
is selected. In this case, the root directory is mounted as volatile memory file system (<literal>tmpfs</literal>),
|
is selected. In this case, the root directory is mounted as volatile memory file system (<literal>tmpfs</literal>),
|
||||||
and only <filename>/usr/</filename> is mounted from the file system configured as root device, in read-only mode.
|
and only <filename>/usr/</filename> is mounted from the file system configured as root device, in read-only mode.
|
||||||
This enables fully state-less boots were the vendor-supplied OS is used as shipped, with only default
|
This enables fully state-less boots where the vendor-supplied OS is used as shipped, with only default
|
||||||
configuration and no stored state in effect, as <filename>/etc/</filename> and <filename>/var/</filename> (as
|
configuration and no stored state in effect, as <filename>/etc/</filename> and <filename>/var/</filename> (as
|
||||||
well as all other resources shipped in the root file system) are reset at boot and lost on shutdown. If this
|
well as all other resources shipped in the root file system) are reset at boot and lost on shutdown. If this
|
||||||
setting is set to <literal>state</literal> the root file system is mounted read-only, however
|
setting is set to <literal>state</literal> the root file system is mounted read-only, however
|
||||||
|
|||||||
@ -217,7 +217,6 @@ configure_file(
|
|||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
update_dbus_docs = custom_target(
|
update_dbus_docs = custom_target(
|
||||||
'update-dbus-docs-impl',
|
|
||||||
output : 'update-dbus-docs',
|
output : 'update-dbus-docs',
|
||||||
command : [update_dbus_docs_py, '--build-dir', meson.project_build_root(), '@INPUT@'],
|
command : [update_dbus_docs_py, '--build-dir', meson.project_build_root(), '@INPUT@'],
|
||||||
input : dbus_docs,
|
input : dbus_docs,
|
||||||
@ -237,7 +236,6 @@ if conf.get('BUILD_MODE_DEVELOPER') == 1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
update_man_rules = custom_target(
|
update_man_rules = custom_target(
|
||||||
'update-man-rules-impl',
|
|
||||||
output : 'update-man-rules',
|
output : 'update-man-rules',
|
||||||
command : [update_man_rules_py,
|
command : [update_man_rules_py,
|
||||||
'@0@/man/*.xml'.format(meson.project_source_root()),
|
'@0@/man/*.xml'.format(meson.project_source_root()),
|
||||||
|
|||||||
1
man/rules/.gitattributes
vendored
Normal file
1
man/rules/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
meson.build generated
|
||||||
@ -1,5 +1,3 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
|
|
||||||
# Do not edit. Generated by update-man-rules.py.
|
# Do not edit. Generated by update-man-rules.py.
|
||||||
# Update with:
|
# Update with:
|
||||||
# ninja -C build update-man-rules
|
# ninja -C build update-man-rules
|
||||||
|
|||||||
@ -75,13 +75,14 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Thread safety</title>
|
<title>Thread safety</title>
|
||||||
|
|
||||||
<para>Functions that operate on <structname>sd_journal</structname> objects are thread agnostic — given
|
<para>Functions that operate on <structname>sd_journal</structname> objects are thread agnostic — a given
|
||||||
<structname>sd_journal</structname> pointer may only be used from one specific thread at all times (and it has to
|
<structname>sd_journal</structname> pointer may only be used from one thread at a time, but multiple
|
||||||
be the very same one during the entire lifetime of the object), but multiple, independent threads may use multiple,
|
independent threads may use multiple objects concurrently. Some functions — those that are used to send
|
||||||
independent objects safely. Other functions — those that are used to send entries to the journal, like
|
entries to the journal, like
|
||||||
<citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry> and similar,
|
<citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
|
||||||
or those that are used to retrieve global information like
|
similar, or those that are used to retrieve global information like
|
||||||
<citerefentry><refentrytitle>sd_journal_stream_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
|
<citerefentry><refentrytitle>sd_journal_stream_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
|
and
|
||||||
<citerefentry><refentrytitle>sd_journal_get_catalog_for_message_id</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>sd_journal_get_catalog_for_message_id</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
— are fully thread-safe and may be called from multiple threads in parallel.</para>
|
— are fully thread-safe and may be called from multiple threads in parallel.</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|||||||
@ -41,10 +41,10 @@
|
|||||||
system.</para>
|
system.</para>
|
||||||
|
|
||||||
<para>Note that these APIs only allow purely passive access and
|
<para>Note that these APIs only allow purely passive access and
|
||||||
monitoring of seats, sessions and users. To actively make changes
|
monitoring of seats, sessions, and users. To actively make changes
|
||||||
to the seat configuration, terminate login sessions, or switch
|
to the seat configuration, terminate login sessions, or switch
|
||||||
session on a seat you need to utilize the D-Bus API of
|
session on a seat you need to utilize the D-Bus API of
|
||||||
systemd-logind, instead.</para>
|
systemd-logind instead.</para>
|
||||||
|
|
||||||
<para>These functions synchronously access data in
|
<para>These functions synchronously access data in
|
||||||
<filename>/proc/</filename>, <filename>/sys/fs/cgroup/</filename>
|
<filename>/proc/</filename>, <filename>/sys/fs/cgroup/</filename>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
other.</para>
|
other.</para>
|
||||||
|
|
||||||
<para>If the functions return string arrays, these are generally
|
<para>If the functions return string arrays, these are generally
|
||||||
<constant>NULL</constant> terminated and need to be freed by the
|
<constant>NULL</constant>-terminated and need to be freed by the
|
||||||
caller with the libc
|
caller with the libc
|
||||||
<citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
<citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
call after use, including the strings referenced therein.
|
call after use, including the strings referenced therein.
|
||||||
|
|||||||
@ -84,14 +84,12 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Notes</title>
|
<title>Notes</title>
|
||||||
|
|
||||||
<para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only
|
<para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only a single thread
|
||||||
a single specific thread may operate on a given object during its entire lifetime. It is safe to allocate multiple
|
may operate on a given object at any given time. Multiple independent objects may be used from different
|
||||||
independent objects and use each from a specific thread in parallel. However, it is not safe to allocate such an
|
threads in parallel.</para>
|
||||||
object in one thread, and operate or free it from any other, even if locking is used to ensure these threads do not
|
|
||||||
operate on it at the very same time.</para>
|
|
||||||
|
|
||||||
<para>Function <function>sd_journal_get_catalog_for_message_id()</function> is are thread-safe and may be called in
|
<para>Function <function>sd_journal_get_catalog_for_message_id()</function> is thread-safe and may be
|
||||||
parallel from multiple threads.</para>
|
called from multiple threads in parallel.</para>
|
||||||
|
|
||||||
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
|
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|||||||
@ -6,10 +6,9 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title/>
|
<title/>
|
||||||
|
|
||||||
<para id="strict">All functions listed here are thread-agnostic and only a single specific thread may operate on a
|
<para id="strict">All functions listed here are thread-agnostic and only a single thread may operate on a
|
||||||
given object during its entire lifetime. It is safe to allocate multiple independent objects and use each from a
|
given object at any given time. Different threads may access the same object at different times. Multiple
|
||||||
specific thread in parallel. However, it is not safe to allocate such an object in one thread, and operate or free it
|
independent objects may be used from different threads in parallel.</para>
|
||||||
from any other, even if locking is used to ensure these threads do not operate on it at the very same time.</para>
|
|
||||||
|
|
||||||
<para id="safe">All functions listed here are thread-safe and may be called in parallel from multiple threads.</para>
|
<para id="safe">All functions listed here are thread-safe and may be called in parallel from multiple threads.</para>
|
||||||
|
|
||||||
|
|||||||
@ -2743,11 +2743,11 @@ foreach executable : ['systemd-journal-remote', 'systemd-sbsign', 'systemd-keyut
|
|||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
if mkosi.found()
|
if mkosi.found()
|
||||||
custom_target('mkosi',
|
custom_target(
|
||||||
build_always_stale : true,
|
build_always_stale : true,
|
||||||
build_by_default: false,
|
build_by_default: false,
|
||||||
console : true,
|
console : true,
|
||||||
output : '.',
|
output : 'mkosi',
|
||||||
command : [
|
command : [
|
||||||
mkosi,
|
mkosi,
|
||||||
'--directory', meson.current_source_dir(),
|
'--directory', meson.current_source_dir(),
|
||||||
@ -2940,6 +2940,8 @@ run_target(
|
|||||||
libsystemd.full_path(),
|
libsystemd.full_path(),
|
||||||
libudev.full_path()])
|
libudev.full_path()])
|
||||||
|
|
||||||
|
alias_target('man', man)
|
||||||
|
alias_target('html', html)
|
||||||
alias_target('update-dbus-docs', update_dbus_docs)
|
alias_target('update-dbus-docs', update_dbus_docs)
|
||||||
alias_target('update-man-rules', update_man_rules)
|
alias_target('update-man-rules', update_man_rules)
|
||||||
|
|
||||||
|
|||||||
31
po/tr.po
31
po/tr.po
@ -5,14 +5,14 @@
|
|||||||
# Gökhan Gurbetoğlu <ggurbet@gmail.com>, 2015.
|
# Gökhan Gurbetoğlu <ggurbet@gmail.com>, 2015.
|
||||||
# Oğuz Ersen <oguzersen@protonmail.com>, 2020.
|
# Oğuz Ersen <oguzersen@protonmail.com>, 2020.
|
||||||
# Muhammet Kara <muhammetk@gmail.com>, 2015-2020.
|
# Muhammet Kara <muhammetk@gmail.com>, 2015-2020.
|
||||||
# Oğuz Ersen <oguz@ersen.moe>, 2022, 2023, 2024.
|
# Oğuz Ersen <oguz@ersen.moe>, 2022, 2023, 2024, 2025.
|
||||||
# Emir SARI <emir_sari@icloud.com>, 2025.
|
# Emir SARI <emir_sari@icloud.com>, 2025.
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2025-07-23 15:38+0100\n"
|
"POT-Creation-Date: 2025-07-23 15:38+0100\n"
|
||||||
"PO-Revision-Date: 2025-07-29 19:53+0000\n"
|
"PO-Revision-Date: 2025-10-04 19:48+0000\n"
|
||||||
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
|
"Last-Translator: Oğuz Ersen <oguz@ersen.moe>\n"
|
||||||
"Language-Team: Turkish <https://translate.fedoraproject.org/projects/systemd/"
|
"Language-Team: Turkish <https://translate.fedoraproject.org/projects/systemd/"
|
||||||
"main/tr/>\n"
|
"main/tr/>\n"
|
||||||
"Language: tr\n"
|
"Language: tr\n"
|
||||||
@ -20,7 +20,7 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||||
"X-Generator: Weblate 5.12.2\n"
|
"X-Generator: Weblate 5.13.3\n"
|
||||||
|
|
||||||
#: src/core/org.freedesktop.systemd1.policy.in:22
|
#: src/core/org.freedesktop.systemd1.policy.in:22
|
||||||
msgid "Send passphrase back to system"
|
msgid "Send passphrase back to system"
|
||||||
@ -928,19 +928,14 @@ msgstr ""
|
|||||||
"gereklidir."
|
"gereklidir."
|
||||||
|
|
||||||
#: src/machine/org.freedesktop.machine1.policy:106
|
#: src/machine/org.freedesktop.machine1.policy:106
|
||||||
#, fuzzy
|
|
||||||
#| msgid "Create a local virtual machine or container"
|
|
||||||
msgid "Register a local virtual machine or container"
|
msgid "Register a local virtual machine or container"
|
||||||
msgstr "Yerel sanal makine veya kapsayıcı oluştur"
|
msgstr "Yerel sanal makine veya kapsayıcı kaydet"
|
||||||
|
|
||||||
#: src/machine/org.freedesktop.machine1.policy:107
|
#: src/machine/org.freedesktop.machine1.policy:107
|
||||||
#, fuzzy
|
|
||||||
#| msgid ""
|
|
||||||
#| "Authentication is required to create a local virtual machine or container."
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Authentication is required to register a local virtual machine or container."
|
"Authentication is required to register a local virtual machine or container."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Yerel sanal makine veya kapsayıcı oluşturmak için kimlik doğrulaması "
|
"Yerel sanal makine veya kapsayıcı kaydetmek için kimlik doğrulaması "
|
||||||
"gereklidir."
|
"gereklidir."
|
||||||
|
|
||||||
#: src/machine/org.freedesktop.machine1.policy:116
|
#: src/machine/org.freedesktop.machine1.policy:116
|
||||||
@ -1181,13 +1176,11 @@ msgstr "Arama sonuçlarına abone olmak için kimlik doğrulaması gereklidir."
|
|||||||
|
|
||||||
#: src/resolve/org.freedesktop.resolve1.policy:154
|
#: src/resolve/org.freedesktop.resolve1.policy:154
|
||||||
msgid "Subscribe to DNS configuration"
|
msgid "Subscribe to DNS configuration"
|
||||||
msgstr ""
|
msgstr "DNS yapılandırmasına abone ol"
|
||||||
|
|
||||||
#: src/resolve/org.freedesktop.resolve1.policy:155
|
#: src/resolve/org.freedesktop.resolve1.policy:155
|
||||||
#, fuzzy
|
|
||||||
#| msgid "Authentication is required to subscribe query results."
|
|
||||||
msgid "Authentication is required to subscribe to DNS configuration."
|
msgid "Authentication is required to subscribe to DNS configuration."
|
||||||
msgstr "Arama sonuçlarına abone olmak için kimlik doğrulaması gereklidir."
|
msgstr "DNS yapılandırmasına abone olmak için kimlik doğrulaması gereklidir."
|
||||||
|
|
||||||
#: src/resolve/org.freedesktop.resolve1.policy:165
|
#: src/resolve/org.freedesktop.resolve1.policy:165
|
||||||
msgid "Dump cache"
|
msgid "Dump cache"
|
||||||
@ -1330,16 +1323,12 @@ msgstr ""
|
|||||||
"gereklidir."
|
"gereklidir."
|
||||||
|
|
||||||
#: src/core/dbus-unit.c:620
|
#: src/core/dbus-unit.c:620
|
||||||
#, fuzzy
|
|
||||||
#| msgid ""
|
|
||||||
#| "Authentication is required to send a UNIX signal to the processes of "
|
|
||||||
#| "'$(unit)'."
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Authentication is required to send a UNIX signal to the processes of "
|
"Authentication is required to send a UNIX signal to the processes of "
|
||||||
"subgroup of '$(unit)'."
|
"subgroup of '$(unit)'."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"'$(unit)' süreçlerine bir UNIX sinyali göndermek için kimlik doğrulaması "
|
"'$(unit)' alt gruplarının süreçlerine bir UNIX sinyali göndermek için kimlik "
|
||||||
"gereklidir."
|
"doğrulaması gereklidir."
|
||||||
|
|
||||||
#: src/core/dbus-unit.c:648
|
#: src/core/dbus-unit.c:648
|
||||||
msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
|
msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."
|
||||||
|
|||||||
@ -472,10 +472,9 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_RECURSIVE_ERRORS:
|
case ARG_RECURSIVE_ERRORS:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(recursive_errors, RecursiveErrors, _RECURSIVE_ERRORS_MAX);
|
return DUMP_STRING_TABLE(recursive_errors, RecursiveErrors, _RECURSIVE_ERRORS_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
r = recursive_errors_from_string(optarg);
|
r = recursive_errors_from_string(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Unknown mode passed to --recursive-errors='%s'.", optarg);
|
return log_error_errno(r, "Unknown mode passed to --recursive-errors='%s'.", optarg);
|
||||||
|
|||||||
@ -1013,6 +1013,8 @@ static void config_defaults_load_from_file(Config *config, char *content) {
|
|||||||
assert(config);
|
assert(config);
|
||||||
assert(content);
|
assert(content);
|
||||||
|
|
||||||
|
/* If you add, remove, or change an option name here, please also update
|
||||||
|
* shared/bootspec.c@boot_loader_read_conf() to make parsing by bootctl/logind/etc. work. */
|
||||||
while ((line = line_get_key_value(content, " \t", &pos, &key, &value)))
|
while ((line = line_get_key_value(content, " \t", &pos, &key, &value)))
|
||||||
if (streq8(key, "timeout")) {
|
if (streq8(key, "timeout")) {
|
||||||
if (streq8(value, "menu-disabled"))
|
if (streq8(value, "menu-disabled"))
|
||||||
@ -1291,6 +1293,8 @@ static void boot_entry_add_type1(
|
|||||||
.call = call_image_start,
|
.call = call_image_start,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* If you add, remove, or change an option name here, please also update shared/bootspec.c and
|
||||||
|
* shared/varlink-io.systemd.BootControl to make parsing by bootctl/logind/etc. work. */
|
||||||
while ((line = line_get_key_value(content, " \t", &pos, &key, &value)))
|
while ((line = line_get_key_value(content, " \t", &pos, &key, &value)))
|
||||||
if (streq8(key, "title")) {
|
if (streq8(key, "title")) {
|
||||||
free(entry->title);
|
free(entry->title);
|
||||||
@ -1299,6 +1303,7 @@ static void boot_entry_add_type1(
|
|||||||
} else if (streq8(key, "sort-key")) {
|
} else if (streq8(key, "sort-key")) {
|
||||||
free(entry->sort_key);
|
free(entry->sort_key);
|
||||||
entry->sort_key = xstr8_to_16(value);
|
entry->sort_key = xstr8_to_16(value);
|
||||||
|
|
||||||
} else if (streq8(key, "profile")) {
|
} else if (streq8(key, "profile")) {
|
||||||
uint64_t u;
|
uint64_t u;
|
||||||
if (parse_number8(value, &u, NULL) && u <= UINT_MAX)
|
if (parse_number8(value, &u, NULL) && u <= UINT_MAX)
|
||||||
|
|||||||
@ -732,6 +732,9 @@ static int count_known_files(const BootConfig *config, const char* root, Hashmap
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
r = ref_file(&known_files, e->efi, +1);
|
r = ref_file(&known_files, e->efi, +1);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
r = ref_file(&known_files, e->uki, +1);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
STRV_FOREACH(s, e->initrd) {
|
STRV_FOREACH(s, e->initrd) {
|
||||||
@ -792,6 +795,7 @@ static int unlink_entry(const BootConfig *config, const char *root, const char *
|
|||||||
|
|
||||||
deref_unlink_file(&known_files, e->kernel, e->root);
|
deref_unlink_file(&known_files, e->kernel, e->root);
|
||||||
deref_unlink_file(&known_files, e->efi, e->root);
|
deref_unlink_file(&known_files, e->efi, e->root);
|
||||||
|
deref_unlink_file(&known_files, e->uki, e->root);
|
||||||
STRV_FOREACH(s, e->initrd)
|
STRV_FOREACH(s, e->initrd)
|
||||||
deref_unlink_file(&known_files, *s, e->root);
|
deref_unlink_file(&known_files, *s, e->root);
|
||||||
deref_unlink_file(&known_files, e->device_tree, e->root);
|
deref_unlink_file(&known_files, e->device_tree, e->root);
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#include "process-util.h"
|
#include "process-util.h"
|
||||||
#include "procfs-util.h"
|
#include "procfs-util.h"
|
||||||
#include "sort-util.h"
|
#include "sort-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
#include "terminal-util.h"
|
#include "terminal-util.h"
|
||||||
#include "time-util.h"
|
#include "time-util.h"
|
||||||
#include "virt.h"
|
#include "virt.h"
|
||||||
@ -54,6 +55,23 @@ typedef enum PidsCount {
|
|||||||
COUNT_PIDS, /* most, requires pids controller */
|
COUNT_PIDS, /* most, requires pids controller */
|
||||||
} PidsCount;
|
} PidsCount;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ORDER_PATH,
|
||||||
|
ORDER_TASKS,
|
||||||
|
ORDER_CPU,
|
||||||
|
ORDER_MEMORY,
|
||||||
|
ORDER_IO,
|
||||||
|
_ORDER_MAX,
|
||||||
|
_ORDER_INVALID = -EINVAL,
|
||||||
|
} Order;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CPU_PERCENTAGE,
|
||||||
|
CPU_TIME,
|
||||||
|
_CPU_MAX,
|
||||||
|
_CPU_INVALID = -EINVAL,
|
||||||
|
} CPUType;
|
||||||
|
|
||||||
static unsigned arg_depth = 3;
|
static unsigned arg_depth = 3;
|
||||||
static unsigned arg_iterations = UINT_MAX;
|
static unsigned arg_iterations = UINT_MAX;
|
||||||
static bool arg_batch = false;
|
static bool arg_batch = false;
|
||||||
@ -63,21 +81,26 @@ static char* arg_machine = NULL;
|
|||||||
static char* arg_root = NULL;
|
static char* arg_root = NULL;
|
||||||
static bool arg_recursive = true;
|
static bool arg_recursive = true;
|
||||||
static bool arg_recursive_unset = false;
|
static bool arg_recursive_unset = false;
|
||||||
|
|
||||||
static PidsCount arg_count = COUNT_PIDS;
|
static PidsCount arg_count = COUNT_PIDS;
|
||||||
|
static Order arg_order = ORDER_CPU;
|
||||||
|
static CPUType arg_cpu_type = CPU_PERCENTAGE;
|
||||||
|
|
||||||
static enum {
|
static const char *order_table[_ORDER_MAX] = {
|
||||||
ORDER_PATH,
|
[ORDER_PATH] = "path",
|
||||||
ORDER_TASKS,
|
[ORDER_TASKS] = "tasks",
|
||||||
ORDER_CPU,
|
[ORDER_CPU] = "cpu",
|
||||||
ORDER_MEMORY,
|
[ORDER_MEMORY] = "memory",
|
||||||
ORDER_IO,
|
[ORDER_IO] = "io",
|
||||||
} arg_order = ORDER_CPU;
|
};
|
||||||
|
|
||||||
static enum {
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(order, Order);
|
||||||
CPU_PERCENT,
|
|
||||||
CPU_TIME,
|
static const char *cpu_type_table[_CPU_MAX] = {
|
||||||
} arg_cpu_type = CPU_PERCENT;
|
[CPU_PERCENTAGE] = "percentage",
|
||||||
|
[CPU_TIME] = "time",
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(cpu_type, CPUType);
|
||||||
|
|
||||||
static Group *group_free(Group *g) {
|
static Group *group_free(Group *g) {
|
||||||
if (!g)
|
if (!g)
|
||||||
@ -507,7 +530,7 @@ static int group_compare(Group * const *a, Group * const *b) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ORDER_CPU:
|
case ORDER_CPU:
|
||||||
if (arg_cpu_type == CPU_PERCENT) {
|
if (arg_cpu_type == CPU_PERCENTAGE) {
|
||||||
if (x->cpu_valid && y->cpu_valid) {
|
if (x->cpu_valid && y->cpu_valid) {
|
||||||
r = CMP(y->cpu_fraction, x->cpu_fraction);
|
r = CMP(y->cpu_fraction, x->cpu_fraction);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
@ -557,6 +580,12 @@ static int group_compare(Group * const *a, Group * const *b) {
|
|||||||
return -1;
|
return -1;
|
||||||
else if (y->io_valid)
|
else if (y->io_valid)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case _ORDER_MAX:
|
||||||
|
case _ORDER_INVALID:
|
||||||
|
assert_not_reached();
|
||||||
}
|
}
|
||||||
|
|
||||||
return path_compare(x->path, y->path);
|
return path_compare(x->path, y->path);
|
||||||
@ -595,7 +624,7 @@ static void display(Hashmap *a) {
|
|||||||
|
|
||||||
if (on_tty()) {
|
if (on_tty()) {
|
||||||
const char *on, *off;
|
const char *on, *off;
|
||||||
int cpu_len = arg_cpu_type == CPU_PERCENT ? 6 : maxtcpu;
|
int cpu_len = arg_cpu_type == CPU_PERCENTAGE ? 6 : maxtcpu;
|
||||||
|
|
||||||
path_columns = columns() - 36 - cpu_len;
|
path_columns = columns() - 36 - cpu_len;
|
||||||
if (path_columns < 10)
|
if (path_columns < 10)
|
||||||
@ -613,7 +642,7 @@ static void display(Hashmap *a) {
|
|||||||
arg_order == ORDER_TASKS ? off : "",
|
arg_order == ORDER_TASKS ? off : "",
|
||||||
arg_order == ORDER_CPU ? on : "",
|
arg_order == ORDER_CPU ? on : "",
|
||||||
cpu_len,
|
cpu_len,
|
||||||
arg_cpu_type == CPU_PERCENT ? "%CPU" : "CPU Time",
|
arg_cpu_type == CPU_PERCENTAGE ? "%CPU" : "CPU Time",
|
||||||
arg_order == ORDER_CPU ? off : "",
|
arg_order == ORDER_CPU ? off : "",
|
||||||
arg_order == ORDER_MEMORY ? on : "", "Memory",
|
arg_order == ORDER_MEMORY ? on : "", "Memory",
|
||||||
arg_order == ORDER_MEMORY ? off : "",
|
arg_order == ORDER_MEMORY ? off : "",
|
||||||
@ -643,7 +672,7 @@ static void display(Hashmap *a) {
|
|||||||
else
|
else
|
||||||
fputs(" -", stdout);
|
fputs(" -", stdout);
|
||||||
|
|
||||||
if (arg_cpu_type == CPU_PERCENT) {
|
if (arg_cpu_type == CPU_PERCENTAGE) {
|
||||||
if (g->cpu_valid)
|
if (g->cpu_valid)
|
||||||
printf(" %6.1f", g->cpu_fraction*100);
|
printf(" %6.1f", g->cpu_fraction*100);
|
||||||
else
|
else
|
||||||
@ -739,12 +768,9 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case ARG_CPU_TYPE:
|
case ARG_CPU_TYPE:
|
||||||
if (optarg) {
|
if (optarg) {
|
||||||
if (streq(optarg, "time"))
|
arg_cpu_type = cpu_type_from_string(optarg);
|
||||||
arg_cpu_type = CPU_TIME;
|
if (arg_cpu_type < 0)
|
||||||
else if (streq(optarg, "percentage"))
|
return log_error_errno(arg_cpu_type,
|
||||||
arg_cpu_type = CPU_PERCENT;
|
|
||||||
else
|
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
|
||||||
"Unknown argument to --cpu=: %s",
|
"Unknown argument to --cpu=: %s",
|
||||||
optarg);
|
optarg);
|
||||||
} else
|
} else
|
||||||
@ -810,18 +836,9 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_ORDER:
|
case ARG_ORDER:
|
||||||
if (streq(optarg, "path"))
|
arg_order = order_from_string(optarg);
|
||||||
arg_order = ORDER_PATH;
|
if (arg_order < 0)
|
||||||
else if (streq(optarg, "tasks"))
|
return log_error_errno(arg_order,
|
||||||
arg_order = ORDER_TASKS;
|
|
||||||
else if (streq(optarg, "cpu"))
|
|
||||||
arg_order = ORDER_CPU;
|
|
||||||
else if (streq(optarg, "memory"))
|
|
||||||
arg_order = ORDER_MEMORY;
|
|
||||||
else if (streq(optarg, "io"))
|
|
||||||
arg_order = ORDER_IO;
|
|
||||||
else
|
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
|
||||||
"Invalid argument to --order=: %s",
|
"Invalid argument to --order=: %s",
|
||||||
optarg);
|
optarg);
|
||||||
break;
|
break;
|
||||||
@ -959,7 +976,7 @@ static int loop(const char *root) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '%':
|
case '%':
|
||||||
arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENT : CPU_TIME;
|
arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENTAGE : CPU_TIME;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'k':
|
case 'k':
|
||||||
|
|||||||
@ -255,6 +255,22 @@ static int console_setup(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int parse_timeout(const char *value, usec_t *ret) {
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
|
assert(value);
|
||||||
|
assert(ret);
|
||||||
|
|
||||||
|
if (streq(value, "default"))
|
||||||
|
*ret = USEC_INFINITY;
|
||||||
|
else if (streq(value, "off"))
|
||||||
|
*ret = 0;
|
||||||
|
else
|
||||||
|
r = parse_sec(value, ret);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
|
static int parse_proc_cmdline_item(const char *key, const char *value, void *data) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -456,16 +472,10 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||||||
if (proc_cmdline_value_missing(key, value))
|
if (proc_cmdline_value_missing(key, value))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (streq(value, "default"))
|
r = parse_timeout(value, &arg_runtime_watchdog);
|
||||||
arg_runtime_watchdog = USEC_INFINITY;
|
if (r < 0) {
|
||||||
else if (streq(value, "off"))
|
log_warning_errno(r, "Failed to parse systemd.watchdog_sec= argument '%s', ignoring: %m", value);
|
||||||
arg_runtime_watchdog = 0;
|
return 0;
|
||||||
else {
|
|
||||||
r = parse_sec(value, &arg_runtime_watchdog);
|
|
||||||
if (r < 0) {
|
|
||||||
log_warning_errno(r, "Failed to parse systemd.watchdog_sec= argument '%s', ignoring: %m", value);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_kexec_watchdog = arg_reboot_watchdog = arg_runtime_watchdog;
|
arg_kexec_watchdog = arg_reboot_watchdog = arg_runtime_watchdog;
|
||||||
@ -475,16 +485,10 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||||||
if (proc_cmdline_value_missing(key, value))
|
if (proc_cmdline_value_missing(key, value))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (streq(value, "default"))
|
r = parse_timeout(value, &arg_pretimeout_watchdog);
|
||||||
arg_pretimeout_watchdog = USEC_INFINITY;
|
if (r < 0) {
|
||||||
else if (streq(value, "off"))
|
log_warning_errno(r, "Failed to parse systemd.watchdog_pre_sec= argument '%s', ignoring: %m", value);
|
||||||
arg_pretimeout_watchdog = 0;
|
return 0;
|
||||||
else {
|
|
||||||
r = parse_sec(value, &arg_pretimeout_watchdog);
|
|
||||||
if (r < 0) {
|
|
||||||
log_warning_errno(r, "Failed to parse systemd.watchdog_pre_sec= argument '%s', ignoring: %m", value);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (proc_cmdline_key_streq(key, "systemd.watchdog_pretimeout_governor")) {
|
} else if (proc_cmdline_key_streq(key, "systemd.watchdog_pretimeout_governor")) {
|
||||||
|
|||||||
@ -109,16 +109,14 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_LIST:
|
case ARG_LIST:
|
||||||
DUMP_STRING_TABLE(virtualization, Virtualization, _VIRTUALIZATION_MAX);
|
return DUMP_STRING_TABLE(virtualization, Virtualization, _VIRTUALIZATION_MAX);
|
||||||
return 0;
|
|
||||||
|
|
||||||
case ARG_CVM:
|
case ARG_CVM:
|
||||||
arg_mode = ONLY_CVM;
|
arg_mode = ONLY_CVM;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case ARG_LIST_CVM:
|
case ARG_LIST_CVM:
|
||||||
DUMP_STRING_TABLE(confidential_virtualization, ConfidentialVirtualization, _CONFIDENTIAL_VIRTUALIZATION_MAX);
|
return DUMP_STRING_TABLE(confidential_virtualization, ConfidentialVirtualization, _CONFIDENTIAL_VIRTUALIZATION_MAX);
|
||||||
return 0;
|
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
@ -56,6 +56,7 @@
|
|||||||
#include "rlimit-util.h"
|
#include "rlimit-util.h"
|
||||||
#include "runtime-scope.h"
|
#include "runtime-scope.h"
|
||||||
#include "stat-util.h"
|
#include "stat-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "terminal-util.h"
|
#include "terminal-util.h"
|
||||||
@ -69,6 +70,14 @@
|
|||||||
#include "userdb.h"
|
#include "userdb.h"
|
||||||
#include "verbs.h"
|
#include "verbs.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
EXPORT_FORMAT_FULL, /* export the full record */
|
||||||
|
EXPORT_FORMAT_STRIPPED, /* strip "state" + "binding", but leave signature in place */
|
||||||
|
EXPORT_FORMAT_MINIMAL, /* also strip signature */
|
||||||
|
_EXPORT_FORMAT_MAX,
|
||||||
|
_EXPORT_FORMAT_INVALID = -EINVAL,
|
||||||
|
} ExportFormat;
|
||||||
|
|
||||||
static PagerFlags arg_pager_flags = 0;
|
static PagerFlags arg_pager_flags = 0;
|
||||||
static bool arg_legend = true;
|
static bool arg_legend = true;
|
||||||
static bool arg_ask_password = true;
|
static bool arg_ask_password = true;
|
||||||
@ -97,11 +106,7 @@ static bool arg_recovery_key = false;
|
|||||||
static sd_json_format_flags_t arg_json_format_flags = SD_JSON_FORMAT_OFF;
|
static sd_json_format_flags_t arg_json_format_flags = SD_JSON_FORMAT_OFF;
|
||||||
static bool arg_and_resize = false;
|
static bool arg_and_resize = false;
|
||||||
static bool arg_and_change_password = false;
|
static bool arg_and_change_password = false;
|
||||||
static enum {
|
static ExportFormat arg_export_format = EXPORT_FORMAT_FULL;
|
||||||
EXPORT_FORMAT_FULL, /* export the full record */
|
|
||||||
EXPORT_FORMAT_STRIPPED, /* strip "state" + "binding", but leave signature in place */
|
|
||||||
EXPORT_FORMAT_MINIMAL, /* also strip signature */
|
|
||||||
} arg_export_format = EXPORT_FORMAT_FULL;
|
|
||||||
static uint64_t arg_capability_bounding_set = UINT64_MAX;
|
static uint64_t arg_capability_bounding_set = UINT64_MAX;
|
||||||
static uint64_t arg_capability_ambient_set = UINT64_MAX;
|
static uint64_t arg_capability_ambient_set = UINT64_MAX;
|
||||||
static char *arg_blob_dir = NULL;
|
static char *arg_blob_dir = NULL;
|
||||||
@ -131,6 +136,14 @@ STATIC_DESTRUCTOR_REGISTER(arg_key_name, freep);
|
|||||||
|
|
||||||
static const BusLocator *bus_mgr;
|
static const BusLocator *bus_mgr;
|
||||||
|
|
||||||
|
static const char *export_format_table[_EXPORT_FORMAT_MAX] = {
|
||||||
|
[EXPORT_FORMAT_FULL] = "full",
|
||||||
|
[EXPORT_FORMAT_STRIPPED] = "stripped",
|
||||||
|
[EXPORT_FORMAT_MINIMAL] = "minimal",
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(export_format, ExportFormat);
|
||||||
|
|
||||||
static bool identity_properties_specified(void) {
|
static bool identity_properties_specified(void) {
|
||||||
return
|
return
|
||||||
arg_identity ||
|
arg_identity ||
|
||||||
@ -4732,18 +4745,12 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_EXPORT_FORMAT:
|
case ARG_EXPORT_FORMAT:
|
||||||
if (streq(optarg, "full"))
|
if (streq(optarg, "help"))
|
||||||
arg_export_format = EXPORT_FORMAT_FULL;
|
return DUMP_STRING_TABLE(export_format, ExportFormat, _EXPORT_FORMAT_MAX);
|
||||||
else if (streq(optarg, "stripped"))
|
|
||||||
arg_export_format = EXPORT_FORMAT_STRIPPED;
|
arg_export_format = export_format_from_string(optarg);
|
||||||
else if (streq(optarg, "minimal"))
|
if (arg_export_format < 0)
|
||||||
arg_export_format = EXPORT_FORMAT_MINIMAL;
|
return log_error_errno(arg_export_format, "Invalid export format: %s", optarg);
|
||||||
else if (streq(optarg, "help")) {
|
|
||||||
puts("full\n"
|
|
||||||
"stripped\n"
|
|
||||||
"minimal");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -249,17 +249,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
return version();
|
return version();
|
||||||
|
|
||||||
case ARG_FORMAT:
|
case ARG_FORMAT:
|
||||||
if (streq(optarg, "uncompressed"))
|
arg_compress = import_compress_type_from_string(optarg);
|
||||||
arg_compress = IMPORT_COMPRESS_UNCOMPRESSED;
|
if (arg_compress < 0 || arg_compress == IMPORT_COMPRESS_UNKNOWN)
|
||||||
else if (streq(optarg, "xz"))
|
|
||||||
arg_compress = IMPORT_COMPRESS_XZ;
|
|
||||||
else if (streq(optarg, "gzip"))
|
|
||||||
arg_compress = IMPORT_COMPRESS_GZIP;
|
|
||||||
else if (streq(optarg, "bzip2"))
|
|
||||||
arg_compress = IMPORT_COMPRESS_BZIP2;
|
|
||||||
else if (streq(optarg, "zstd"))
|
|
||||||
arg_compress = IMPORT_COMPRESS_ZSTD;
|
|
||||||
else
|
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||||
"Unknown format: %s", optarg);
|
"Unknown format: %s", optarg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1127,10 +1127,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_VERIFY:
|
case ARG_VERIFY:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
|
return DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = import_verify_from_string(optarg);
|
r = import_verify_from_string(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|||||||
@ -476,10 +476,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_output = output_mode_from_string(optarg);
|
arg_output = output_mode_from_string(optarg);
|
||||||
if (arg_output < 0)
|
if (arg_output < 0)
|
||||||
|
|||||||
@ -1600,10 +1600,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_output = output_mode_from_string(optarg);
|
arg_output = output_mode_from_string(optarg);
|
||||||
if (arg_output < 0)
|
if (arg_output < 0)
|
||||||
|
|||||||
@ -2295,10 +2295,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = output_mode_from_string(optarg);
|
r = output_mode_from_string(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
@ -2354,10 +2352,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_VERIFY:
|
case ARG_VERIFY:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
|
return DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = import_verify_from_string(optarg);
|
r = import_verify_from_string(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|||||||
@ -914,6 +914,16 @@ static const char *const timezone_mode_table[_TIMEZONE_MODE_MAX] = {
|
|||||||
|
|
||||||
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(timezone_mode, TimezoneMode, TIMEZONE_AUTO);
|
DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(timezone_mode, TimezoneMode, TIMEZONE_AUTO);
|
||||||
|
|
||||||
|
static const char *const console_mode_table[_CONSOLE_MODE_MAX] = {
|
||||||
|
[CONSOLE_AUTOPIPE] = "autopipe",
|
||||||
|
[CONSOLE_INTERACTIVE] = "interactive",
|
||||||
|
[CONSOLE_READ_ONLY] = "read-only",
|
||||||
|
[CONSOLE_PASSIVE] = "passive",
|
||||||
|
[CONSOLE_PIPE] = "pipe",
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_STRING_TABLE_LOOKUP(console_mode, ConsoleMode);
|
||||||
|
|
||||||
DEFINE_CONFIG_PARSE_ENUM(config_parse_userns_ownership, user_namespace_ownership, UserNamespaceOwnership);
|
DEFINE_CONFIG_PARSE_ENUM(config_parse_userns_ownership, user_namespace_ownership, UserNamespaceOwnership);
|
||||||
|
|
||||||
static const char *const user_namespace_ownership_table[_USER_NAMESPACE_OWNERSHIP_MAX] = {
|
static const char *const user_namespace_ownership_table[_USER_NAMESPACE_OWNERSHIP_MAX] = {
|
||||||
|
|||||||
@ -82,6 +82,7 @@ typedef enum TimezoneMode {
|
|||||||
} TimezoneMode;
|
} TimezoneMode;
|
||||||
|
|
||||||
typedef enum ConsoleMode {
|
typedef enum ConsoleMode {
|
||||||
|
CONSOLE_AUTOPIPE,
|
||||||
CONSOLE_INTERACTIVE,
|
CONSOLE_INTERACTIVE,
|
||||||
CONSOLE_READ_ONLY,
|
CONSOLE_READ_ONLY,
|
||||||
CONSOLE_PASSIVE,
|
CONSOLE_PASSIVE,
|
||||||
@ -282,6 +283,9 @@ ResolvConfMode resolv_conf_mode_from_string(const char *s) _pure_;
|
|||||||
const char* timezone_mode_to_string(TimezoneMode a) _const_;
|
const char* timezone_mode_to_string(TimezoneMode a) _const_;
|
||||||
TimezoneMode timezone_mode_from_string(const char *s) _pure_;
|
TimezoneMode timezone_mode_from_string(const char *s) _pure_;
|
||||||
|
|
||||||
|
const char* console_mode_to_string(ConsoleMode m) _const_;
|
||||||
|
ConsoleMode console_mode_from_string(const char *s) _pure_;
|
||||||
|
|
||||||
const char* user_namespace_ownership_to_string(UserNamespaceOwnership a) _const_;
|
const char* user_namespace_ownership_to_string(UserNamespaceOwnership a) _const_;
|
||||||
UserNamespaceOwnership user_namespace_ownership_from_string(const char *s) _pure_;
|
UserNamespaceOwnership user_namespace_ownership_from_string(const char *s) _pure_;
|
||||||
|
|
||||||
|
|||||||
@ -286,42 +286,6 @@ STATIC_DESTRUCTOR_REGISTER(arg_settings_filename, freep);
|
|||||||
STATIC_DESTRUCTOR_REGISTER(arg_image_policy, image_policy_freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_image_policy, image_policy_freep);
|
||||||
STATIC_DESTRUCTOR_REGISTER(arg_background, freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_background, freep);
|
||||||
|
|
||||||
static int handle_arg_console(const char *arg) {
|
|
||||||
if (streq(arg, "help")) {
|
|
||||||
puts("autopipe\n"
|
|
||||||
"interactive\n"
|
|
||||||
"passive\n"
|
|
||||||
"pipe\n"
|
|
||||||
"read-only");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (streq(arg, "interactive"))
|
|
||||||
arg_console_mode = CONSOLE_INTERACTIVE;
|
|
||||||
else if (streq(arg, "read-only"))
|
|
||||||
arg_console_mode = CONSOLE_READ_ONLY;
|
|
||||||
else if (streq(arg, "passive"))
|
|
||||||
arg_console_mode = CONSOLE_PASSIVE;
|
|
||||||
else if (streq(arg, "pipe")) {
|
|
||||||
if (isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO))
|
|
||||||
log_full(arg_quiet ? LOG_DEBUG : LOG_NOTICE,
|
|
||||||
"Console mode 'pipe' selected, but standard input/output are connected to an interactive TTY. "
|
|
||||||
"Most likely you want to use 'interactive' console mode for proper interactivity and shell job control. "
|
|
||||||
"Proceeding anyway.");
|
|
||||||
|
|
||||||
arg_console_mode = CONSOLE_PIPE;
|
|
||||||
} else if (streq(arg, "autopipe")) {
|
|
||||||
if (isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO))
|
|
||||||
arg_console_mode = CONSOLE_INTERACTIVE;
|
|
||||||
else
|
|
||||||
arg_console_mode = CONSOLE_PIPE;
|
|
||||||
} else
|
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown console mode: %s", optarg);
|
|
||||||
|
|
||||||
arg_settings_mask |= SETTING_CONSOLE_MODE;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int help(void) {
|
static int help(void) {
|
||||||
_cleanup_free_ char *link = NULL;
|
_cleanup_free_ char *link = NULL;
|
||||||
int r;
|
int r;
|
||||||
@ -1133,10 +1097,9 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
|
|
||||||
if (!optarg)
|
if (!optarg)
|
||||||
arg_volatile_mode = VOLATILE_YES;
|
arg_volatile_mode = VOLATILE_YES;
|
||||||
else if (streq(optarg, "help")) {
|
else if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(volatile_mode, VolatileMode, _VOLATILE_MODE_MAX);
|
return DUMP_STRING_TABLE(volatile_mode, VolatileMode, _VOLATILE_MODE_MAX);
|
||||||
return 0;
|
else {
|
||||||
} else {
|
|
||||||
VolatileMode m;
|
VolatileMode m;
|
||||||
|
|
||||||
m = volatile_mode_from_string(optarg);
|
m = volatile_mode_from_string(optarg);
|
||||||
@ -1238,10 +1201,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_PRIVATE_USERS_OWNERSHIP:
|
case ARG_PRIVATE_USERS_OWNERSHIP:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(user_namespace_ownership, UserNamespaceOwnership, _USER_NAMESPACE_OWNERSHIP_MAX);
|
return DUMP_STRING_TABLE(user_namespace_ownership, UserNamespaceOwnership, _USER_NAMESPACE_OWNERSHIP_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_userns_ownership = user_namespace_ownership_from_string(optarg);
|
arg_userns_ownership = user_namespace_ownership_from_string(optarg);
|
||||||
if (arg_userns_ownership < 0)
|
if (arg_userns_ownership < 0)
|
||||||
@ -1251,10 +1212,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_KILL_SIGNAL:
|
case ARG_KILL_SIGNAL:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(signal, int, _NSIG);
|
return DUMP_STRING_TABLE(signal, int, _NSIG);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_kill_signal = signal_from_string(optarg);
|
arg_kill_signal = signal_from_string(optarg);
|
||||||
if (arg_kill_signal < 0)
|
if (arg_kill_signal < 0)
|
||||||
@ -1413,10 +1372,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
_cleanup_free_ char *name = NULL;
|
_cleanup_free_ char *name = NULL;
|
||||||
int rl;
|
int rl;
|
||||||
|
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(rlimit, int, _RLIMIT_MAX);
|
return DUMP_STRING_TABLE(rlimit, int, _RLIMIT_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
eq = strchr(optarg, '=');
|
eq = strchr(optarg, '=');
|
||||||
if (!eq)
|
if (!eq)
|
||||||
@ -1467,10 +1424,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ARG_RESOLV_CONF:
|
case ARG_RESOLV_CONF:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(resolv_conf_mode, ResolvConfMode, _RESOLV_CONF_MODE_MAX);
|
return DUMP_STRING_TABLE(resolv_conf_mode, ResolvConfMode, _RESOLV_CONF_MODE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_resolv_conf = resolv_conf_mode_from_string(optarg);
|
arg_resolv_conf = resolv_conf_mode_from_string(optarg);
|
||||||
if (arg_resolv_conf < 0)
|
if (arg_resolv_conf < 0)
|
||||||
@ -1481,10 +1436,8 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_TIMEZONE:
|
case ARG_TIMEZONE:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(timezone_mode, TimezoneMode, _TIMEZONE_MODE_MAX);
|
return DUMP_STRING_TABLE(timezone_mode, TimezoneMode, _TIMEZONE_MODE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_timezone = timezone_mode_from_string(optarg);
|
arg_timezone = timezone_mode_from_string(optarg);
|
||||||
if (arg_timezone < 0)
|
if (arg_timezone < 0)
|
||||||
@ -1495,16 +1448,21 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_CONSOLE:
|
case ARG_CONSOLE:
|
||||||
r = handle_arg_console(optarg);
|
if (streq(optarg, "help"))
|
||||||
if (r <= 0)
|
return DUMP_STRING_TABLE(console_mode, ConsoleMode, _CONSOLE_MODE_MAX);
|
||||||
return r;
|
|
||||||
|
arg_console_mode = console_mode_from_string(optarg);
|
||||||
|
if (arg_console_mode < 0)
|
||||||
|
return log_error_errno(arg_console_mode, "Unknown console mode: %s", optarg);
|
||||||
|
|
||||||
|
arg_settings_mask |= SETTING_CONSOLE_MODE;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
case ARG_PIPE:
|
case ARG_PIPE:
|
||||||
r = handle_arg_console("pipe");
|
arg_console_mode = CONSOLE_PIPE;
|
||||||
if (r <= 0)
|
arg_settings_mask |= SETTING_CONSOLE_MODE;
|
||||||
return r;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_NO_PAGER:
|
case ARG_NO_PAGER:
|
||||||
@ -1738,6 +1696,12 @@ static int verify_arguments(void) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
if (arg_console_mode == CONSOLE_PIPE && isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO))
|
||||||
|
log_full(arg_quiet ? LOG_DEBUG : LOG_NOTICE,
|
||||||
|
"Console mode 'pipe' selected, but standard input/output are connected to an interactive TTY. "
|
||||||
|
"Most likely you want to use 'interactive' console mode for proper interactivity and shell job control. "
|
||||||
|
"Proceeding anyway.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5983,6 +5947,13 @@ static int run(int argc, char *argv[]) {
|
|||||||
arg_console_mode = isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO) ?
|
arg_console_mode = isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO) ?
|
||||||
CONSOLE_INTERACTIVE : CONSOLE_READ_ONLY;
|
CONSOLE_INTERACTIVE : CONSOLE_READ_ONLY;
|
||||||
|
|
||||||
|
if (arg_console_mode == CONSOLE_AUTOPIPE) {
|
||||||
|
if (isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO))
|
||||||
|
arg_console_mode = CONSOLE_INTERACTIVE;
|
||||||
|
else
|
||||||
|
arg_console_mode = CONSOLE_PIPE;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg_console_mode == CONSOLE_PIPE) /* if we pass STDERR on to the container, don't add our own logs into it too */
|
if (arg_console_mode == CONSOLE_PIPE) /* if we pass STDERR on to the container, don't add our own logs into it too */
|
||||||
arg_quiet = true;
|
arg_quiet = true;
|
||||||
|
|
||||||
|
|||||||
@ -93,6 +93,7 @@ static void boot_entry_free(BootEntry *entry) {
|
|||||||
boot_entry_addons_done(&entry->local_addons);
|
boot_entry_addons_done(&entry->local_addons);
|
||||||
free(entry->kernel);
|
free(entry->kernel);
|
||||||
free(entry->efi);
|
free(entry->efi);
|
||||||
|
free(entry->uki);
|
||||||
strv_free(entry->initrd);
|
strv_free(entry->initrd);
|
||||||
free(entry->device_tree);
|
free(entry->device_tree);
|
||||||
strv_free(entry->device_tree_overlay);
|
strv_free(entry->device_tree_overlay);
|
||||||
@ -403,6 +404,10 @@ static int boot_entry_load_type1(
|
|||||||
r = parse_path_one(tmp.path, line, field, &tmp.kernel, p);
|
r = parse_path_one(tmp.path, line, field, &tmp.kernel, p);
|
||||||
else if (streq(field, "efi"))
|
else if (streq(field, "efi"))
|
||||||
r = parse_path_one(tmp.path, line, field, &tmp.efi, p);
|
r = parse_path_one(tmp.path, line, field, &tmp.efi, p);
|
||||||
|
else if (streq(field, "uki"))
|
||||||
|
r = parse_path_one(tmp.path, line, field, &tmp.uki, p);
|
||||||
|
else if (streq(field, "profile"))
|
||||||
|
r = safe_atou_full(p, 10, &tmp.profile);
|
||||||
else if (streq(field, "initrd"))
|
else if (streq(field, "initrd"))
|
||||||
r = parse_path_strv(tmp.path, line, field, &tmp.initrd, p);
|
r = parse_path_strv(tmp.path, line, field, &tmp.initrd, p);
|
||||||
else if (streq(field, "devicetree"))
|
else if (streq(field, "devicetree"))
|
||||||
@ -511,7 +516,8 @@ int boot_loader_read_conf(BootConfig *config, FILE *file, const char *path) {
|
|||||||
r = free_and_strdup(&config->default_pattern, p);
|
r = free_and_strdup(&config->default_pattern, p);
|
||||||
else if (STR_IN_SET(field, "timeout", "editor", "auto-entries", "auto-firmware",
|
else if (STR_IN_SET(field, "timeout", "editor", "auto-entries", "auto-firmware",
|
||||||
"auto-poweroff", "auto-reboot", "beep", "reboot-for-bitlocker",
|
"auto-poweroff", "auto-reboot", "beep", "reboot-for-bitlocker",
|
||||||
"secure-boot-enroll", "console-mode"))
|
"reboot-on-error", "secure-boot-enroll", "secure-boot-enroll-action",
|
||||||
|
"secure-boot-enroll-timeout-sec", "console-mode", "log-level"))
|
||||||
r = 0; /* we don't parse these in userspace, but they are OK */
|
r = 0; /* we don't parse these in userspace, but they are OK */
|
||||||
else {
|
else {
|
||||||
log_syntax(NULL, LOG_WARNING, path, line, 0, "Unknown line '%s', ignoring.", field);
|
log_syntax(NULL, LOG_WARNING, path, line, 0, "Unknown line '%s', ignoring.", field);
|
||||||
@ -1628,6 +1634,7 @@ int boot_config_augment_from_loader(
|
|||||||
.reported_by_loader = true,
|
.reported_by_loader = true,
|
||||||
.tries_left = UINT_MAX,
|
.tries_left = UINT_MAX,
|
||||||
.tries_done = UINT_MAX,
|
.tries_done = UINT_MAX,
|
||||||
|
.profile = UINT_MAX,
|
||||||
.global_addons = &no_addons,
|
.global_addons = &no_addons,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1896,6 +1903,10 @@ int show_boot_entry(
|
|||||||
boot_entry_file_list("linux", e->root, e->kernel, &status);
|
boot_entry_file_list("linux", e->root, e->kernel, &status);
|
||||||
if (e->efi)
|
if (e->efi)
|
||||||
boot_entry_file_list("efi", e->root, e->efi, &status);
|
boot_entry_file_list("efi", e->root, e->efi, &status);
|
||||||
|
if (e->uki)
|
||||||
|
boot_entry_file_list("uki", e->root, e->uki, &status);
|
||||||
|
if (e->profile != UINT_MAX)
|
||||||
|
printf(" profile: %u\n", e->profile);
|
||||||
|
|
||||||
STRV_FOREACH(s, e->initrd)
|
STRV_FOREACH(s, e->initrd)
|
||||||
boot_entry_file_list(s == e->initrd ? "initrd" : NULL,
|
boot_entry_file_list(s == e->initrd ? "initrd" : NULL,
|
||||||
@ -1957,9 +1968,9 @@ int boot_entry_to_json(const BootConfig *c, size_t i, sd_json_variant **ret) {
|
|||||||
SD_JSON_BUILD_PAIR_CONDITION(!!opts, "options", SD_JSON_BUILD_STRING(opts)),
|
SD_JSON_BUILD_PAIR_CONDITION(!!opts, "options", SD_JSON_BUILD_STRING(opts)),
|
||||||
SD_JSON_BUILD_PAIR_CONDITION(!!e->kernel, "linux", SD_JSON_BUILD_STRING(e->kernel)),
|
SD_JSON_BUILD_PAIR_CONDITION(!!e->kernel, "linux", SD_JSON_BUILD_STRING(e->kernel)),
|
||||||
SD_JSON_BUILD_PAIR_CONDITION(!!e->efi, "efi", SD_JSON_BUILD_STRING(e->efi)),
|
SD_JSON_BUILD_PAIR_CONDITION(!!e->efi, "efi", SD_JSON_BUILD_STRING(e->efi)),
|
||||||
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(e->initrd), "initrd", SD_JSON_BUILD_STRV(e->initrd)),
|
SD_JSON_BUILD_PAIR_CONDITION(!!e->uki, "uki", SD_JSON_BUILD_STRING(e->uki)),
|
||||||
SD_JSON_BUILD_PAIR_CONDITION(!!e->device_tree, "devicetree", SD_JSON_BUILD_STRING(e->device_tree)),
|
SD_JSON_BUILD_PAIR_CONDITION(e->profile != UINT_MAX, "profile", SD_JSON_BUILD_UNSIGNED(e->profile)),
|
||||||
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(e->device_tree_overlay), "devicetreeOverlay", SD_JSON_BUILD_STRV(e->device_tree_overlay)));
|
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(e->initrd), "initrd", SD_JSON_BUILD_STRV(e->initrd)));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
@ -1968,6 +1979,8 @@ int boot_entry_to_json(const BootConfig *c, size_t i, sd_json_variant **ret) {
|
|||||||
* at once. */
|
* at once. */
|
||||||
r = sd_json_variant_merge_objectbo(
|
r = sd_json_variant_merge_objectbo(
|
||||||
&v,
|
&v,
|
||||||
|
SD_JSON_BUILD_PAIR_CONDITION(!!e->device_tree, "devicetree", SD_JSON_BUILD_STRING(e->device_tree)),
|
||||||
|
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(e->device_tree_overlay), "devicetreeOverlay", SD_JSON_BUILD_STRV(e->device_tree_overlay)),
|
||||||
SD_JSON_BUILD_PAIR("isReported", SD_JSON_BUILD_BOOLEAN(e->reported_by_loader)),
|
SD_JSON_BUILD_PAIR("isReported", SD_JSON_BUILD_BOOLEAN(e->reported_by_loader)),
|
||||||
SD_JSON_BUILD_PAIR_CONDITION(e->tries_left != UINT_MAX, "triesLeft", SD_JSON_BUILD_UNSIGNED(e->tries_left)),
|
SD_JSON_BUILD_PAIR_CONDITION(e->tries_left != UINT_MAX, "triesLeft", SD_JSON_BUILD_UNSIGNED(e->tries_left)),
|
||||||
SD_JSON_BUILD_PAIR_CONDITION(e->tries_done != UINT_MAX, "triesDone", SD_JSON_BUILD_UNSIGNED(e->tries_done)),
|
SD_JSON_BUILD_PAIR_CONDITION(e->tries_done != UINT_MAX, "triesDone", SD_JSON_BUILD_UNSIGNED(e->tries_done)),
|
||||||
|
|||||||
@ -50,6 +50,7 @@ typedef struct BootEntry {
|
|||||||
const BootEntryAddons *global_addons; /* Backpointer into the BootConfig; we don't own this here */
|
const BootEntryAddons *global_addons; /* Backpointer into the BootConfig; we don't own this here */
|
||||||
char *kernel; /* linux is #defined to 1, yikes! */
|
char *kernel; /* linux is #defined to 1, yikes! */
|
||||||
char *efi;
|
char *efi;
|
||||||
|
char *uki;
|
||||||
char **initrd;
|
char **initrd;
|
||||||
char *device_tree;
|
char *device_tree;
|
||||||
char **device_tree_overlay;
|
char **device_tree_overlay;
|
||||||
@ -64,6 +65,7 @@ typedef struct BootEntry {
|
|||||||
.source = (s), \
|
.source = (s), \
|
||||||
.tries_left = UINT_MAX, \
|
.tries_left = UINT_MAX, \
|
||||||
.tries_done = UINT_MAX, \
|
.tries_done = UINT_MAX, \
|
||||||
|
.profile = UINT_MAX, \
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct BootConfig {
|
typedef struct BootConfig {
|
||||||
|
|||||||
@ -110,10 +110,8 @@ int parse_signal_argument(const char *s, int *ret) {
|
|||||||
assert(s);
|
assert(s);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
if (streq(s, "help")) {
|
if (streq(s, "help"))
|
||||||
DUMP_STRING_TABLE(signal, int, _NSIG);
|
return DUMP_STRING_TABLE(signal, int, _NSIG);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (streq(s, "list")) {
|
if (streq(s, "list")) {
|
||||||
_cleanup_(table_unrefp) Table *table = NULL;
|
_cleanup_(table_unrefp) Table *table = NULL;
|
||||||
|
|||||||
@ -47,6 +47,8 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
|||||||
SD_VARLINK_DEFINE_FIELD(options, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_FIELD(options, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_FIELD(linux, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_FIELD(linux, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_FIELD(efi, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_FIELD(efi, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
|
SD_VARLINK_DEFINE_FIELD(uki, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
|
SD_VARLINK_DEFINE_FIELD(profile, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_FIELD(initrd, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
SD_VARLINK_DEFINE_FIELD(initrd, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
||||||
SD_VARLINK_DEFINE_FIELD(devicetree, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_FIELD(devicetree, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_FIELD(devicetreeOverlay, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
SD_VARLINK_DEFINE_FIELD(devicetreeOverlay, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
||||||
|
|||||||
@ -2581,8 +2581,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
if (arg_legend)
|
if (arg_legend)
|
||||||
puts("Known mutability modes:");
|
puts("Known mutability modes:");
|
||||||
|
|
||||||
DUMP_STRING_TABLE(mutable_mode, MutableMode, _MUTABLE_MAX);
|
return DUMP_STRING_TABLE(mutable_mode, MutableMode, _MUTABLE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r = parse_mutable_mode(optarg);
|
r = parse_mutable_mode(optarg);
|
||||||
|
|||||||
@ -810,10 +810,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_output = output_mode_from_string(optarg);
|
arg_output = output_mode_from_string(optarg);
|
||||||
if (arg_output < 0)
|
if (arg_output < 0)
|
||||||
@ -899,10 +897,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_PRESET_MODE:
|
case ARG_PRESET_MODE:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(unit_file_preset_mode, UnitFilePresetMode, _UNIT_FILE_PRESET_MODE_MAX);
|
return DUMP_STRING_TABLE(unit_file_preset_mode, UnitFilePresetMode, _UNIT_FILE_PRESET_MODE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_preset_mode = unit_file_preset_mode_from_string(optarg);
|
arg_preset_mode = unit_file_preset_mode_from_string(optarg);
|
||||||
if (arg_preset_mode < 0)
|
if (arg_preset_mode < 0)
|
||||||
@ -964,10 +960,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_TIMESTAMP_STYLE:
|
case ARG_TIMESTAMP_STYLE:
|
||||||
if (streq(optarg, "help")) {
|
if (streq(optarg, "help"))
|
||||||
DUMP_STRING_TABLE(timestamp_style, TimestampStyle, _TIMESTAMP_STYLE_MAX);
|
return DUMP_STRING_TABLE(timestamp_style, TimestampStyle, _TIMESTAMP_STYLE_MAX);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_timestamp_style = timestamp_style_from_string(optarg);
|
arg_timestamp_style = timestamp_style_from_string(optarg);
|
||||||
if (arg_timestamp_style < 0)
|
if (arg_timestamp_style < 0)
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "pretty-print.h"
|
#include "pretty-print.h"
|
||||||
#include "recurse-dir.h"
|
#include "recurse-dir.h"
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "uid-classification.h"
|
#include "uid-classification.h"
|
||||||
@ -37,14 +38,16 @@
|
|||||||
#include "verbs.h"
|
#include "verbs.h"
|
||||||
#include "virt.h"
|
#include "virt.h"
|
||||||
|
|
||||||
static enum {
|
typedef enum {
|
||||||
OUTPUT_CLASSIC,
|
OUTPUT_CLASSIC,
|
||||||
OUTPUT_TABLE,
|
OUTPUT_TABLE,
|
||||||
OUTPUT_FRIENDLY,
|
OUTPUT_FRIENDLY,
|
||||||
OUTPUT_JSON,
|
OUTPUT_JSON,
|
||||||
|
_OUTPUT_MAX,
|
||||||
_OUTPUT_INVALID = -EINVAL,
|
_OUTPUT_INVALID = -EINVAL,
|
||||||
} arg_output = _OUTPUT_INVALID;
|
} Output;
|
||||||
|
|
||||||
|
static Output arg_output = _OUTPUT_INVALID;
|
||||||
static PagerFlags arg_pager_flags = 0;
|
static PagerFlags arg_pager_flags = 0;
|
||||||
static bool arg_legend = true;
|
static bool arg_legend = true;
|
||||||
static char** arg_services = NULL;
|
static char** arg_services = NULL;
|
||||||
@ -61,6 +64,15 @@ static sd_json_variant *arg_from_file = NULL;
|
|||||||
STATIC_DESTRUCTOR_REGISTER(arg_services, strv_freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_services, strv_freep);
|
||||||
STATIC_DESTRUCTOR_REGISTER(arg_from_file, sd_json_variant_unrefp);
|
STATIC_DESTRUCTOR_REGISTER(arg_from_file, sd_json_variant_unrefp);
|
||||||
|
|
||||||
|
static const char *output_table[_OUTPUT_MAX] = {
|
||||||
|
[OUTPUT_CLASSIC] = "classic",
|
||||||
|
[OUTPUT_TABLE] = "table",
|
||||||
|
[OUTPUT_FRIENDLY] = "friendly",
|
||||||
|
[OUTPUT_JSON] = "json",
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(output, Output);
|
||||||
|
|
||||||
static const char *user_disposition_to_color(UserDisposition d) {
|
static const char *user_disposition_to_color(UserDisposition d) {
|
||||||
assert(d >= 0);
|
assert(d >= 0);
|
||||||
assert(d < _USER_DISPOSITION_MAX);
|
assert(d < _USER_DISPOSITION_MAX);
|
||||||
@ -1652,24 +1664,12 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_OUTPUT:
|
case ARG_OUTPUT:
|
||||||
if (isempty(optarg))
|
if (streq(optarg, "help"))
|
||||||
arg_output = _OUTPUT_INVALID;
|
return DUMP_STRING_TABLE(output, Output, _OUTPUT_MAX);
|
||||||
else if (streq(optarg, "classic"))
|
|
||||||
arg_output = OUTPUT_CLASSIC;
|
arg_output = output_from_string(optarg);
|
||||||
else if (streq(optarg, "friendly"))
|
if (arg_output < 0)
|
||||||
arg_output = OUTPUT_FRIENDLY;
|
return log_error_errno(arg_output, "Invalid --output= mode: %s", optarg);
|
||||||
else if (streq(optarg, "json"))
|
|
||||||
arg_output = OUTPUT_JSON;
|
|
||||||
else if (streq(optarg, "table"))
|
|
||||||
arg_output = OUTPUT_TABLE;
|
|
||||||
else if (streq(optarg, "help")) {
|
|
||||||
puts("classic\n"
|
|
||||||
"friendly\n"
|
|
||||||
"json\n"
|
|
||||||
"table");
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid --output= mode: %s", optarg);
|
|
||||||
|
|
||||||
arg_json_format_flags = arg_output == OUTPUT_JSON ? SD_JSON_FORMAT_PRETTY|SD_JSON_FORMAT_COLOR_AUTO : SD_JSON_FORMAT_OFF;
|
arg_json_format_flags = arg_output == OUTPUT_JSON ? SD_JSON_FORMAT_PRETTY|SD_JSON_FORMAT_COLOR_AUTO : SD_JSON_FORMAT_OFF;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -13,16 +13,12 @@
|
|||||||
#include "path-util.h"
|
#include "path-util.h"
|
||||||
#include "pretty-print.h"
|
#include "pretty-print.h"
|
||||||
#include "stat-util.h"
|
#include "stat-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "vpick.h"
|
#include "vpick.h"
|
||||||
|
|
||||||
static char *arg_filter_basename = NULL;
|
typedef enum {
|
||||||
static char *arg_filter_version = NULL;
|
|
||||||
static Architecture arg_filter_architecture = _ARCHITECTURE_INVALID;
|
|
||||||
static char *arg_filter_suffix = NULL;
|
|
||||||
static uint32_t arg_filter_type_mask = 0;
|
|
||||||
static enum {
|
|
||||||
PRINT_PATH,
|
PRINT_PATH,
|
||||||
PRINT_FILENAME,
|
PRINT_FILENAME,
|
||||||
PRINT_VERSION,
|
PRINT_VERSION,
|
||||||
@ -30,14 +26,34 @@ static enum {
|
|||||||
PRINT_ARCHITECTURE,
|
PRINT_ARCHITECTURE,
|
||||||
PRINT_TRIES,
|
PRINT_TRIES,
|
||||||
PRINT_ALL,
|
PRINT_ALL,
|
||||||
|
_PRINT_MAX,
|
||||||
_PRINT_INVALID = -EINVAL,
|
_PRINT_INVALID = -EINVAL,
|
||||||
} arg_print = _PRINT_INVALID;
|
} Print;
|
||||||
|
|
||||||
|
static char *arg_filter_basename = NULL;
|
||||||
|
static char *arg_filter_version = NULL;
|
||||||
|
static Architecture arg_filter_architecture = _ARCHITECTURE_INVALID;
|
||||||
|
static char *arg_filter_suffix = NULL;
|
||||||
|
static uint32_t arg_filter_type_mask = 0;
|
||||||
|
static Print arg_print = _PRINT_INVALID;
|
||||||
static PickFlags arg_flags = PICK_ARCHITECTURE|PICK_TRIES;
|
static PickFlags arg_flags = PICK_ARCHITECTURE|PICK_TRIES;
|
||||||
|
|
||||||
STATIC_DESTRUCTOR_REGISTER(arg_filter_basename, freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_filter_basename, freep);
|
||||||
STATIC_DESTRUCTOR_REGISTER(arg_filter_version, freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_filter_version, freep);
|
||||||
STATIC_DESTRUCTOR_REGISTER(arg_filter_suffix, freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_filter_suffix, freep);
|
||||||
|
|
||||||
|
static const char *print_table[_PRINT_MAX] = {
|
||||||
|
[PRINT_PATH] = "path",
|
||||||
|
[PRINT_FILENAME] = "filename",
|
||||||
|
[PRINT_VERSION] = "version",
|
||||||
|
[PRINT_TYPE] = "type",
|
||||||
|
[PRINT_ARCHITECTURE] = "architecture",
|
||||||
|
[PRINT_TRIES] = "tries",
|
||||||
|
[PRINT_ALL] = "all",
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(print, Print);
|
||||||
|
|
||||||
static int help(void) {
|
static int help(void) {
|
||||||
_cleanup_free_ char *link = NULL;
|
_cleanup_free_ char *link = NULL;
|
||||||
int r;
|
int r;
|
||||||
@ -173,22 +189,12 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (streq(optarg, "path"))
|
if (streq(optarg, "arch")) /* accept abbreviation too */
|
||||||
arg_print = PRINT_PATH;
|
|
||||||
else if (streq(optarg, "filename"))
|
|
||||||
arg_print = PRINT_FILENAME;
|
|
||||||
else if (streq(optarg, "version"))
|
|
||||||
arg_print = PRINT_VERSION;
|
|
||||||
else if (streq(optarg, "type"))
|
|
||||||
arg_print = PRINT_TYPE;
|
|
||||||
else if (STR_IN_SET(optarg, "arch", "architecture"))
|
|
||||||
arg_print = PRINT_ARCHITECTURE;
|
arg_print = PRINT_ARCHITECTURE;
|
||||||
else if (streq(optarg, "tries"))
|
|
||||||
arg_print = PRINT_TRIES;
|
|
||||||
else if (streq(optarg, "all"))
|
|
||||||
arg_print = PRINT_ALL;
|
|
||||||
else
|
else
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown --print= argument: %s", optarg);
|
arg_print = print_from_string(optarg);
|
||||||
|
if (arg_print < 0)
|
||||||
|
return log_error_errno(arg_print, "Unknown --print= argument: %s", optarg);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -43,8 +43,17 @@ usermod -U root
|
|||||||
|
|
||||||
mkdir -p /etc/ssh
|
mkdir -p /etc/ssh
|
||||||
test -f /etc/ssh/ssh_host_rsa_key || ssh-keygen -t rsa -C '' -N '' -f /etc/ssh/ssh_host_rsa_key
|
test -f /etc/ssh/ssh_host_rsa_key || ssh-keygen -t rsa -C '' -N '' -f /etc/ssh/ssh_host_rsa_key
|
||||||
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
|
|
||||||
echo "LogLevel DEBUG3" >> /etc/ssh/sshd_config
|
SSHD_CONF_P="/etc/ssh/sshd_config.d/test.conf"
|
||||||
|
mkdir -p "$(basename ${SSHD_CONF_P})"
|
||||||
|
{
|
||||||
|
echo "PermitRootLogin yes"
|
||||||
|
echo "LogLevel DEBUG3"
|
||||||
|
} >"${SSHD_CONF_P}"
|
||||||
|
rm_sshd_conf() {
|
||||||
|
rm -f "${SSHD_CONF_P}"
|
||||||
|
}
|
||||||
|
trap rm_sshd_conf EXIT
|
||||||
|
|
||||||
test -f /etc/ssh/ssh_config || {
|
test -f /etc/ssh/ssh_config || {
|
||||||
echo 'Include /etc/ssh/ssh_config.d/*.conf'
|
echo 'Include /etc/ssh/ssh_config.d/*.conf'
|
||||||
|
|||||||
@ -49,8 +49,6 @@ def mjoin(files):
|
|||||||
return ' \\\n\t'.join(sorted(files) or '#')
|
return ' \\\n\t'.join(sorted(files) or '#')
|
||||||
|
|
||||||
MESON_HEADER = '''\
|
MESON_HEADER = '''\
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
|
|
||||||
# Do not edit. Generated by update-man-rules.py.
|
# Do not edit. Generated by update-man-rules.py.
|
||||||
# Update with:
|
# Update with:
|
||||||
# ninja -C build update-man-rules
|
# ninja -C build update-man-rules
|
||||||
|
|||||||
@ -82,7 +82,6 @@ foreach unit : units
|
|||||||
|
|
||||||
if needs_jinja
|
if needs_jinja
|
||||||
t = custom_target(
|
t = custom_target(
|
||||||
name,
|
|
||||||
input : source,
|
input : source,
|
||||||
output : name,
|
output : name,
|
||||||
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
|
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user