summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd-systemctl
Commit message (Collapse)AuthorAgeFilesLines
* systemd-systemctl: Fix handling of aliased targetsSlavic Brutalik2019-12-311-1/+1
| | | | | | | | | | | | | | | | | The script scans for services, parses them and makes sure those targets are still there. The exists file check fails if the target is an alias, such as default.target so add an additional test. [YOCTO #13685] (From OE-Core rev: 10bdbf033e51c97f6408c9114d480372135a2c2e) (From OE-Core rev: 64d305024e0514b832da05867672f61d1b5b3225) Signed-off-by: Werner Grift <sky.captin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd-systemctl-native: don't care about line endingsRoss Burton2019-09-191-1/+1
| | | | | | | | | | | | It's possible for a service file to accidentally contain mixed line endings, but the string cleanup code was assuming Unix endings. [ YOCTO #13535 ] (From OE-Core rev: 7aaa9200b5ba2cba92ee1ed7003d54848498b37d) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd: Add partial support of drop-in configuration files to ↵Frederic Ouellet2019-07-261-2/+9
| | | | | | | | | | | | | | systemd-systemctl-native Support for serive-name.service.d/ folders containing .conf files It don't support all the partial folder names See https://www.freedesktop.org/software/systemd/man/systemd.unit.html (From OE-Core rev: 32ed8e53109f4384970fb540e44cc2f7fcafb2a5) Signed-off-by: Frederic Ouellet <fredericouellet@eaton.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd-systemctl: Restore support for enable commandAlex Kiernan2019-05-091-77/+102
| | | | | | | | | | | | | Refactor so that SystemdUnit is its own class, then add support for the enable command. This restores the ability of systemd.bbclass to create instances using syntax such as: SYSTEMD_SERVICE_${PN} = "serial-getty@ttyAMA0.service" (From OE-Core rev: 9ef6f326ad323b2687440b81b0a983cb3d86a3ab) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd: Default to non-stateless imagesAlex Kiernan2019-05-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | When creating images, for anything other than the explicitly stateless case, touch /etc/machine-id so that the images can be booted without an initramfs and with `ro` set on the kernel command line, otherwise system refuses to start: [ 7.222134] systemd[1]: No hostname configured. [ 7.227266] systemd[1]: Set hostname to <localhost>. [ 7.232622] systemd[1]: System cannot boot: Missing /etc/machine-id and /etc is mounted read-only. [ 7.241750] systemd[1]: Booting up is supported only when: [ 7.247362] systemd[1]: 1) /etc/machine-id exists and is populated. [ 7.253752] systemd[1]: 2) /etc/machine-id exists and is empty. [ 7.259757] systemd[1]: 3) /etc/machine-id is missing and /etc is writable. If IMAGE_FEATURES includes `stateless-rootfs` then systemctl-native is not run on the image leaving the image for population at runtime by systemd. (From OE-Core rev: c5fb399f5894c16cf8eeadd507dc38c29b0fd657) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemctl-native: Rewrite in Python supporting preset-all and maskAlex Kiernan2019-05-031-196/+280
| | | | | | | | | | | | | | | | | | | | | | Rewrite systemctl-native in Python so that extending/testing it is easier. Now that the systemd class sets up service presets instead of actively enabling services, the 'enable' and 'disable' subcommands for systemctl are not actually used anywhere. As such, we can remove these to make sure that nobody inadvertently introduces new uses of them. This implementation covers `preset-all` and `mask` which are the only options used in the current code, but should be readily extensible to other commands. We use `preset-all` at image construction time to populate the symlinks used by systemd. (From OE-Core rev: 86f5a2383692ac1ab01dce534c1a5c5f32ec4b35) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd-systemctl-native: handle Install wildcardsBrad Bishop2018-11-141-7/+8
| | | | | | | | | | | | | | | | | | | | | | Handle the %i wildcard appearing in a dependency in the Install section of a template unit, e.g. $ cat foo@.service [Install] WantedBy=bar@%i.target Using the real systemctl something like: $ systemctl enable foo@baz.service will create a symlink in /etc/systemd/system/bar@baz.target.wants. Detect wildcards in templates and make the appropriate substitution. (From OE-Core rev: 22ed19292d160461042d4a2294fe2ec0b953873e) Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemctl-native: add target.wants to target regexMartin Kelly2017-11-081-1/+1
| | | | | | | | | | | | | | | The regex for acceptable systemd WantedBy/RequiredBy targets does not include target.wants, so a line like this: WantedBy=multi-user.target.wants gets silently ignored, even though it works fine on a real system. (From OE-Core rev: ccffc66c64fc0dde433b0375c69760983c657427) Signed-off-by: Martin Kelly <mkelly@xevo.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd-systemctl-native: fix unit detectionRoss Burton2016-04-091-1/+1
| | | | | | | | | | | The regexs were too strict and didn't allow for trailing whitespace. [ YOCTO #9337 ] (From OE-Core rev: 0395162aa45a416db6a0a38e7ee6c0f808272393) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemctl: handle RequiredBy dependenciesTomas Novotny2016-02-281-24/+37
| | | | | | | | | | | | | | | Install section of a systemd service may contain RequiredBy dependency, which is not handled currently. This means that symlinks to enable the service are not created and the service may not be started. Also fix debug output (all dependencies were printed instead of the one which was enabled or disabled). (From OE-Core rev: 6f4d9d9675ce39f5154de30b2921ada019a93d0f) Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd: fix systemctl enable script for template unitsEnrico Jorns2016-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The systemctl script supports enabling template units by evaluating "DefaultInstance" parameter. Unfortunately, due to the sed replacement mechanism, all escaping used in the DefaultInstance string, e.g. for giving path names with dashes, is expanded too early. Thus for DefaultInstance=-path\x2dwith\x2ddashes a path unit `foobar@.path` will be installed with a symlink named foobar@-path-with-dashed.path that is interpreted as the path `/path/with/dashes` instead of the intended path nam `/path-with-dashes`. To fix this behavior additional escaping of the backslashes in the `DefaultInstance` string is required so that sed does not expand the escaped characters. (From OE-Core rev: 8b9b9fd700b19731b14a7dcc51d0fa013a5e106a) Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemctl: Don't try to remove directory which doesn't existMartin Jansa2015-03-201-1/+1
| | | | | | | | | | | | | | | | | Noticed in this log.do_rootfs error: Started /OE/build/shr-core/tmp-glibc/sysroots/x86_64-linux/usr/bin/systemctl --root=/OE/build/shr-core/tmp-glibc/work/nokia900-oe-linux-gnueabi/shr-image/2.0-r20/rootfs disable bluetooth.service Try to find location of bluetooth.service... Found bluetooth.service in /lib/systemd/system/bluetooth.service WantedBy=bluetooth.target found in bluetooth.service rmdir: failed to remove '/OE/build/shr-core/tmp-glibc/work/nokia900-oe-linux-gnueabi/shr-image/2.0-r20/rootfs/etc/systemd/system/bluetooth.target.wants': No such file or directory Disabled bluetooth.service for bluetooth.target. Disabled bluetooth.service for dbus-org.bluez.service. (From OE-Core rev: 0332e19098d7d3d623a04098b43e3b2482af1a17) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd-systemctl: add handling of template unit filesTomas Novotny2014-12-191-8/+37
| | | | | | | | | | | | | | | | | | | | | Template unit files (those with '@' in their names) are not handled with native version of systemctl. This is usually not a problem, as the native systemctl fails and systemctl command is executed during first boot. But some early boot template units may fail during first boot because opkg configure for first boot is pulled too late for them (although I encouter it only with some of my services, not with oe-core ones). Handling of template unit files is same as in original systemctl. Also DefaultInstance directive in template is respected. As with original systemctl, enabling of template without instance and DefaultInstance does nothing. (From OE-Core rev: 90904ef3bab182a46174f7bb60e83f0f22a3f209) Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd-systemctl: Add preset capabilityKhem Raj2013-12-141-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | systemd has presets as described here http://lists.freedesktop.org/archives/systemd-devel/2011-July/002830.html This patch will let distros define presets file which will override the enable/disable specified by recipes. systemctl preset without any argument will run presents on all services systemctl preset service1 service2 will run presets on specified pervice. something like enable * or disable * would mean that all services will be either enabled or disabled by default. If no user-presets are specified then 'enable' is default systemd allows basic globs but we do not implement them except '*' (From OE-Core rev: 1254416901a0c70814296a86784f4934f27c7d4a) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemctl: Support all unit types in the directives.Randy Witt2013-06-251-2/+6
| | | | | | | | | | | | | | | | | | | | The Alias and WantedBy directives can accept all valid unit types when using the systemctl from systemd. And since the systemctl script should match the behavior of systemd as much as possible, add the current set of unit types listed at http://www.freedesktop.org/software/systemd/man/systemd.unit.html to the Alias and WantedBy directives. The deficiency was exposed when trying to use: Alias=default.target in a foo.target. No symlink was created by running "systemctl enable foo.target" during the package's postinst. (From OE-Core rev: 374b9c37b3310cf2a3373633197ca7ba21f6d1bd) Signed-off-by: Randy Witt <rewitt@declaratino.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd-systemctl: parse unit files more correctlyEnrico Scholz2013-04-291-6/+3
| | | | | | | | | | | | | | | | | | | Old script failed to parse unit files containing comments like | #Alias=some-alias or whitespaces like | WantedBy = foo correctly. Patch changes script to interpret keywords only when they are at the beginning of a line and ignores whitespaces before the '='. (From OE-Core rev: 443e75ee2c0e9a62df997aef24855bce54d39177) Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* systemd: add systemd recipesRadu Moisan2013-01-201-0/+126
Add systemd recipes and associated support recipes. Mostly based on meta-oe/meta-systemd, so almost all credit should go to: Andreas Müller <schnitzeltony@googlemail.com> Denis 'GNUtoo' Carikli <GNUtoo@no-log.org> Holger Hans Peter Freyther <holger@moiji-mobile.com> Khem Raj <raj.khem@gmail.com> Koen Kooi <koen@dominion.thruhere.net> Martin Jansa <Martin.Jansa@gmail.com> (From OE-Core rev: 6a8a48b4d0d0b9b8d8af46cae11245bcb870bbc3) Signed-off-by: Radu Moisan <radu.moisan@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>