1
0
mirror of https://github.com/systemd/systemd synced 2025-11-21 17:54:46 +01:00

Compare commits

..

No commits in common. "b49bff0da7c10c9ee7084748099abc5d21b04cb3" and "ea44302b291d38d4935ed10188021130562b5720" have entirely different histories.

36 changed files with 294 additions and 300 deletions

View File

@ -166,7 +166,7 @@
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>),
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 where the vendor-supplied OS is used as shipped, with only default
This enables fully state-less boots were 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
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

View File

@ -217,6 +217,7 @@ configure_file(
############################################################
update_dbus_docs = custom_target(
'update-dbus-docs-impl',
output : 'update-dbus-docs',
command : [update_dbus_docs_py, '--build-dir', meson.project_build_root(), '@INPUT@'],
input : dbus_docs,
@ -236,6 +237,7 @@ if conf.get('BUILD_MODE_DEVELOPER') == 1
endif
update_man_rules = custom_target(
'update-man-rules-impl',
output : 'update-man-rules',
command : [update_man_rules_py,
'@0@/man/*.xml'.format(meson.project_source_root()),

View File

@ -1 +0,0 @@
meson.build generated

View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# Do not edit. Generated by update-man-rules.py.
# Update with:
# ninja -C build update-man-rules

View File

@ -75,14 +75,13 @@
<refsect1>
<title>Thread safety</title>
<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 thread at a time, but multiple
independent threads may use multiple objects concurrently. Some functions — those that are used to send
entries to the journal, like
<citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
similar, or those that are used to retrieve global information like
<citerefentry><refentrytitle>sd_journal_stream_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>
and
<para>Functions that operate on <structname>sd_journal</structname> objects are thread agnostic — given
<structname>sd_journal</structname> pointer may only be used from one specific thread at all times (and it has to
be the very same one during the entire lifetime of the object), but multiple, independent threads may use multiple,
independent objects safely. Other functions — those that are used to send entries to the journal, like
<citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry> and 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_get_catalog_for_message_id</refentrytitle><manvolnum>3</manvolnum></citerefentry>
— are fully thread-safe and may be called from multiple threads in parallel.</para>
</refsect1>

View File

@ -41,10 +41,10 @@
system.</para>
<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
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
<filename>/proc/</filename>, <filename>/sys/fs/cgroup/</filename>
@ -62,7 +62,7 @@
other.</para>
<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
<citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
call after use, including the strings referenced therein.

View File

@ -84,12 +84,14 @@
<refsect1>
<title>Notes</title>
<para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only a single thread
may operate on a given object at any given time. Multiple independent objects may be used from different
threads in parallel.</para>
<para>Function <function>sd_journal_get_catalog()</function> is thread-agnostic and only
a single specific thread may operate on a given object during its entire lifetime. It is safe to allocate multiple
independent objects and use each from a specific thread in parallel. However, it is not safe to allocate such an
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 thread-safe and may be
called from multiple threads in parallel.</para>
<para>Function <function>sd_journal_get_catalog_for_message_id()</function> is are thread-safe and may be called in
parallel from multiple threads.</para>
<xi:include href="libsystemd-pkgconfig.xml" xpointer="pkgconfig-text"/>
</refsect1>

View File

@ -6,9 +6,10 @@
<refsect1>
<title/>
<para id="strict">All functions listed here are thread-agnostic and only a single thread may operate on a
given object at any given time. Different threads may access the same object at different times. Multiple
independent objects may be used from different threads in parallel.</para>
<para id="strict">All functions listed here are thread-agnostic and only a single specific thread may operate on a
given object during its entire lifetime. It is safe to allocate multiple independent objects and use each from a
specific thread in parallel. However, it is not safe to allocate such an 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 id="safe">All functions listed here are thread-safe and may be called in parallel from multiple threads.</para>

View File

@ -2743,11 +2743,11 @@ foreach executable : ['systemd-journal-remote', 'systemd-sbsign', 'systemd-keyut
endforeach
if mkosi.found()
custom_target(
custom_target('mkosi',
build_always_stale : true,
build_by_default: false,
console : true,
output : 'mkosi',
output : '.',
command : [
mkosi,
'--directory', meson.current_source_dir(),
@ -2940,8 +2940,6 @@ run_target(
libsystemd.full_path(),
libudev.full_path()])
alias_target('man', man)
alias_target('html', html)
alias_target('update-dbus-docs', update_dbus_docs)
alias_target('update-man-rules', update_man_rules)

View File

@ -5,14 +5,14 @@
# Gökhan Gurbetoğlu <ggurbet@gmail.com>, 2015.
# Oğuz Ersen <oguzersen@protonmail.com>, 2020.
# Muhammet Kara <muhammetk@gmail.com>, 2015-2020.
# Oğuz Ersen <oguz@ersen.moe>, 2022, 2023, 2024, 2025.
# Oğuz Ersen <oguz@ersen.moe>, 2022, 2023, 2024.
# Emir SARI <emir_sari@icloud.com>, 2025.
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-23 15:38+0100\n"
"PO-Revision-Date: 2025-10-04 19:48+0000\n"
"Last-Translator: Oğuz Ersen <oguz@ersen.moe>\n"
"PO-Revision-Date: 2025-07-29 19:53+0000\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: Turkish <https://translate.fedoraproject.org/projects/systemd/"
"main/tr/>\n"
"Language: tr\n"
@ -20,7 +20,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.13.3\n"
"X-Generator: Weblate 5.12.2\n"
#: src/core/org.freedesktop.systemd1.policy.in:22
msgid "Send passphrase back to system"
@ -928,14 +928,19 @@ msgstr ""
"gereklidir."
#: src/machine/org.freedesktop.machine1.policy:106
#, fuzzy
#| msgid "Create a local virtual machine or container"
msgid "Register a local virtual machine or container"
msgstr "Yerel sanal makine veya kapsayıcı kaydet"
msgstr "Yerel sanal makine veya kapsayıcı oluştur"
#: src/machine/org.freedesktop.machine1.policy:107
#, fuzzy
#| msgid ""
#| "Authentication is required to create a local virtual machine or container."
msgid ""
"Authentication is required to register a local virtual machine or container."
msgstr ""
"Yerel sanal makine veya kapsayıcı kaydetmek için kimlik doğrulaması "
"Yerel sanal makine veya kapsayıcı oluşturmak için kimlik doğrulaması "
"gereklidir."
#: src/machine/org.freedesktop.machine1.policy:116
@ -1176,11 +1181,13 @@ msgstr "Arama sonuçlarına abone olmak için kimlik doğrulaması gereklidir."
#: src/resolve/org.freedesktop.resolve1.policy:154
msgid "Subscribe to DNS configuration"
msgstr "DNS yapılandırmasına abone ol"
msgstr ""
#: 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."
msgstr "DNS yapılandırmasına abone olmak için kimlik doğrulaması gereklidir."
msgstr "Arama sonuçlarına abone olmak için kimlik doğrulaması gereklidir."
#: src/resolve/org.freedesktop.resolve1.policy:165
msgid "Dump cache"
@ -1323,12 +1330,16 @@ msgstr ""
"gereklidir."
#: src/core/dbus-unit.c:620
#, fuzzy
#| msgid ""
#| "Authentication is required to send a UNIX signal to the processes of "
#| "'$(unit)'."
msgid ""
"Authentication is required to send a UNIX signal to the processes of "
"subgroup of '$(unit)'."
msgstr ""
"'$(unit)' alt gruplarının süreçlerine bir UNIX sinyali göndermek için kimlik "
"doğrulaması gereklidir."
"'$(unit)' süreçlerine bir UNIX sinyali göndermek için kimlik doğrulaması "
"gereklidir."
#: src/core/dbus-unit.c:648
msgid "Authentication is required to reset the \"failed\" state of '$(unit)'."

View File

@ -472,9 +472,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_RECURSIVE_ERRORS:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(recursive_errors, RecursiveErrors, _RECURSIVE_ERRORS_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(recursive_errors, RecursiveErrors, _RECURSIVE_ERRORS_MAX);
return 0;
}
r = recursive_errors_from_string(optarg);
if (r < 0)
return log_error_errno(r, "Unknown mode passed to --recursive-errors='%s'.", optarg);

View File

@ -1013,8 +1013,6 @@ static void config_defaults_load_from_file(Config *config, char *content) {
assert(config);
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)))
if (streq8(key, "timeout")) {
if (streq8(value, "menu-disabled"))
@ -1293,8 +1291,6 @@ static void boot_entry_add_type1(
.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)))
if (streq8(key, "title")) {
free(entry->title);
@ -1303,7 +1299,6 @@ static void boot_entry_add_type1(
} else if (streq8(key, "sort-key")) {
free(entry->sort_key);
entry->sort_key = xstr8_to_16(value);
} else if (streq8(key, "profile")) {
uint64_t u;
if (parse_number8(value, &u, NULL) && u <= UINT_MAX)

View File

@ -732,9 +732,6 @@ static int count_known_files(const BootConfig *config, const char* root, Hashmap
if (r < 0)
return r;
r = ref_file(&known_files, e->efi, +1);
if (r < 0)
return r;
r = ref_file(&known_files, e->uki, +1);
if (r < 0)
return r;
STRV_FOREACH(s, e->initrd) {
@ -795,7 +792,6 @@ 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->efi, e->root);
deref_unlink_file(&known_files, e->uki, e->root);
STRV_FOREACH(s, e->initrd)
deref_unlink_file(&known_files, *s, e->root);
deref_unlink_file(&known_files, e->device_tree, e->root);

View File

@ -20,7 +20,6 @@
#include "process-util.h"
#include "procfs-util.h"
#include "sort-util.h"
#include "string-table.h"
#include "terminal-util.h"
#include "time-util.h"
#include "virt.h"
@ -55,23 +54,6 @@ typedef enum PidsCount {
COUNT_PIDS, /* most, requires pids controller */
} 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_iterations = UINT_MAX;
static bool arg_batch = false;
@ -81,26 +63,21 @@ static char* arg_machine = NULL;
static char* arg_root = NULL;
static bool arg_recursive = true;
static bool arg_recursive_unset = false;
static PidsCount arg_count = COUNT_PIDS;
static Order arg_order = ORDER_CPU;
static CPUType arg_cpu_type = CPU_PERCENTAGE;
static const char *order_table[_ORDER_MAX] = {
[ORDER_PATH] = "path",
[ORDER_TASKS] = "tasks",
[ORDER_CPU] = "cpu",
[ORDER_MEMORY] = "memory",
[ORDER_IO] = "io",
};
static enum {
ORDER_PATH,
ORDER_TASKS,
ORDER_CPU,
ORDER_MEMORY,
ORDER_IO,
} arg_order = ORDER_CPU;
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(order, Order);
static const char *cpu_type_table[_CPU_MAX] = {
[CPU_PERCENTAGE] = "percentage",
[CPU_TIME] = "time",
};
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(cpu_type, CPUType);
static enum {
CPU_PERCENT,
CPU_TIME,
} arg_cpu_type = CPU_PERCENT;
static Group *group_free(Group *g) {
if (!g)
@ -530,7 +507,7 @@ static int group_compare(Group * const *a, Group * const *b) {
break;
case ORDER_CPU:
if (arg_cpu_type == CPU_PERCENTAGE) {
if (arg_cpu_type == CPU_PERCENT) {
if (x->cpu_valid && y->cpu_valid) {
r = CMP(y->cpu_fraction, x->cpu_fraction);
if (r != 0)
@ -580,12 +557,6 @@ static int group_compare(Group * const *a, Group * const *b) {
return -1;
else if (y->io_valid)
return 1;
break;
case _ORDER_MAX:
case _ORDER_INVALID:
assert_not_reached();
}
return path_compare(x->path, y->path);
@ -624,7 +595,7 @@ static void display(Hashmap *a) {
if (on_tty()) {
const char *on, *off;
int cpu_len = arg_cpu_type == CPU_PERCENTAGE ? 6 : maxtcpu;
int cpu_len = arg_cpu_type == CPU_PERCENT ? 6 : maxtcpu;
path_columns = columns() - 36 - cpu_len;
if (path_columns < 10)
@ -642,7 +613,7 @@ static void display(Hashmap *a) {
arg_order == ORDER_TASKS ? off : "",
arg_order == ORDER_CPU ? on : "",
cpu_len,
arg_cpu_type == CPU_PERCENTAGE ? "%CPU" : "CPU Time",
arg_cpu_type == CPU_PERCENT ? "%CPU" : "CPU Time",
arg_order == ORDER_CPU ? off : "",
arg_order == ORDER_MEMORY ? on : "", "Memory",
arg_order == ORDER_MEMORY ? off : "",
@ -672,7 +643,7 @@ static void display(Hashmap *a) {
else
fputs(" -", stdout);
if (arg_cpu_type == CPU_PERCENTAGE) {
if (arg_cpu_type == CPU_PERCENT) {
if (g->cpu_valid)
printf(" %6.1f", g->cpu_fraction*100);
else
@ -768,9 +739,12 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_CPU_TYPE:
if (optarg) {
arg_cpu_type = cpu_type_from_string(optarg);
if (arg_cpu_type < 0)
return log_error_errno(arg_cpu_type,
if (streq(optarg, "time"))
arg_cpu_type = CPU_TIME;
else if (streq(optarg, "percentage"))
arg_cpu_type = CPU_PERCENT;
else
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Unknown argument to --cpu=: %s",
optarg);
} else
@ -836,9 +810,18 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_ORDER:
arg_order = order_from_string(optarg);
if (arg_order < 0)
return log_error_errno(arg_order,
if (streq(optarg, "path"))
arg_order = ORDER_PATH;
else if (streq(optarg, "tasks"))
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",
optarg);
break;
@ -976,7 +959,7 @@ static int loop(const char *root) {
break;
case '%':
arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENTAGE : CPU_TIME;
arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENT : CPU_TIME;
break;
case 'k':

View File

@ -255,22 +255,6 @@ static int console_setup(void) {
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) {
int r;
@ -472,11 +456,17 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (proc_cmdline_value_missing(key, value))
return 0;
r = parse_timeout(value, &arg_runtime_watchdog);
if (streq(value, "default"))
arg_runtime_watchdog = USEC_INFINITY;
else if (streq(value, "off"))
arg_runtime_watchdog = 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;
@ -485,11 +475,17 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (proc_cmdline_value_missing(key, value))
return 0;
r = parse_timeout(value, &arg_pretimeout_watchdog);
if (streq(value, "default"))
arg_pretimeout_watchdog = USEC_INFINITY;
else if (streq(value, "off"))
arg_pretimeout_watchdog = 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")) {

View File

@ -109,14 +109,16 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_LIST:
return DUMP_STRING_TABLE(virtualization, Virtualization, _VIRTUALIZATION_MAX);
DUMP_STRING_TABLE(virtualization, Virtualization, _VIRTUALIZATION_MAX);
return 0;
case ARG_CVM:
arg_mode = ONLY_CVM;
return 1;
case ARG_LIST_CVM:
return DUMP_STRING_TABLE(confidential_virtualization, ConfidentialVirtualization, _CONFIDENTIAL_VIRTUALIZATION_MAX);
DUMP_STRING_TABLE(confidential_virtualization, ConfidentialVirtualization, _CONFIDENTIAL_VIRTUALIZATION_MAX);
return 0;
case '?':
return -EINVAL;

View File

@ -56,7 +56,6 @@
#include "rlimit-util.h"
#include "runtime-scope.h"
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
@ -70,14 +69,6 @@
#include "userdb.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 bool arg_legend = true;
static bool arg_ask_password = true;
@ -106,7 +97,11 @@ static bool arg_recovery_key = false;
static sd_json_format_flags_t arg_json_format_flags = SD_JSON_FORMAT_OFF;
static bool arg_and_resize = false;
static bool arg_and_change_password = false;
static ExportFormat arg_export_format = EXPORT_FORMAT_FULL;
static 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 */
} arg_export_format = EXPORT_FORMAT_FULL;
static uint64_t arg_capability_bounding_set = UINT64_MAX;
static uint64_t arg_capability_ambient_set = UINT64_MAX;
static char *arg_blob_dir = NULL;
@ -136,14 +131,6 @@ STATIC_DESTRUCTOR_REGISTER(arg_key_name, freep);
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) {
return
arg_identity ||
@ -4745,12 +4732,18 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_EXPORT_FORMAT:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(export_format, ExportFormat, _EXPORT_FORMAT_MAX);
arg_export_format = export_format_from_string(optarg);
if (arg_export_format < 0)
return log_error_errno(arg_export_format, "Invalid export format: %s", optarg);
if (streq(optarg, "full"))
arg_export_format = EXPORT_FORMAT_FULL;
else if (streq(optarg, "stripped"))
arg_export_format = EXPORT_FORMAT_STRIPPED;
else if (streq(optarg, "minimal"))
arg_export_format = EXPORT_FORMAT_MINIMAL;
else if (streq(optarg, "help")) {
puts("full\n"
"stripped\n"
"minimal");
return 0;
}
break;

View File

@ -249,8 +249,17 @@ static int parse_argv(int argc, char *argv[]) {
return version();
case ARG_FORMAT:
arg_compress = import_compress_type_from_string(optarg);
if (arg_compress < 0 || arg_compress == IMPORT_COMPRESS_UNKNOWN)
if (streq(optarg, "uncompressed"))
arg_compress = IMPORT_COMPRESS_UNCOMPRESSED;
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),
"Unknown format: %s", optarg);
break;

View File

@ -1127,8 +1127,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_VERIFY:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
return 0;
}
r = import_verify_from_string(optarg);
if (r < 0)

View File

@ -476,8 +476,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case 'o':
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
return 0;
}
arg_output = output_mode_from_string(optarg);
if (arg_output < 0)

View File

@ -1600,8 +1600,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case 'o':
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
return 0;
}
arg_output = output_mode_from_string(optarg);
if (arg_output < 0)

View File

@ -2295,8 +2295,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case 'o':
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
return 0;
}
r = output_mode_from_string(optarg);
if (r < 0)
@ -2352,8 +2354,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_VERIFY:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(import_verify, ImportVerify, _IMPORT_VERIFY_MAX);
return 0;
}
r = import_verify_from_string(optarg);
if (r < 0)

View File

@ -914,16 +914,6 @@ static const char *const timezone_mode_table[_TIMEZONE_MODE_MAX] = {
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);
static const char *const user_namespace_ownership_table[_USER_NAMESPACE_OWNERSHIP_MAX] = {

View File

@ -82,7 +82,6 @@ typedef enum TimezoneMode {
} TimezoneMode;
typedef enum ConsoleMode {
CONSOLE_AUTOPIPE,
CONSOLE_INTERACTIVE,
CONSOLE_READ_ONLY,
CONSOLE_PASSIVE,
@ -283,9 +282,6 @@ ResolvConfMode resolv_conf_mode_from_string(const char *s) _pure_;
const char* timezone_mode_to_string(TimezoneMode a) _const_;
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_;
UserNamespaceOwnership user_namespace_ownership_from_string(const char *s) _pure_;

View File

@ -286,6 +286,42 @@ STATIC_DESTRUCTOR_REGISTER(arg_settings_filename, freep);
STATIC_DESTRUCTOR_REGISTER(arg_image_policy, image_policy_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) {
_cleanup_free_ char *link = NULL;
int r;
@ -1097,9 +1133,10 @@ static int parse_argv(int argc, char *argv[]) {
if (!optarg)
arg_volatile_mode = VOLATILE_YES;
else if (streq(optarg, "help"))
return DUMP_STRING_TABLE(volatile_mode, VolatileMode, _VOLATILE_MODE_MAX);
else {
else if (streq(optarg, "help")) {
DUMP_STRING_TABLE(volatile_mode, VolatileMode, _VOLATILE_MODE_MAX);
return 0;
} else {
VolatileMode m;
m = volatile_mode_from_string(optarg);
@ -1201,8 +1238,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_PRIVATE_USERS_OWNERSHIP:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(user_namespace_ownership, UserNamespaceOwnership, _USER_NAMESPACE_OWNERSHIP_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(user_namespace_ownership, UserNamespaceOwnership, _USER_NAMESPACE_OWNERSHIP_MAX);
return 0;
}
arg_userns_ownership = user_namespace_ownership_from_string(optarg);
if (arg_userns_ownership < 0)
@ -1212,8 +1251,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_KILL_SIGNAL:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(signal, int, _NSIG);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(signal, int, _NSIG);
return 0;
}
arg_kill_signal = signal_from_string(optarg);
if (arg_kill_signal < 0)
@ -1372,8 +1413,10 @@ static int parse_argv(int argc, char *argv[]) {
_cleanup_free_ char *name = NULL;
int rl;
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(rlimit, int, _RLIMIT_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(rlimit, int, _RLIMIT_MAX);
return 0;
}
eq = strchr(optarg, '=');
if (!eq)
@ -1424,8 +1467,10 @@ static int parse_argv(int argc, char *argv[]) {
}
case ARG_RESOLV_CONF:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(resolv_conf_mode, ResolvConfMode, _RESOLV_CONF_MODE_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(resolv_conf_mode, ResolvConfMode, _RESOLV_CONF_MODE_MAX);
return 0;
}
arg_resolv_conf = resolv_conf_mode_from_string(optarg);
if (arg_resolv_conf < 0)
@ -1436,8 +1481,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_TIMEZONE:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(timezone_mode, TimezoneMode, _TIMEZONE_MODE_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(timezone_mode, TimezoneMode, _TIMEZONE_MODE_MAX);
return 0;
}
arg_timezone = timezone_mode_from_string(optarg);
if (arg_timezone < 0)
@ -1448,21 +1495,16 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_CONSOLE:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(console_mode, ConsoleMode, _CONSOLE_MODE_MAX);
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;
r = handle_arg_console(optarg);
if (r <= 0)
return r;
break;
case 'P':
case ARG_PIPE:
arg_console_mode = CONSOLE_PIPE;
arg_settings_mask |= SETTING_CONSOLE_MODE;
r = handle_arg_console("pipe");
if (r <= 0)
return r;
break;
case ARG_NO_PAGER:
@ -1696,12 +1738,6 @@ static int verify_arguments(void) {
if (r < 0)
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;
}
@ -5947,13 +5983,6 @@ static int run(int argc, char *argv[]) {
arg_console_mode = isatty_safe(STDIN_FILENO) && isatty_safe(STDOUT_FILENO) ?
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 */
arg_quiet = true;

View File

@ -93,7 +93,6 @@ static void boot_entry_free(BootEntry *entry) {
boot_entry_addons_done(&entry->local_addons);
free(entry->kernel);
free(entry->efi);
free(entry->uki);
strv_free(entry->initrd);
free(entry->device_tree);
strv_free(entry->device_tree_overlay);
@ -404,10 +403,6 @@ static int boot_entry_load_type1(
r = parse_path_one(tmp.path, line, field, &tmp.kernel, p);
else if (streq(field, "efi"))
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"))
r = parse_path_strv(tmp.path, line, field, &tmp.initrd, p);
else if (streq(field, "devicetree"))
@ -516,8 +511,7 @@ int boot_loader_read_conf(BootConfig *config, FILE *file, const char *path) {
r = free_and_strdup(&config->default_pattern, p);
else if (STR_IN_SET(field, "timeout", "editor", "auto-entries", "auto-firmware",
"auto-poweroff", "auto-reboot", "beep", "reboot-for-bitlocker",
"reboot-on-error", "secure-boot-enroll", "secure-boot-enroll-action",
"secure-boot-enroll-timeout-sec", "console-mode", "log-level"))
"secure-boot-enroll", "console-mode"))
r = 0; /* we don't parse these in userspace, but they are OK */
else {
log_syntax(NULL, LOG_WARNING, path, line, 0, "Unknown line '%s', ignoring.", field);
@ -1634,7 +1628,6 @@ int boot_config_augment_from_loader(
.reported_by_loader = true,
.tries_left = UINT_MAX,
.tries_done = UINT_MAX,
.profile = UINT_MAX,
.global_addons = &no_addons,
};
}
@ -1903,10 +1896,6 @@ int show_boot_entry(
boot_entry_file_list("linux", e->root, e->kernel, &status);
if (e->efi)
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)
boot_entry_file_list(s == e->initrd ? "initrd" : NULL,
@ -1968,9 +1957,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(!!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->uki, "uki", SD_JSON_BUILD_STRING(e->uki)),
SD_JSON_BUILD_PAIR_CONDITION(e->profile != UINT_MAX, "profile", SD_JSON_BUILD_UNSIGNED(e->profile)),
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(e->initrd), "initrd", SD_JSON_BUILD_STRV(e->initrd)));
SD_JSON_BUILD_PAIR_CONDITION(!strv_isempty(e->initrd), "initrd", SD_JSON_BUILD_STRV(e->initrd)),
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)));
if (r < 0)
return log_oom();
@ -1979,8 +1968,6 @@ int boot_entry_to_json(const BootConfig *c, size_t i, sd_json_variant **ret) {
* at once. */
r = sd_json_variant_merge_objectbo(
&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_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)),

View File

@ -50,7 +50,6 @@ typedef struct BootEntry {
const BootEntryAddons *global_addons; /* Backpointer into the BootConfig; we don't own this here */
char *kernel; /* linux is #defined to 1, yikes! */
char *efi;
char *uki;
char **initrd;
char *device_tree;
char **device_tree_overlay;
@ -65,7 +64,6 @@ typedef struct BootEntry {
.source = (s), \
.tries_left = UINT_MAX, \
.tries_done = UINT_MAX, \
.profile = UINT_MAX, \
}
typedef struct BootConfig {

View File

@ -110,8 +110,10 @@ int parse_signal_argument(const char *s, int *ret) {
assert(s);
assert(ret);
if (streq(s, "help"))
return DUMP_STRING_TABLE(signal, int, _NSIG);
if (streq(s, "help")) {
DUMP_STRING_TABLE(signal, int, _NSIG);
return 0;
}
if (streq(s, "list")) {
_cleanup_(table_unrefp) Table *table = NULL;

View File

@ -47,8 +47,6 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
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(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(devicetree, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(devicetreeOverlay, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),

View File

@ -2581,7 +2581,8 @@ static int parse_argv(int argc, char *argv[]) {
if (arg_legend)
puts("Known mutability modes:");
return DUMP_STRING_TABLE(mutable_mode, MutableMode, _MUTABLE_MAX);
DUMP_STRING_TABLE(mutable_mode, MutableMode, _MUTABLE_MAX);
return 0;
}
r = parse_mutable_mode(optarg);

View File

@ -810,8 +810,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
break;
case 'o':
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(output_mode, OutputMode, _OUTPUT_MODE_MAX);
return 0;
}
arg_output = output_mode_from_string(optarg);
if (arg_output < 0)
@ -897,8 +899,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
break;
case ARG_PRESET_MODE:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(unit_file_preset_mode, UnitFilePresetMode, _UNIT_FILE_PRESET_MODE_MAX);
if (streq(optarg, "help")) {
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);
if (arg_preset_mode < 0)
@ -960,8 +964,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
break;
case ARG_TIMESTAMP_STYLE:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(timestamp_style, TimestampStyle, _TIMESTAMP_STYLE_MAX);
if (streq(optarg, "help")) {
DUMP_STRING_TABLE(timestamp_style, TimestampStyle, _TIMESTAMP_STYLE_MAX);
return 0;
}
arg_timestamp_style = timestamp_style_from_string(optarg);
if (arg_timestamp_style < 0)

View File

@ -26,7 +26,6 @@
#include "pretty-print.h"
#include "recurse-dir.h"
#include "socket-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "uid-classification.h"
@ -38,16 +37,14 @@
#include "verbs.h"
#include "virt.h"
typedef enum {
static enum {
OUTPUT_CLASSIC,
OUTPUT_TABLE,
OUTPUT_FRIENDLY,
OUTPUT_JSON,
_OUTPUT_MAX,
_OUTPUT_INVALID = -EINVAL,
} Output;
} arg_output = _OUTPUT_INVALID;
static Output arg_output = _OUTPUT_INVALID;
static PagerFlags arg_pager_flags = 0;
static bool arg_legend = true;
static char** arg_services = NULL;
@ -64,15 +61,6 @@ static sd_json_variant *arg_from_file = NULL;
STATIC_DESTRUCTOR_REGISTER(arg_services, strv_freep);
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) {
assert(d >= 0);
assert(d < _USER_DISPOSITION_MAX);
@ -1664,12 +1652,24 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_OUTPUT:
if (streq(optarg, "help"))
return DUMP_STRING_TABLE(output, Output, _OUTPUT_MAX);
arg_output = output_from_string(optarg);
if (arg_output < 0)
return log_error_errno(arg_output, "Invalid --output= mode: %s", optarg);
if (isempty(optarg))
arg_output = _OUTPUT_INVALID;
else if (streq(optarg, "classic"))
arg_output = OUTPUT_CLASSIC;
else if (streq(optarg, "friendly"))
arg_output = OUTPUT_FRIENDLY;
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;
break;

View File

@ -13,12 +13,16 @@
#include "path-util.h"
#include "pretty-print.h"
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "vpick.h"
typedef enum {
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 enum {
PRINT_PATH,
PRINT_FILENAME,
PRINT_VERSION,
@ -26,34 +30,14 @@ typedef enum {
PRINT_ARCHITECTURE,
PRINT_TRIES,
PRINT_ALL,
_PRINT_MAX,
_PRINT_INVALID = -EINVAL,
} 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;
} arg_print = _PRINT_INVALID;
static PickFlags arg_flags = PICK_ARCHITECTURE|PICK_TRIES;
STATIC_DESTRUCTOR_REGISTER(arg_filter_basename, freep);
STATIC_DESTRUCTOR_REGISTER(arg_filter_version, 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) {
_cleanup_free_ char *link = NULL;
int r;
@ -189,12 +173,22 @@ static int parse_argv(int argc, char *argv[]) {
break;
case 'p':
if (streq(optarg, "arch")) /* accept abbreviation too */
if (streq(optarg, "path"))
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;
else if (streq(optarg, "tries"))
arg_print = PRINT_TRIES;
else if (streq(optarg, "all"))
arg_print = PRINT_ALL;
else
arg_print = print_from_string(optarg);
if (arg_print < 0)
return log_error_errno(arg_print, "Unknown --print= argument: %s", optarg);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Unknown --print= argument: %s", optarg);
break;

View File

@ -43,17 +43,8 @@ usermod -U root
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
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
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
echo "LogLevel DEBUG3" >> /etc/ssh/sshd_config
test -f /etc/ssh/ssh_config || {
echo 'Include /etc/ssh/ssh_config.d/*.conf'

View File

@ -49,6 +49,8 @@ def mjoin(files):
return ' \\\n\t'.join(sorted(files) or '#')
MESON_HEADER = '''\
# SPDX-License-Identifier: LGPL-2.1-or-later
# Do not edit. Generated by update-man-rules.py.
# Update with:
# ninja -C build update-man-rules

View File

@ -82,6 +82,7 @@ foreach unit : units
if needs_jinja
t = custom_target(
name,
input : source,
output : name,
command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],