mirror of
https://github.com/systemd/systemd
synced 2026-04-12 10:04:50 +02:00
Compare commits
No commits in common. "5f02870a74aa3a758115cc9bd6d68f239caf8453" and "299d9417238e0727a48ebaabb5a9de0c908ec5c8" have entirely different histories.
5f02870a74
...
299d941723
@ -240,7 +240,7 @@
|
|||||||
<listitem><para>When specified with the <command>encrypt</command> command controls the timestamp to
|
<listitem><para>When specified with the <command>encrypt</command> command controls the timestamp to
|
||||||
embed into the encrypted credential. Defaults to the current time. Takes a timestamp specification in
|
embed into the encrypted credential. Defaults to the current time. Takes a timestamp specification in
|
||||||
the format described in
|
the format described in
|
||||||
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
|
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
|
||||||
|
|
||||||
<para>When specified with the <command>decrypt</command> command controls the timestamp to use to
|
<para>When specified with the <command>decrypt</command> command controls the timestamp to use to
|
||||||
validate the "not-after" timestamp that was configured with <option>--not-after=</option> during
|
validate the "not-after" timestamp that was configured with <option>--not-after=</option> during
|
||||||
@ -255,7 +255,7 @@
|
|||||||
credential. During decryption the timestamp is checked against the current system clock, and if the
|
credential. During decryption the timestamp is checked against the current system clock, and if the
|
||||||
timestamp is in the past the decryption will fail. By default no such timestamp is set. Takes a
|
timestamp is in the past the decryption will fail. By default no such timestamp is set. Takes a
|
||||||
timestamp specification in the format described in
|
timestamp specification in the format described in
|
||||||
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para></listitem>
|
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
@ -275,7 +275,7 @@
|
|||||||
media, encryption will fail.</para>
|
media, encryption will fail.</para>
|
||||||
|
|
||||||
<para>The <option>-H</option> switch is a shortcut for <option>--with-key=host</option>. Similar,
|
<para>The <option>-H</option> switch is a shortcut for <option>--with-key=host</option>. Similar,
|
||||||
<option>-T</option> is a shortcut for <option>--with-key=tpm2</option>.</para>
|
<option>-T</option> is a shortcut for <option>-with-key=tpm2</option>.</para>
|
||||||
|
|
||||||
<para>When encrypting credentials that shall be used in the initial RAM disk (initrd) where
|
<para>When encrypting credentials that shall be used in the initial RAM disk (initrd) where
|
||||||
<filename>/var/lib/systemd/</filename> is typically not available make sure to use
|
<filename>/var/lib/systemd/</filename> is typically not available make sure to use
|
||||||
|
|||||||
@ -2149,7 +2149,7 @@ executable(
|
|||||||
install : true,
|
install : true,
|
||||||
install_dir : systemgeneratordir)
|
install_dir : systemgeneratordir)
|
||||||
|
|
||||||
exe = executable(
|
executable(
|
||||||
'systemd-fstab-generator',
|
'systemd-fstab-generator',
|
||||||
'src/fstab-generator/fstab-generator.c',
|
'src/fstab-generator/fstab-generator.c',
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
@ -2158,13 +2158,6 @@ exe = executable(
|
|||||||
install : true,
|
install : true,
|
||||||
install_dir : systemgeneratordir)
|
install_dir : systemgeneratordir)
|
||||||
|
|
||||||
if want_tests != 'false'
|
|
||||||
test('test-fstab-generator',
|
|
||||||
test_fstab_generator_sh,
|
|
||||||
# https://github.com/mesonbuild/meson/issues/2681
|
|
||||||
args : exe.full_path())
|
|
||||||
endif
|
|
||||||
|
|
||||||
if conf.get('ENABLE_ENVIRONMENT_D') == 1
|
if conf.get('ENABLE_ENVIRONMENT_D') == 1
|
||||||
executable(
|
executable(
|
||||||
'30-systemd-environment-d-generator',
|
'30-systemd-environment-d-generator',
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "main-func.h"
|
#include "main-func.h"
|
||||||
#include "udev-util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static bool arg_verbose = false;
|
static bool arg_verbose = false;
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
#include "dirent-util.h"
|
||||||
#include "env-file.h"
|
#include "env-file.h"
|
||||||
#include "env-util.h"
|
#include "env-util.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
@ -114,6 +115,65 @@ void in_initrd_force(bool value) {
|
|||||||
saved_in_initrd = value;
|
saved_in_initrd = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int on_ac_power(void) {
|
||||||
|
bool found_offline = false, found_online = false;
|
||||||
|
_cleanup_closedir_ DIR *d = NULL;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
d = opendir("/sys/class/power_supply");
|
||||||
|
if (!d)
|
||||||
|
return errno == ENOENT ? true : -errno;
|
||||||
|
|
||||||
|
FOREACH_DIRENT(de, d, return -errno) {
|
||||||
|
_cleanup_close_ int device_fd = -1;
|
||||||
|
_cleanup_free_ char *contents = NULL;
|
||||||
|
unsigned v;
|
||||||
|
|
||||||
|
device_fd = openat(dirfd(d), de->d_name, O_DIRECTORY|O_RDONLY|O_CLOEXEC);
|
||||||
|
if (device_fd < 0) {
|
||||||
|
if (IN_SET(errno, ENOENT, ENOTDIR))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = read_virtual_file_at(device_fd, "type", SIZE_MAX, &contents, NULL);
|
||||||
|
if (r == -ENOENT)
|
||||||
|
continue;
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
delete_trailing_chars(contents, NEWLINE);
|
||||||
|
|
||||||
|
/* We assume every power source is AC, except for batteries. See
|
||||||
|
* https://github.com/torvalds/linux/blob/4eef766b7d4d88f0b984781bc1bcb574a6eafdc7/include/linux/power_supply.h#L176
|
||||||
|
* for defined power source types. Also see:
|
||||||
|
* https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power */
|
||||||
|
if (streq(contents, "Battery"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
contents = mfree(contents);
|
||||||
|
|
||||||
|
r = read_virtual_file_at(device_fd, "online", SIZE_MAX, &contents, NULL);
|
||||||
|
if (r == -ENOENT)
|
||||||
|
continue;
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
delete_trailing_chars(contents, NEWLINE);
|
||||||
|
|
||||||
|
r = safe_atou(contents, &v);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
if (v > 0) /* At least 1 and 2 are defined as different types of 'online' */
|
||||||
|
found_online = true;
|
||||||
|
else
|
||||||
|
found_offline = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return found_online || !found_offline;
|
||||||
|
}
|
||||||
|
|
||||||
int container_get_leader(const char *machine, pid_t *pid) {
|
int container_get_leader(const char *machine, pid_t *pid) {
|
||||||
_cleanup_free_ char *s = NULL, *class = NULL;
|
_cleanup_free_ char *s = NULL, *class = NULL;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|||||||
@ -20,6 +20,8 @@ int prot_from_flags(int flags) _const_;
|
|||||||
bool in_initrd(void);
|
bool in_initrd(void);
|
||||||
void in_initrd_force(bool value);
|
void in_initrd_force(bool value);
|
||||||
|
|
||||||
|
int on_ac_power(void);
|
||||||
|
|
||||||
/* Note: log2(0) == log2(1) == 0 here and below. */
|
/* Note: log2(0) == log2(1) == 0 here and below. */
|
||||||
|
|
||||||
#define CONST_LOG2ULL(x) ((x) > 1 ? (unsigned) __builtin_clzll(x) ^ 63U : 0)
|
#define CONST_LOG2ULL(x) ((x) > 1 ? (unsigned) __builtin_clzll(x) ^ 63U : 0)
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "fstab-util.h"
|
#include "fstab-util.h"
|
||||||
#include "generator.h"
|
#include "generator.h"
|
||||||
#include "in-addr-util.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "main-func.h"
|
#include "main-func.h"
|
||||||
#include "mkdir.h"
|
#include "mkdir.h"
|
||||||
@ -692,57 +691,6 @@ static int parse_fstab(bool initrd) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sysroot_is_nfsroot(void) {
|
|
||||||
union in_addr_union u;
|
|
||||||
const char *sep, *a;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(arg_root_what);
|
|
||||||
|
|
||||||
/* From dracut.cmdline(7).
|
|
||||||
*
|
|
||||||
* root=[<server-ip>:]<root-dir>[:<nfs-options>]
|
|
||||||
* root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>],
|
|
||||||
* root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>],
|
|
||||||
* root={dhcp|dhcp6}
|
|
||||||
*
|
|
||||||
* mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use dhcp next_server.
|
|
||||||
* If server-ip is an IPv6 address it has to be put in brackets, e.g. [2001:DB8::1]. NFS options
|
|
||||||
* can be appended with the prefix ":" or "," and are separated by ",". */
|
|
||||||
|
|
||||||
if (path_equal(arg_root_what, "/dev/nfs") ||
|
|
||||||
STR_IN_SET(arg_root_what, "dhcp", "dhcp6") ||
|
|
||||||
STARTSWITH_SET(arg_root_what, "nfs:", "nfs4:"))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* IPv6 address */
|
|
||||||
if (arg_root_what[0] == '[') {
|
|
||||||
sep = strchr(arg_root_what + 1, ']');
|
|
||||||
if (!sep)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
a = strndupa(arg_root_what + 1, sep - arg_root_what - 1);
|
|
||||||
|
|
||||||
r = in_addr_from_string(AF_INET6, a, &u);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IPv4 address */
|
|
||||||
sep = strchr(arg_root_what, ':');
|
|
||||||
if (sep) {
|
|
||||||
a = strndupa(arg_root_what, sep - arg_root_what);
|
|
||||||
|
|
||||||
if (in_addr_from_string(AF_INET, a, &u) >= 0)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* root directory without address */
|
|
||||||
return path_is_absolute(arg_root_what) && !path_startswith(arg_root_what, "/dev");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int add_sysroot_mount(void) {
|
static int add_sysroot_mount(void) {
|
||||||
_cleanup_free_ char *what = NULL;
|
_cleanup_free_ char *what = NULL;
|
||||||
const char *opts, *fstype;
|
const char *opts, *fstype;
|
||||||
@ -760,27 +708,9 @@ static int add_sysroot_mount(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sysroot_is_nfsroot();
|
if (path_equal(arg_root_what, "/dev/nfs")) {
|
||||||
if (r < 0)
|
|
||||||
log_debug_errno(r, "Failed to determine if the root directory is on NFS, assuming not: %m");
|
|
||||||
else if (r > 0) {
|
|
||||||
/* This is handled by the kernel or the initrd */
|
/* This is handled by the kernel or the initrd */
|
||||||
log_debug("Skipping root directory handling, as root on NFS was requested.");
|
log_debug("Skipping root directory handling, as /dev/nfs was requested.");
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startswith(arg_root_what, "cifs://")) {
|
|
||||||
log_debug("Skipping root directory handling, as root on CIFS was requested.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startswith(arg_root_what, "iscsi:")) {
|
|
||||||
log_debug("Skipping root directory handling, as root on iSCSI was requested.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (startswith(arg_root_what, "live:")) {
|
|
||||||
log_debug("Skipping root directory handling, as root on live image was requested.");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ fi
|
|||||||
[ -z "$MACHINE_ID" ] && MACHINE_ID="Default"
|
[ -z "$MACHINE_ID" ] && MACHINE_ID="Default"
|
||||||
|
|
||||||
[ -z "$BOOT_ROOT" ] && for suff in "$MACHINE_ID" "loader/entries"; do
|
[ -z "$BOOT_ROOT" ] && for suff in "$MACHINE_ID" "loader/entries"; do
|
||||||
for pref in "/efi" "/boot" "/boot/efi" ; do
|
for pref in "/efi" "/boot/efi" "/boot"; do
|
||||||
if [ -d "$pref/$suff" ]; then
|
if [ -d "$pref/$suff" ]; then
|
||||||
BOOT_ROOT="$pref"
|
BOOT_ROOT="$pref"
|
||||||
break 2
|
break 2
|
||||||
|
|||||||
@ -50,9 +50,9 @@
|
|||||||
#include "string-table.h"
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "tomoyo-util.h"
|
#include "tomoyo-util.h"
|
||||||
#include "udev-util.h"
|
|
||||||
#include "uid-alloc-range.h"
|
#include "uid-alloc-range.h"
|
||||||
#include "user-util.h"
|
#include "user-util.h"
|
||||||
|
#include "util.h"
|
||||||
#include "virt.h"
|
#include "virt.h"
|
||||||
|
|
||||||
Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
|
Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
|
||||||
|
|||||||
@ -286,7 +286,6 @@ const SyscallFilterSet syscall_filter_sets[_SYSCALL_FILTER_SET_MAX] = {
|
|||||||
.name = "@default",
|
.name = "@default",
|
||||||
.help = "System calls that are always permitted",
|
.help = "System calls that are always permitted",
|
||||||
.value =
|
.value =
|
||||||
"arch_prctl\0" /* Used during platform-specific initialization by ld-linux.so. */
|
|
||||||
"brk\0"
|
"brk\0"
|
||||||
"cacheflush\0"
|
"cacheflush\0"
|
||||||
"clock_getres\0"
|
"clock_getres\0"
|
||||||
@ -716,6 +715,7 @@ const SyscallFilterSet syscall_filter_sets[_SYSCALL_FILTER_SET_MAX] = {
|
|||||||
.name = "@process",
|
.name = "@process",
|
||||||
.help = "Process control, execution, namespacing operations",
|
.help = "Process control, execution, namespacing operations",
|
||||||
.value =
|
.value =
|
||||||
|
"arch_prctl\0"
|
||||||
"capget\0" /* Able to query arbitrary processes */
|
"capget\0" /* Able to query arbitrary processes */
|
||||||
"clone\0"
|
"clone\0"
|
||||||
"clone3\0"
|
"clone3\0"
|
||||||
|
|||||||
@ -579,142 +579,3 @@ int udev_queue_init(void) {
|
|||||||
|
|
||||||
return TAKE_FD(fd);
|
return TAKE_FD(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int device_is_power_sink(sd_device *device) {
|
|
||||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
|
||||||
bool found_source = false, found_sink = false;
|
|
||||||
sd_device *parent, *d;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(device);
|
|
||||||
|
|
||||||
/* USB-C power supply device has two power roles: source or sink. See,
|
|
||||||
* https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-typec */
|
|
||||||
|
|
||||||
r = sd_device_enumerator_new(&e);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_device_enumerator_allow_uninitialized(e);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_device_enumerator_add_match_subsystem(e, "typec", true);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_device_get_parent(device, &parent);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_device_enumerator_add_match_parent(e, parent);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
FOREACH_DEVICE(e, d) {
|
|
||||||
const char *val;
|
|
||||||
|
|
||||||
r = sd_device_get_sysattr_value(d, "power_role", &val);
|
|
||||||
if (r < 0) {
|
|
||||||
if (r != -ENOENT)
|
|
||||||
log_device_debug_errno(d, r, "Failed to read 'power_role' sysfs attribute, ignoring: %m");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strstr(val, "[source]")) {
|
|
||||||
found_source = true;
|
|
||||||
log_device_debug(d, "The USB type-C port is in power source mode.");
|
|
||||||
} else if (strstr(val, "[sink]")) {
|
|
||||||
found_sink = true;
|
|
||||||
log_device_debug(d, "The USB type-C port is in power sink mode.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found_sink)
|
|
||||||
log_device_debug(device, "The USB type-C device has at least one port in power sink mode.");
|
|
||||||
else if (!found_source)
|
|
||||||
log_device_debug(device, "The USB type-C device has no port in power source mode, assuming the device is in power sink mode.");
|
|
||||||
else
|
|
||||||
log_device_debug(device, "All USB type-C ports are in power source mode.");
|
|
||||||
|
|
||||||
return found_sink || !found_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
int on_ac_power(void) {
|
|
||||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
|
||||||
bool found_offline = false, found_online = false;
|
|
||||||
sd_device *d;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
r = sd_device_enumerator_new(&e);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_device_enumerator_allow_uninitialized(e);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_device_enumerator_add_match_subsystem(e, "power_supply", true);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
FOREACH_DEVICE(e, d) {
|
|
||||||
const char *val;
|
|
||||||
unsigned v;
|
|
||||||
|
|
||||||
r = sd_device_get_sysattr_value(d, "type", &val);
|
|
||||||
if (r < 0) {
|
|
||||||
log_device_debug_errno(d, r, "Failed to read 'type' sysfs attribute, ignoring: %m");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We assume every power source is AC, except for batteries. See
|
|
||||||
* https://github.com/torvalds/linux/blob/4eef766b7d4d88f0b984781bc1bcb574a6eafdc7/include/linux/power_supply.h#L176
|
|
||||||
* for defined power source types. Also see:
|
|
||||||
* https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-power */
|
|
||||||
if (streq(val, "Battery")) {
|
|
||||||
log_device_debug(d, "The power supply is battery, ignoring.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ignore USB-C power supply in source mode. See issue #21988. */
|
|
||||||
if (streq(val, "USB")) {
|
|
||||||
r = device_is_power_sink(d);
|
|
||||||
if (r <= 0) {
|
|
||||||
if (r < 0)
|
|
||||||
log_device_debug_errno(d, r, "Failed to determine the current power role, ignoring: %m");
|
|
||||||
else
|
|
||||||
log_device_debug(d, "USB power supply is in source mode, ignoring.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
r = sd_device_get_sysattr_value(d, "online", &val);
|
|
||||||
if (r < 0) {
|
|
||||||
log_device_debug_errno(d, r, "Failed to read 'online' sysfs attribute, ignoring: %m");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = safe_atou(val, &v);
|
|
||||||
if (r < 0) {
|
|
||||||
log_device_debug_errno(d, r, "Failed to parse 'online' attribute, ignoring: %m");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v > 0) /* At least 1 and 2 are defined as different types of 'online' */
|
|
||||||
found_online = true;
|
|
||||||
else
|
|
||||||
found_offline = true;
|
|
||||||
|
|
||||||
log_device_debug(d, "The power supply is currently %s.", v > 0 ? "online" : "offline");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found_online)
|
|
||||||
log_debug("Found at least one online non-battery power supply, system is running on AC power.");
|
|
||||||
else if (!found_offline)
|
|
||||||
log_debug("Found no offline non-battery power supply, assuming system is running on AC power.");
|
|
||||||
else
|
|
||||||
log_debug("All non-battery power supplies are offline, assuming system is running with battery.");
|
|
||||||
|
|
||||||
return found_online || !found_offline;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -53,8 +53,6 @@ int udev_resolve_subsys_kernel(const char *string, char *result, size_t maxsize,
|
|||||||
int udev_queue_is_empty(void);
|
int udev_queue_is_empty(void);
|
||||||
int udev_queue_init(void);
|
int udev_queue_init(void);
|
||||||
|
|
||||||
int on_ac_power(void);
|
|
||||||
|
|
||||||
#if HAVE_SYS_SDT_H
|
#if HAVE_SYS_SDT_H
|
||||||
|
|
||||||
/* Each trace point can have different number of additional arguments. Note that when the macro is used only
|
/* Each trace point can have different number of additional arguments. Note that when the macro is used only
|
||||||
|
|||||||
@ -33,7 +33,6 @@
|
|||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "tomoyo-util.h"
|
#include "tomoyo-util.h"
|
||||||
#include "udev-util.h"
|
|
||||||
#include "uid-alloc-range.h"
|
#include "uid-alloc-range.h"
|
||||||
#include "user-util.h"
|
#include "user-util.h"
|
||||||
#include "virt.h"
|
#include "virt.h"
|
||||||
|
|||||||
@ -12,9 +12,6 @@ if install_tests
|
|||||||
install_subdir('test-execute',
|
install_subdir('test-execute',
|
||||||
exclude_files : '.gitattributes',
|
exclude_files : '.gitattributes',
|
||||||
install_dir : testdata_dir)
|
install_dir : testdata_dir)
|
||||||
install_subdir('test-fstab-generator',
|
|
||||||
exclude_files : '.gitattributes',
|
|
||||||
install_dir : testdata_dir)
|
|
||||||
install_subdir('test-path',
|
install_subdir('test-path',
|
||||||
exclude_files : '.gitattributes',
|
exclude_files : '.gitattributes',
|
||||||
install_dir : testdata_dir)
|
install_dir : testdata_dir)
|
||||||
@ -86,7 +83,6 @@ if install_tests
|
|||||||
install_dir : testdata_dir)
|
install_dir : testdata_dir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test_fstab_generator_sh = find_program('test-fstab-generator.sh')
|
|
||||||
test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')
|
test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')
|
||||||
test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py')
|
test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py')
|
||||||
hwdb_test_sh = find_program('hwdb-test.sh')
|
hwdb_test_sh = find_program('hwdb-test.sh')
|
||||||
@ -131,13 +127,11 @@ if install_tests
|
|||||||
install_mode : 'rwxr-xr-x',
|
install_mode : 'rwxr-xr-x',
|
||||||
install_dir : testsdir)
|
install_dir : testsdir)
|
||||||
|
|
||||||
install_data('test-fstab-generator.sh',
|
if conf.get('ENABLE_NETWORKD') == 1
|
||||||
install_mode : 'rwxr-xr-x',
|
|
||||||
install_dir : testsdir)
|
|
||||||
|
|
||||||
install_data('test-network-generator-conversion.sh',
|
install_data('test-network-generator-conversion.sh',
|
||||||
install_mode : 'rwxr-xr-x',
|
install_mode : 'rwxr-xr-x',
|
||||||
install_dir : testsdir)
|
install_dir : testsdir)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if [[ -n "$1" ]]; then
|
|
||||||
generator=$1
|
|
||||||
elif [[ -x /usr/lib/systemd/system-generators/systemd-fstab-generator ]]; then
|
|
||||||
generator=/usr/lib/systemd/system-generators/systemd-fstab-generator
|
|
||||||
elif [[ -x /lib/systemd/system-generators/systemd-fstab-generator ]]; then
|
|
||||||
generator=/lib/systemd/system-generators/systemd-fstab-generator
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
src="$(dirname "$0")/testdata/test-fstab-generator"
|
|
||||||
|
|
||||||
for f in "$src"/test-*.input; do
|
|
||||||
echo "*** Running $f"
|
|
||||||
|
|
||||||
(
|
|
||||||
out=$(mktemp --tmpdir --directory "test-fstab-generator.XXXXXXXXXX")
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap "rm -rf '$out'" EXIT INT QUIT PIPE
|
|
||||||
|
|
||||||
# shellcheck disable=SC2046
|
|
||||||
SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD=yes SYSTEMD_PROC_CMDLINE="fstab=no $(cat "$f")" $generator "$out" "$out" "$out"
|
|
||||||
|
|
||||||
if [[ -f "$out"/systemd-fsck-root.service ]]; then
|
|
||||||
# For split-usr system
|
|
||||||
sed -i -e 's:ExecStart=/lib/systemd/systemd-fsck:ExecStart=/usr/lib/systemd/systemd-fsck:' "$out"/systemd-fsck-root.service
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! diff -u "$out" "${f%.input}.expected"; then
|
|
||||||
echo "**** Unexpected output for $f"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
) || exit 1
|
|
||||||
done
|
|
||||||
1
test/test-fstab-generator/.gitattributes
vendored
1
test/test-fstab-generator/.gitattributes
vendored
@ -1 +0,0 @@
|
|||||||
* generated
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=/dev/nfs nfsroot=192.168.0.1:/nfsroot/root1:rw
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=dhcp
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=dhcp6
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=nfs:/nfsroot/root1:rw
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=nfs4:/nfsroot/root1:rw
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=192.168.0.1:/nfsroot/root1:rw
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=[2001:db8::1]:/nfsroot/root1:rw
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=/nfsroot/root1:rw
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=cifs://username:password@192.168.0.1:/cifsroot
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=iscsi:username:password@servername::::tgt
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=live:http://example.com/liveboot.img
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Requires=dev-sdx1.device
|
|
||||||
After=dev-sdx1.device
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
|
|
||||||
SourcePath=/proc/cmdline
|
|
||||||
Before=initrd-root-fs.target
|
|
||||||
Requires=systemd-fsck-root.service
|
|
||||||
After=systemd-fsck-root.service
|
|
||||||
After=blockdev@dev-sdx1.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=/dev/sdx1
|
|
||||||
Where=/sysroot
|
|
||||||
Options=ro
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=File System Check on /dev/sdx1
|
|
||||||
Documentation=man:systemd-fsck-root.service(8)
|
|
||||||
DefaultDependencies=no
|
|
||||||
BindsTo=dev-sdx1.device
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
After=initrd-root-device.target local-fs-pre.target dev-sdx1.device
|
|
||||||
Before=shutdown.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/lib/systemd/systemd-fsck /dev/sdx1
|
|
||||||
TimeoutSec=0
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=/dev/sdx1
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Requires=dev-disk-by\x2dlabel-Root.device
|
|
||||||
After=dev-disk-by\x2dlabel-Root.device
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
|
|
||||||
SourcePath=/proc/cmdline
|
|
||||||
Before=initrd-root-fs.target
|
|
||||||
Requires=systemd-fsck-root.service
|
|
||||||
After=systemd-fsck-root.service
|
|
||||||
After=blockdev@dev-disk-by\x2dlabel-Root.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=/dev/disk/by-label/Root
|
|
||||||
Where=/sysroot
|
|
||||||
Options=ro
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=File System Check on /dev/disk/by-label/Root
|
|
||||||
Documentation=man:systemd-fsck-root.service(8)
|
|
||||||
DefaultDependencies=no
|
|
||||||
BindsTo=dev-disk-by\x2dlabel-Root.device
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
After=initrd-root-device.target local-fs-pre.target dev-disk-by\x2dlabel-Root.device
|
|
||||||
Before=shutdown.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-label/Root
|
|
||||||
TimeoutSec=0
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=LABEL=Root
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Requires=dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
After=dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
|
|
||||||
SourcePath=/proc/cmdline
|
|
||||||
Before=initrd-root-fs.target
|
|
||||||
Requires=systemd-fsck-root.service
|
|
||||||
After=systemd-fsck-root.service
|
|
||||||
After=blockdev@dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
Where=/sysroot
|
|
||||||
Options=ro
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=File System Check on /dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
Documentation=man:systemd-fsck-root.service(8)
|
|
||||||
DefaultDependencies=no
|
|
||||||
BindsTo=dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
After=initrd-root-device.target local-fs-pre.target dev-disk-by\x2duuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
Before=shutdown.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
TimeoutSec=0
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Requires=dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
After=dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
|
|
||||||
SourcePath=/proc/cmdline
|
|
||||||
Before=initrd-root-fs.target
|
|
||||||
Requires=systemd-fsck-root.service
|
|
||||||
After=systemd-fsck-root.service
|
|
||||||
After=blockdev@dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=/dev/disk/by-partuuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
Where=/sysroot
|
|
||||||
Options=ro
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=File System Check on /dev/disk/by-partuuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
Documentation=man:systemd-fsck-root.service(8)
|
|
||||||
DefaultDependencies=no
|
|
||||||
BindsTo=dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
After=initrd-root-device.target local-fs-pre.target dev-disk-by\x2dpartuuid-3f5ad593\x2d4546\x2d4a94\x2da374\x2dbcfb68aa11f7.device
|
|
||||||
Before=shutdown.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStart=/usr/lib/systemd/systemd-fsck /dev/disk/by-partuuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
TimeoutSec=0
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1 +0,0 @@
|
|||||||
../sysroot.mount
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
# Automatically generated by systemd-fstab-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
|
|
||||||
SourcePath=/proc/cmdline
|
|
||||||
Before=initrd-root-fs.target
|
|
||||||
|
|
||||||
[Mount]
|
|
||||||
What=rootfs
|
|
||||||
Where=/sysroot
|
|
||||||
Type=tmpfs
|
|
||||||
Options=rw
|
|
||||||
@ -1 +0,0 @@
|
|||||||
root=tmpfs
|
|
||||||
@ -12,7 +12,7 @@ Description=Home Area Manager
|
|||||||
Documentation=man:systemd-homed.service(8)
|
Documentation=man:systemd-homed.service(8)
|
||||||
Documentation=man:org.freedesktop.home1(5)
|
Documentation=man:org.freedesktop.home1(5)
|
||||||
|
|
||||||
After=home.mount dbus.service
|
After=home.mount
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
BusName=org.freedesktop.home1
|
BusName=org.freedesktop.home1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user