Yu Watanabe
a9938fb3cb
Merge pull request #26862 from yuwata/uki-util
...
uki-util: export functions of inspecting kernel
2023-03-18 15:04:54 +09:00
Yu Watanabe
16af02cd97
uki-util: move functions for inspecting kernel to uki-util.[ch]
2023-03-17 20:40:34 +09:00
Yu Watanabe
6ad9af0b13
exec-util: introduce EXEC_DIR_SKIP_REMAINING flag
...
Will be used in later commits.
2023-03-17 20:38:15 +09:00
Yu Watanabe
f691157b87
exec-util: extract the core logic of execute_directories() as execute_strv()
...
Then, we can use it with a custom enumerator of executables.
No functional change, preparation for later commits.
2023-03-17 20:38:15 +09:00
Yu Watanabe
753e38d984
exec-util: enumerate executables earlier
...
Then, return earlier if no executable found.
2023-03-17 20:38:15 +09:00
Yu Watanabe
fb0e5f12c6
exec-util: drop meaningless casts
2023-03-17 20:38:15 +09:00
Yu Watanabe
8e8df8292a
exec-util: tighten variable scope a bit
2023-03-17 20:38:15 +09:00
Yu Watanabe
0e5b4d767a
Merge pull request #26831 from YHNdnzj/edit-util-followup
...
edit-util: follow-ups
2023-03-16 03:51:55 +09:00
Daan De Meyer
f5abe8f957
Merge pull request #26784 from DaanDeMeyer/chase-fix
...
Allow creating files and directories with chase_symlinks_open() and further improvements
2023-03-15 15:51:47 +01:00
Mike Yuan
d3bf024f1a
edit-util: log unexpected errors if we fail to remove the parent dir
2023-03-15 19:50:26 +08:00
Mike Yuan
00b6baf2be
edit-util: use path_equal
2023-03-15 19:45:33 +08:00
Thomas Weißschuh
c29715a8f7
treewide: memfd_create: use exec flags
...
Use the flags MEMFD_EXEC or MEMFD_NOEXEC_SEAL as applicable.
These warnings instruct the kernel wether the memfd is executable or
not.
Without specifying those flags the kernel will emit the following
warning since version 6.3,
commit 105ff5339f49 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC"):
kernel: memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=1 'systemd'
2023-03-15 01:18:59 +00:00
Daan De Meyer
85c494f7e7
mkfs-util: Redirect mksquashfs output to /dev/null
...
The -quiet option for mksquashfs was added somewhat recently so to
support older versions, let's redirect stdout of mksquashfs to
/dev/null instead.
2023-03-15 00:21:36 +00:00
Daan De Meyer
06344330a1
chase-symlinks: Remove unused ret_fd arguments
2023-03-14 13:46:58 +01:00
Franck Bui
07e0ffc823
conf: replace config_parse_many_nulstr() with config_parse_config_file()
...
All daemons use a similar scheme to read their main config files and theirs
drop-ins. The main config files are always stored in /etc/systemd directory and
it's easy enough to construct the name of the drop-in directories based on the
name of the main config file.
Hence the new helper does that internally, which allows to reduce and simplify
the args passed previously to config_parse_many_nulstr().
Besides the overall code simplification it results:
16 files changed, 87 insertions(+), 159 deletions(-)
it allows to identify clearly the locations in the code where configuration
files are parsed.
2023-03-14 03:31:21 +09:00
Yu Watanabe
af339540ec
Merge pull request #26775 from DaanDeMeyer/ext-default
...
mkfs-util: Always use "default" usage type for ext filesystems
2023-03-13 04:04:09 +09:00
Mike Yuan
78e3200354
edit-util: include the correct header
2023-03-13 01:44:51 +08:00
Mike Yuan
978e222f72
edit-util: rename trim_edit_marker to strip_edit_temp_file
...
with some minor cleanups
2023-03-13 00:44:34 +08:00
Mike Yuan
52073ba247
edit-util: always create temp file
...
even if neither original_path nor comment_paths is specified.
2023-03-13 00:41:11 +08:00
Mike Yuan
8992667fef
edit-util: minor cleanups
...
Reuse unlink_and_free() and avoid unnecessary
call to rmdir()
2023-03-13 00:40:15 +08:00
Daan De Meyer
49f2e129f8
mkfs-util: Redirect mkfs.vfat stdout to /dev/null
...
mkfs.vfat does not have a --quiet option so let's redirect its
stdout to /dev/null instead.
2023-03-12 16:20:38 +01:00
Daan De Meyer
2417fa8ef5
mkfs-util: Don't explicitly enable has_journal for ext3/ext4
...
It's enabled by default anyway and removing it allows merging the ext
conditionals into one.
2023-03-12 15:36:08 +01:00
Daan De Meyer
59c3c195f4
mkfs-util: Always use "default" usage type for ext filesystems
...
If no usage type is explicitly specified, ext will choose one based
on the filesystem size. Let's override this and always use the
"default" usage type so that we can create filesystems that are
initially small but might grow later without opting in to the "small"
usage type.
2023-03-12 15:15:35 +01:00
Yu Watanabe
0a742f3622
edit-util: unlink temporary file on failure
...
Addresses the suggestion
https://github.com/systemd/systemd/pull/26756#discussion_r1133078705 .
2023-03-11 22:20:54 +09:00
Yu Watanabe
aec8200b12
edit-util: fix potentical crash when no edit markers
...
This also makes trim_edit_markers() take EditFile as the argument.
2023-03-11 22:19:22 +09:00
Yu Watanabe
c629a5bc44
edit-util: make create_edit_temp_file() take EditFile as the argument
...
No functional changes, just refactoring.
2023-03-11 22:19:22 +09:00
Yu Watanabe
043db3400c
edit-util: make EditFile take reference of EditFileContext
...
No functional change, just preparation for later commits.
2023-03-11 22:19:22 +09:00
Yu Watanabe
c9501b03cd
Merge pull request #26641 from medhefgo/boot-elf2efi
...
boot: Drop gnu-efi / Add elf2efi.py
2023-03-11 17:15:01 +09:00
Yu Watanabe
91e07dd476
Merge pull request #26303 from YHNdnzj/edit-util
...
shared: add edit-util (part of which extracted from systemctl-edit)
2023-03-11 17:13:27 +09:00
Yu Watanabe
c3600c380a
generator: fix comment
2023-03-11 03:32:23 +09:00
Mike Yuan
f8970df54b
edit-util: several cleanups for run_editor
...
run_editor is now switched to heap allocation
for simplicity. The code for child is made into
an individual function for simpler error handling.
2023-03-11 02:02:51 +08:00
Mike Yuan
9a11b4f953
edit-util: introduce EditFileContext
...
This is a rather large change which moves
the add and install logic into edit-util.
We store an EditFile array and the number of
elements, along with the edit markers used in
temporary files and whether to remove the parent
directories of the target files if they're empty
in an EditFileContext object.
Call edit_files_add() to add an file to edit,
and do_edit_files_and_install() to do the actual
editing (through create_edit_temp_file(),
run_editor() and trim_edit_markers()).
After that, edit_file_context_done() can be used
to destroy the object.
2023-03-11 02:01:00 +08:00
Mike Yuan
fa2413dd57
edit-util: several cleanups to create_edit_temp_file
...
original_path and comment_paths can now be used
together.
Removes reference to "unit"
2023-03-11 01:38:52 +08:00
Mike Yuan
a01c4bc9af
shared: extract edit-util from systemctl-edit
2023-03-11 01:38:52 +08:00
Daan De Meyer
aa41079175
Merge pull request #26726 from DaanDeMeyer/cleanups
...
Various small cleanups
2023-03-10 14:22:53 +01:00
Lennart Poettering
d0ed83f3ae
Merge pull request #26737 from poettering/runtime-scope
...
add RuntimeScope enum, replacing LookupScope and various booleans indicating whether we are called in a per-system or per-user context
2023-03-10 13:09:40 +01:00
Daan De Meyer
4dd888dc92
lock-util: Move to src/basic
2023-03-10 11:57:43 +01:00
Daan De Meyer
b4cbfa5f1b
lock-util: Add CLEANUP_UNPOSIX_UNLOCK()
...
Also migrate the logic in dynamic-user.c to use the new cleanup
macro.
2023-03-10 11:57:43 +01:00
Daan De Meyer
663fd3e103
lock-util: Add unposix_lock()
...
Let's add an interface to UNPOSIX locks that mimicks the flock()
interface for BSD locks.
2023-03-10 11:57:40 +01:00
Jan Janssen
9214828313
meson: Introduce userspace dep
...
This will help in a later commit to separate userspace from EFI builds.
2023-03-10 11:40:14 +01:00
Lennart Poettering
f69edd6faf
Merge pull request #26331 from ddstreet/tpm2_pcr_read
...
Tpm2 pcr read
2023-03-10 10:24:39 +01:00
Daan De Meyer
64e89f56a9
lockfile-util: Rename to lock-util
2023-03-10 10:14:43 +01:00
Daan De Meyer
ed70a34ec0
lockfile-util: Drop flock() fallback
...
UNPOSIX locks were added in 3.15 which is now our minimal kernel
version, so let's drop the fallback.
2023-03-10 10:14:41 +01:00
Lennart Poettering
4870133bfa
basic: add RuntimeScope enum
...
In various tools and services we have a per-system and per-user concept.
So far we sometimes used a boolean indicating whether we are in system
mode, or a reversed boolean indicating whether we are in user mode, or
the LookupScope enum used by the lookup path logic.
Let's address that, in introduce a common enum for this, we can use all
across the board.
This is mostly just search/replace, no actual code changes.
2023-03-10 09:47:39 +01:00
Lennart Poettering
862481ece0
Merge pull request #26693 from poettering/udev-loop-links
...
udev: add /dev/loop/by-inode/… + /dev/loop/by-ref/… loopback block device symlinks
2023-03-10 09:34:31 +01:00
Lennart Poettering
96c96fb250
Merge pull request #26704 from poettering/mnt-nosymlinks
...
Set MS_NOSYMFOLLOW for ESP + XBOOTLDR and many mount option clean-ups
2023-03-10 09:34:04 +01:00
Daan De Meyer
4b8ce14f6c
repart: Add support for reading mkfs options from environment
2023-03-10 09:33:39 +01:00
Lennart Poettering
274a3b0075
data-fd-util: use fd_reopen() a bit more
2023-03-09 22:56:53 +01:00
Lennart Poettering
92c6f73cc5
fd-util: move ACQUIRE_NO_XYZ flags to the header the function using them is in
...
Follow-up for: b25a930f0e
2023-03-09 22:56:30 +01:00
Lennart Poettering
6eda6f7e51
mountpoint-util: add new fstype_can_umask() helper
2023-03-09 21:56:42 +01:00