summaryrefslogtreecommitdiff
path: root/src/gpt-auto-generator/gpt-auto-generator.c
Commit message (Collapse)AuthorAgeFilesLines
...
* log: remove LOG_TARGET_SAFE pseudo log targetLennart Poettering2018-01-241-1/+2
| | | | | | | | | | | | | This removes LOG_TARGET_SAFE. It's made redundant by the new "prohibit-ipc" logging flag, as it used to have a similar effect: avoid logging to the journal/syslog, i.e. any local services in order to avoid deadlocks when we lock from PID 1 or its utility processes (such as generators). All previous users of LOG_TARGET_SAFE are switched over to the new setting. This makes things a bit safer for all, as not even the SYSTEMD_LOG_TARGET env var can be used to accidentally log to the journal anymore in these programs.
* basic: split out blockdev-util.[ch] from util.hLennart Poettering2017-12-251-0/+1
| | | | With three functions it makes sense to split this out now.
* generators: be more careful when writing unit settings that support ↵Lennart Poettering2017-11-291-3/+16
| | | | | | | | specifier expansion Let's always escape strings we receive from the user before writing them out to unit file settings that suppor specifier expansion, so that user strings are transported as-is.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* gpt-auto-generator: make sure "r" is always setLennart Poettering2017-11-101-1/+3
|
* Remove a bunch of unused variablesZbigniew Jędrzejewski-Szmek2017-11-011-1/+1
| | | | | gcc does not warn about those, because of the _cleanup_ usage. clang is smarter here.
* build-sys: use #if Y instead of #ifdef Y everywhereZbigniew Jędrzejewski-Szmek2017-10-041-3/+3
| | | | | | | | | | | | | | | The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2
* cryptsetup: make sure we invoke the cryptsetup tools with a shared keyringLennart Poettering2017-09-151-0/+1
| | | | | | | | We want that cryptsetup can cache keys between multiple invocations, and it does so via the root user's user keyring, hence let's share it among services. Replaces: #6286
* util: make get_block_device() availableFranck Bui2017-09-131-130/+0
|
* gpt-auto-generator: use generator_add_symlink()Zbigniew Jędrzejewski-Szmek2017-07-101-57/+19
|
* gpt-auto-generator: fix the handling of the value returned by ↵Franck Bui2017-07-041-1/+1
| | | | | fstab_has_fstype() in add_swap() (#6280) fstab_has_fstype() returns '1' if fstab contains the passed fstype, not '0'.
* fix add_esp() in the gpt-auto-generator.c (#6251)Дамјан Георгиевски2017-07-041-1/+1
| | | | | | | | b9088048b15cd21242b2308498fa865f864bfe45 seems to have broke it fstab_is_mount_point() returns `true` (1) if the mount point exists and `false` (0) if it doesn't exist. the change in b9088048 considered that if fstab_is_mount_point() returns 0 the mount point exists.
* gpt-auto-generator: disable gpt auto logic for swaps if at least one is ↵Franck Bui2017-06-271-0/+9
| | | | | | | | | | | | | | | | defined in fstab If a swap partition is created on a disk using GPT then the unit generated by the gpt-generator can shadow the one generated by the fstab-generator. This can be an issue if the fstab entry for the swap has options since they are simply ignored if PID1 decides to use the unit created by the gpt-generator since this unit carries no information about the swap options. This patch simply disables the GPT auto logic for swaps if at least one entry for swap is defined in /etc/fstab. Fixes: #6192
* fstab-util: don't eat up errors in fstab_is_mount_point()Franck Bui2017-06-271-1/+4
| | | | | That way the caller can decide what to do with failures, whether to consider them or ignore them.
* build-sys: correct blkid.h includesMatt Clarkson2017-04-061-1/+1
| | | | | | | | | | | | | | | | | | When using pkg-config to determine the include flags for blkid the flags are returned as: $ pkg-config blkid --cflags -I/usr/include/blkid -I/usr/include/uuid We use the <blkid/blkid.h> include which would be correct when using the default compiler /usr/include header search path. However, when cross-compiling the blkid.h will not be installed at /usr/include and highly likely in a temporary system root. It is futher compounded if the cross-compile packages are split up and the blkid package is not available in the same sysroot as the compiler. Regardless of the compilation setup, the correct include path should be <blkid.h> if using the pkg-config returned CFLAGS.
* gpt-auto-generator: fix warning when compiling w/o efi (#5456)Zbigniew Jędrzejewski-Szmek2017-02-261-1/+1
| | | Fixes #5452.
* fs-util: unify code we use to check if dirent's d_name is "." or ".."Lennart Poettering2017-02-021-1/+1
| | | | | We use different idioms at different places. Let's replace this is the one true new idiom, that is even a bit faster...
* Merge pull request #4879 from poettering/systemdZbigniew Jędrzejewski-Szmek2017-01-141-311/+155
|\
| * gpt-auto-generator: enable auto-discovery logic also for verity root file ↵Lennart Poettering2016-12-211-2/+34
| | | | | | | | | | | | | | | | | | | | systems verity block devices have two backing devices: the data partition and the hash partition. Previously the gpt auto-discovery logic would refuse working on devices with multiple backing devices, losen this up a bit, to permit them as long as the backing devices are all located on the same physical media.
| * verity: add support for setting up verity-protected root disks in the initrdLennart Poettering2016-12-211-0/+9
| | | | | | | | | | | | | | | | | | This adds a generator and a small service that will look for "roothash=" on the kernel command line and use it for setting up a very partition for the root device. This provides similar functionality to nspawn's existing --roothash= switch.
| * gpt-auto-discovery: port to dissect-image.c dissectorLennart Poettering2016-12-211-276/+66
| | | | | | | | | | | | Change the gpt auto discovery generator to use the same dissector as nspawn and the rest of the tools. This removes the separate dissector code that the generator previously had and unifies the relevant code.
| * gpt-auto-generator: drop duplicate container checkLennart Poettering2016-12-211-5/+0
| | | | | | | | | | We already check for containers early in main(), no need to do this check again.
| * gpt-auto-generator: support LUKS encrypted root partitionsLennart Poettering2016-12-211-18/+35
| | | | | | | | | | | | | | Previously, we supported GPT auto-discovery for /home and /srv, but not for the root partition. Add that, too. Fixes: #859
| * qutoacheck,gpt-auto-generator: trivial coding style improvementsLennart Poettering2016-12-211-5/+3
| |
| * util-lib: various improvements to kernel command line parsingLennart Poettering2016-12-211-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This improves kernel command line parsing in a number of ways: a) An kernel option "foo_bar=xyz" is now considered equivalent to "foo-bar-xyz", i.e. when comparing kernel command line option names "-" and "_" are now considered equivalent (this only applies to the option names though, not the option values!). Most of our kernel options used "-" as word separator in kernel command line options so far, but some used "_". With this change, which was a source of confusion for users (well, at least of one user: myself, I just couldn't remember that it's systemd.debug-shell, not systemd.debug_shell). Considering both as equivalent is inspired how modern kernel module loading normalizes all kernel module names to use underscores now too. b) All options previously using a dash for separating words in kernel command line options now use an underscore instead, in all documentation and in code. Since a) has been implemented this should not create any compatibility problems, but normalizes our documentation and our code. c) All kernel command line options which take booleans (or are boolean-like) have been reworked so that "foobar" (without argument) is now equivalent to "foobar=1" (but not "foobar=0"), thus normalizing the handling of our boolean arguments. Specifically this means systemd.debug-shell and systemd_debug_shell=1 are now entirely equivalent. d) All kernel command line options which take an argument, and where no argument is specified will now result in a log message. e.g. passing just "systemd.unit" will no result in a complain that it needs an argument. This is implemented in the proc_cmdline_missing_value() function. e) There's now a call proc_cmdline_get_bool() similar to proc_cmdline_get_key() that parses booleans (following the logic explained in c). f) The proc_cmdline_parse() call's boolean argument has been replaced by a new flags argument that takes a common set of bits with proc_cmdline_get_key(). g) All kernel command line APIs now begin with the same "proc_cmdline_" prefix. h) There are now tests for much of this. Yay!
| * gpt-auto-generator: rename add_boot() → add_esp()Lennart Poettering2016-12-201-3/+3
|/ | | | | After all, the call doesn't necessarily mount /boot anymore, but possibly /efi now.
* tree-wide: stop using canonicalize_file_name(), use chase_symlinks() insteadLennart Poettering2016-12-011-1/+1
| | | | | | | | Let's use chase_symlinks() everywhere, and stop using GNU canonicalize_file_name() everywhere. For most cases this should not change behaviour, however increase exposure of our function to get better tested. Most importantly in a few cases (most notably nspawn) it can take the correct root directory into account when chasing symlinks.
* tree-wide: add PRI_[NU]SEC, and use time format strings moreZbigniew Jędrzejewski-Szmek2016-11-071-2/+2
|
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2016-10-231-12/+12
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* tree-wide: make parse_proc_cmdline() strip "rd." prefix automaticallyZbigniew Jędrzejewski-Szmek2016-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This stripping is contolled by a new boolean parameter. When the parameter is true, it means that the caller does not care about the distinction between initrd and real root, and wants to act on both rd-dot-prefixed and unprefixed parameters in the initramfs, and only on the unprefixed parameters in real root. If the parameter is false, behaviour is the same as before. Changes by caller: log.c (systemd.log_*): changed to accept rd-dot-prefix params pid1: no change, custom logic cryptsetup-generator: no change, still accepts rd-dot-prefix params debug-generator: no change, does not accept rd-dot-prefix params fsck: changed to accept rd-dot-prefix params fstab-generator: no change, custom logic gpt-auto-generator: no change, custom logic hibernate-resume-generator: no change, does not accept rd-dot-prefix params journald: changed to accept rd-dot-prefix params modules-load: no change, still accepts rd-dot-prefix params quote-check: no change, does not accept rd-dot-prefix params udevd: no change, still accepts rd-dot-prefix params I added support for "rd." params in the three cases where I think it's useful: logging, fsck options, journald forwarding options.
* tree-wide: allow state to be passed through to parse_proc_cmdline_itemZbigniew Jędrzejewski-Szmek2016-10-221-2/+2
| | | | No functional change.
* Merge pull request #3757 from poettering/efi-searchZbigniew Jędrzejewski-Szmek2016-07-251-65/+67
|\
| * gpt-generator: relax EFI check a bitLennart Poettering2016-07-211-54/+53
| | | | | | | | | | | | | | | | Previously, we'd not mount the ESP except on EFI boots, and only when the ESP used for booting matches the ESP we found. With this change on non-EFI boots we'll mount a discovered ESP anyway, and on EFI boots we'll only mount it if it matches the ESP we booted from.
| * gpt-generator: use /efi as mount point for the ESP if it existsLennart Poettering2016-07-211-19/+22
| | | | | | | | | | | | | | Let's make the EFI generator a bit smarter: if /efi exists it is used as mount point for the ESP, otherwise /boot is used. This should increase compatibility with distros which use legacy boot loaders that insist on having /boot as something that isn't the ESP.
* | Use "return log_error_errno" in more places"Zbigniew Jędrzejewski-Szmek2016-07-221-4/+2
|/
* Create initrd-root-device.target synchronization point (#3239)Daniel Drake2016-05-121-0/+6
| | | | | | | | | Add a synchronization point so that custom initramfs units can run after the root device becomes available, before it is fsck'd and mounted. This is useful for custom initramfs units that may modify the root disk partition table, where the root device is not known in advance (it's dynamically selected by the generators).
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* gpt-auto: handle errors from blkid more correctlyLennart Poettering2016-02-031-2/+3
| | | | | | Let's make sure we don't choke if blkid_probe_lookup_value() returns a NULL string. Also, make sur we propagate the correct error when blkid_probe_lookup_value() fails.
* gpt-auto: don't log an EIO error if blkid finds something which is not a ↵Lennart Poettering2016-02-011-4/+7
| | | | | | partition table Fixes: #2483
* tree-wide: group include of libudev.h with sd-*Thomas Hindoe Paaboel Andersen2015-11-171-1/+1
|
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-3/+3
| | | | Sort the includes accoding to the new coding style.
* treewide: apply errno.cocciMichal Schmidt2015-11-091-4/+2
| | | | with small manual cleanups for style.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: move /proc/cmdline parsing code to proc-cmdline.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: introduce dirent-util.[ch] for directory entry callsLennart Poettering2015-10-271-0/+1
| | | | Also, move a couple of more path-related functions to path-util.c.
* util-lib: move mount related utility calls to mount-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-12/+14
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.