summaryrefslogtreecommitdiff
path: root/src/shared/generator.c
Commit message (Collapse)AuthorAge
* fstab-generator: cescape device name in root-fsck serviceAndrei Borzenkov2017-03-14
| | | | | | | We unescape ExecStart line when parsing it, so escape device name before adding it to unit file. fixes #50
* shared: generator - correct path to systemd-fsckMike Gilbert2017-03-14
| | | | | | | In generated systemd-fsck-root.service. This would break if rootprefix is not /usr/lib/systemd. [tomegun: flesh out commit message]
* generator: use fflush_and_check() where appropriateLennart Poettering2017-03-14
|
* Generate systemd-fsck-root.service in the initramfsZbigniew Jędrzejewski-Szmek2017-03-14
| | | | | | | | | | | | | | In the initrafms, generate a systemd-fsck-root.service to replace systemd-fsck@<sysroot-device>.service. This way, after we transition to the real root, systemd-fsck-root.service is marked as already done. This introduces an unnecessary synchronization point, because systemd-fsck@* is ordered after systemd-fsck-root also in the initramfs. In practice this shouldn't be a problem. https://bugzilla.redhat.com/show_bug.cgi?id=1201979 C.f. 956eaf2b8d6c9999024705ddadc7393bc707de02.
* generators: rename add_{root,usr}_mount to add_{sysroot,sysroot_usr}_mountZbigniew Jędrzejewski-Szmek2017-03-14
| | | | | | | | | | | | This makes it obvious that those functions are only usable in the initramfs. Also, add a warning when noauto, nofail, or automount is used for the root fs, instead of silently ignoring. Using those options would be a sign of significant misconfiguration, and if we bother to check for them, than let's go all the way and complain. Other various small cleanups and reformattings elsewhere.
* core: rework unit name validation and manipulation logicLennart Poettering2017-03-14
| | | | | | | | | | | | | | | A variety of changes: - Make sure all our calls distuingish OOM from other errors if OOM is not the only error possible. - Be much stricter when parsing escaped paths, do not accept trailing or leading escaped slashes. - Change unit validation to take a bit mask for allowing plain names, instance names or template names or an combination thereof. - Refuse manipulating invalid unit name
* fstab-generator: don't accept missing root=, but accept root=noneTobias Hunger2015-03-25
| | | | | | | | | | | | | | | | | | | | | | | And other non-device entries (like fstab does). Mount whatever the user asked to be mounted on / on the kernel command line. Do less sanity check and do *not* bail out when the mount device looks strange or does not exist. This basically makes the changes for deviceless filesystems from yesterday unnecessary and is in line with what we do for filesystems set up in fstab. Remove some code that is now dead (reverting fb02a2775a65 and b0438462). [tomegun: - change patch title/description a bit. - don't touch the /usr logic, that would be a separate change and we don't currently have a convincing use-case for that. - don't bail out on /sys ro. This only makes sense in containers, where we would not be doing this anyway. If there is a use-case we could consider that as a separate patch.]
* fstab-generator: Do not check deviceless filesystemsTobias Hunger2015-03-24
| | | | There is no need to check those.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* Add new function to filter fstab optionsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | This fixes parsing of options in shared/generator.c. Existing code had some issues: - it would treate whitespace and semicolons as seperators. fstab(5) is pretty clear that only commas matter. And the syntax does not allow for spaces to be inserted in the field in fstab. Whitespace might be escaped, but then it should not seperate options. Treat whitespace and semicolons as any other character. - it assumed that x-systemd.device-timeout would always be followed by "=". But this is not guaranteed, hasmntopt will return this option even if there's no value. Uninitialized memory could be read. - some error paths would log, and inconsistently, some would just return an error code. Filtering is split out to a separate function and tests are added. Similar code paths in other places are adjusted to use the new function.
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-28
| | | | | | | | | | | | | Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* shared: fix format string for usec_t typeLennart Poettering2014-07-07
|
* dropin: add format attribute and fix a wrong callerThomas Hindoe Paaboel Andersen2014-07-07
|
* fstab-generator: add comma when removed option is in the middleZbigniew Jędrzejewski-Szmek2014-07-07
| | | | | xxx,x-systemd.default-timeout=y,zzz was filtered to xxxzzz, but should be xxx,zzz, of course.
* cryptsetup: allow x-systemd.device-timeoutZbigniew Jędrzejewski-Szmek2014-06-30
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=54210
* fstab-generator: allow x-systemd.device-timeout for swap unitsZbigniew Jędrzejewski-Szmek2014-06-30
|
* Move x-systemd-device.timeout handling from core to fstab-generatorZbigniew Jędrzejewski-Szmek2014-06-30
| | | | | | | | | | | | | Instead of adjusting job timeouts in the core, let fstab-generator write out a dropin snippet with the appropriate JobTimeout. x-systemd-device.timeout option is removed from Options= line in the generated unit. The functions to write dropins are moved from core/unit.c to shared/dropin.c, to make them available outside of core. generator.c is moved to libsystemd-label, because it now uses functions defined in dropin.c, which are in libsystemd-label.
* fsck: consider a fsck implementation linked to /bin/true non-existantLennart Poettering2014-06-25
|
* fsck: Search for fsck.type in PATHMike Gilbert2014-04-12
| | | | | | Modifies find_binary() to accept NULL in the second argument. fsck.type lookup logic moved to new fsck_exists() function, with a test.
* fstab-generator: merge /proc/cmdline parsing loops into oneLennart Poettering2014-03-07
|
* generators: rework mount generatorsLennart Poettering2014-03-06
- Add support for finding and mounting /srv based on GPT data, similar to how we already handly /home. - Share the fsck logic between GPT, EFI and fstab generators - Make sure we never run the EFI generator inside containers - Drop DefaultDependencies=no from EFI mount units - Other fixes