blob: 26f70b35d014c7d5edc4dc3db2760b0afda7f860 [file] [log] [blame]
Andrew Geissler4ed12e12020-06-05 18:00:41 -05001From 564830719be2017c4953589d50f21a9e856a4ecc Mon Sep 17 00:00:00 2001
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08002From: Chen Qi <Qi.Chen@windriver.com>
Brad Bishop19323692019-04-05 15:28:33 -04003Date: Thu, 21 Feb 2019 16:23:24 +0800
Andrew Geissler82c905d2020-04-13 13:39:40 -05004Subject: [PATCH] binfmt: Don't install dependency links at install time for
5 the binfmt services
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08006
7use [Install] blocks so that they get created when the service is enabled
8like a traditional service.
9
10The [Install] blocks were rejected upstream as they don't have a way to
11"enable" it on install without static symlinks which can't be disabled,
12only masked. We however can do that in a postinst.
13
14Upstream-Status: Denied
15
16Signed-off-by: Ross Burton <ross.burton@intel.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Brad Bishopa34c0302019-09-23 22:34:48 -040019[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Andrew Geissler82c905d2020-04-13 13:39:40 -050021
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080022---
23 units/meson.build | 6 ++----
24 units/proc-sys-fs-binfmt_misc.automount | 3 +++
25 units/systemd-binfmt.service.in | 4 ++++
26 3 files changed, 9 insertions(+), 4 deletions(-)
27
28diff --git a/units/meson.build b/units/meson.build
Andrew Geissler82c905d2020-04-13 13:39:40 -050029index ea91f0cc9ea7..25186f88dfeb 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080030--- a/units/meson.build
31+++ b/units/meson.build
Andrew Geissler82c905d2020-04-13 13:39:40 -050032@@ -52,8 +52,7 @@ units = [
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033 ['poweroff.target', '',
34 'runlevel0.target'],
35 ['printer.target', ''],
36- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT',
37- 'sysinit.target.wants/'],
38+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'],
39 ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'],
40 ['reboot.target', '',
41 'runlevel6.target ctrl-alt-del.target'],
Andrew Geissler82c905d2020-04-13 13:39:40 -050042@@ -161,8 +160,7 @@ in_units = [
43 ['rc-local.service', 'HAVE_SYSV_COMPAT'],
44 ['rescue.service', ''],
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045 ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'],
46- ['systemd-binfmt.service', 'ENABLE_BINFMT',
47- 'sysinit.target.wants/'],
48+ ['systemd-binfmt.service', 'ENABLE_BINFMT'],
Brad Bishop19323692019-04-05 15:28:33 -040049 ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'],
50 ['systemd-boot-check-no-failures.service', ''],
Andrew Geissler82c905d2020-04-13 13:39:40 -050051 ['systemd-coredump@.service', 'ENABLE_COREDUMP'],
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080052diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
Andrew Geissler82c905d2020-04-13 13:39:40 -050053index 30a6bc991844..4231f3b70fe9 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080054--- a/units/proc-sys-fs-binfmt_misc.automount
55+++ b/units/proc-sys-fs-binfmt_misc.automount
56@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/
57
58 [Automount]
59 Where=/proc/sys/fs/binfmt_misc
60+
61+[Install]
62+WantedBy=sysinit.target
63diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
Andrew Geissler4ed12e12020-06-05 18:00:41 -050064index e54e95e11d5d..372a598614d3 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080065--- a/units/systemd-binfmt.service.in
66+++ b/units/systemd-binfmt.service.in
67@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm
68 Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
69 DefaultDependencies=no
70 Conflicts=shutdown.target
71+Wants=proc-sys-fs-binfmt_misc.automount
72 After=proc-sys-fs-binfmt_misc.automount
Andrew Geissler82c905d2020-04-13 13:39:40 -050073 After=proc-sys-fs-binfmt_misc.mount
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080074 Before=sysinit.target shutdown.target
Andrew Geissler4ed12e12020-06-05 18:00:41 -050075@@ -30,3 +31,6 @@ RemainAfterExit=yes
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080076 ExecStart=@rootlibexecdir@/systemd-binfmt
Andrew Geissler4ed12e12020-06-05 18:00:41 -050077 ExecStop=@rootlibexecdir@/systemd-binfmt --unregister
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080078 TimeoutSec=90s
79+
80+[Install]
81+WantedBy=sysinit.target