From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Make systemctl is-enabled work for templated units Date: Sun, 19 May 2013 15:45:48 +0200 Message-ID: <1368971148.1836.45.camel@rice-oxley.tremer.info> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5724903801823912700==" List-Id: --===============5724903801823912700== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hello guys, in this mail, you will find a patch which resolves the problem, that 'systemctl is-enabled' does not work for templated units. See also https://bugs.freedesktop.org/show_bug.cgi?id=55318 for reference. Without this patch, systemctl is-enabled something(a)abc.service returned "No such file or directory", because it was checked if /usr/lib/systemd/system/something(a)abc.service, etc. existed, which is obviously not the case. If systemctl is-enabled is called for templated units, this check should be omitted and it should be searched for symlinks in the /etc paths right away. I would like to request that this is merged to the systemd git tree. Best, -Michael --===============5724903801823912700== Content-Type: text/x-patch Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-Make-systemctl-is-enabled-work-for-templated-units.patch" MIME-Version: 1.0 PkZyb20gNjMzYjVlY2ZkZWM5ZDU4OGFkNmY5N2EyMGM1MDA4OTIwMDYzMmUyNCBNb24gU2VwIDE3 IDAwOjAwOjAwIDIwMDEKRnJvbTogTWljaGFlbCBUcmVtZXIgPG1pY2hhZWwudHJlbWVyQGlwZmly ZS5vcmc+CkRhdGU6IFN1biwgMTkgTWF5IDIwMTMgMTU6Mjg6NDkgKzAyMDAKU3ViamVjdDogW1BB VENIXSBNYWtlIHN5c3RlbWN0bCBpcy1lbmFibGVkIHdvcmsgZm9yIHRlbXBsYXRlZCB1bml0cy4K CldpdGhvdXQgdGhpcyBwYXRjaCwgc3lzdGVtY3RsIGlzLWVuYWJsZWQgc29tZXRoaW5nQGFiYy5z ZXJ2aWNlCnJldHVybmVkICJObyBzdWNoIGZpbGUgb3IgZGlyZWN0b3J5IiwgYmVjYXVzZSBpdCB3 YXMgY2hlY2tlZAppZiAvdXNyL2xpYi9zeXN0Z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C1lcnJubzsKLSAgICAgICAgICAg ICAgICAgICAgICAgIGlmIChlcnJubyA9PSBFTk9FTlQpCi0gICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgICAg ICogU2VhcmNoIGZvciBhIHVuaXQgZmlsZSBpbiBvdXIgZGVmYXVsdCBwYXRocywgdG8KKyAgICAg ICAgICAgICAgICAgKiBiZSBzdXJlLCB0aGF0IHRoZXJlIGFyZSBubyBicm9rZW4gc3ltbGlua3Mu CisgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgaWYgKCF1bml0X25hbWVfaXNf aW5zdGFuY2UobmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChsc3RhdChwYXRo LCAmc3QpIDwgMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gLWVycm5v OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJybm8gPT0gRU5PRU5UKQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogCi0gICAg ICAgICAgICAgICAgICAgICAgICByZXR1cm4gLWVycm5vOwotICAgICAgICAgICAgICAgIH0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIC1lcnJubzsKKyAgICAgICAgICAg ICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmICghU19JU1JFRyhzdC5zdF9tb2Rl KSAmJiAhU19JU0xOSyhzdC5zdF9tb2RlKSkKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVy biAtRU5PRU5UOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFTX0lTUkVHKHN0LnN0X21v ZGUpICYmICFTX0lTTE5LKHN0LnN0X21vZGUpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICByZXR1cm4gLUVOT0VOVDsKIAotICAgICAgICAgICAgICAgIHIgPSBudWxsX29yX2VtcHR5 X3BhdGgocGF0aCk7Ci0gICAgICAgICAgICAgICAgaWYgKHIgPCAwICYmIHIgIT0gLUVOT0VOVCkK LSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByOwotICAgICAgICAgICAgICAgIGVsc2Ug aWYgKHIgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZSA9IHBhdGhfc3RhcnRz d2l0aCgqaSwgIi9ydW4iKSA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVOSVRf RklMRV9NQVNLRURfUlVOVElNRSA6IFVOSVRfRklMRV9NQVNLRUQ7Ci0gICAgICAgICAgICAgICAg ICAgICAgICByZXR1cm4gc3RhdGU7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAg ICAgICAgICAgciA9IG51bGxfb3JfZW1wdHlfcGF0aChwYXRoKTsKKyAgICAgICAgICAgICAgICAg ICAgICAgIGlmIChyIDwgMCAmJiByICE9IC1FTk9FTlQpCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHJldHVybiByOworICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAociA+ IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUgPSBwYXRoX3N0YXJ0 c3dpdGgoKmksICIvcnVuIikgPworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIFVOSVRfRklMRV9NQVNLRURfUlVOVElNRSA6IFVOSVRfRklMRV9NQVNLRUQ7CisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGF0ZTsKKyAgICAgICAgICAgICAgICAg ICAgICAgIH0KKwkJfQogCiAgICAgICAgICAgICAgICAgciA9IGZpbmRfc3ltbGlua3NfaW5fc2Nv cGUoc2NvcGUsIHJvb3RfZGlyLCBuYW1lLCAmc3RhdGUpOwogICAgICAgICAgICAgICAgIGlmIChy IDwgMCkKLS0gCjEuOC4xCgo= --===============5724903801823912700==--