|
|
f35dbb |
From 246ba5fed9f67047179f11a85c5fa4c869b62840 Mon Sep 17 00:00:00 2001
|
|
|
f35dbb |
From: Mario Limonciello <mario.limonciello@dell.com>
|
|
|
f35dbb |
Date: Mon, 9 Jul 2018 17:09:41 -0500
|
|
|
f35dbb |
Subject: [PATCH] Allow running on an older systemd
|
|
|
f35dbb |
|
|
|
f35dbb |
Build the path list dynamically based on enabled plugins and use options
|
|
|
f35dbb |
that are compatible with older systemd when appropriate
|
|
|
f35dbb |
---
|
|
|
f35dbb |
data/fwupd.service.in | 6 +----
|
|
|
f35dbb |
data/meson.build | 61 ++++++++++++++++++++++++++++---------------
|
|
|
f35dbb |
meson.build | 2 +-
|
|
|
f35dbb |
3 files changed, 42 insertions(+), 27 deletions(-)
|
|
|
f35dbb |
|
|
|
f35dbb |
diff --git a/data/fwupd.service.in b/data/fwupd.service.in
|
|
|
f35dbb |
index 7785439f..996ff4cf 100644
|
|
|
f35dbb |
--- a/data/fwupd.service.in
|
|
|
f35dbb |
+++ b/data/fwupd.service.in
|
|
|
f35dbb |
@@ -8,13 +8,9 @@ Before=gdm.service
|
|
|
f35dbb |
Type=dbus
|
|
|
f35dbb |
BusName=org.freedesktop.fwupd
|
|
|
f35dbb |
ExecStart=@libexecdir@/fwupd/fwupd
|
|
|
f35dbb |
-MemoryDenyWriteExecute=yes
|
|
|
f35dbb |
PrivateTmp=yes
|
|
|
f35dbb |
-ProtectControlGroups=yes
|
|
|
f35dbb |
ProtectHome=yes
|
|
|
f35dbb |
-ProtectKernelModules=yes
|
|
|
f35dbb |
ProtectSystem=full
|
|
|
f35dbb |
RestrictAddressFamilies=AF_NETLINK AF_UNIX
|
|
|
f35dbb |
-RestrictRealtime=yes
|
|
|
f35dbb |
-ReadWritePaths=@localstatedir@/lib/fwupd @sysconfdir@/fwupd/remotes.d -@bootdir@
|
|
|
f35dbb |
SystemCallFilter=~@mount
|
|
|
f35dbb |
+@dynamic_options@
|
|
|
f35dbb |
diff --git a/data/meson.build b/data/meson.build
|
|
|
f35dbb |
index 7adc0c05..c40b132b 100644
|
|
|
f35dbb |
--- a/data/meson.build
|
|
|
f35dbb |
+++ b/data/meson.build
|
|
|
f35dbb |
@@ -30,26 +30,47 @@ if get_option('daemon')
|
|
|
f35dbb |
)
|
|
|
f35dbb |
endif
|
|
|
f35dbb |
|
|
|
f35dbb |
-con2 = configuration_data()
|
|
|
f35dbb |
-con2.set('libexecdir', libexecdir)
|
|
|
f35dbb |
-con2.set('bindir', bindir)
|
|
|
f35dbb |
-con2.set('localstatedir', localstatedir)
|
|
|
f35dbb |
-con2.set('datadir', datadir)
|
|
|
f35dbb |
-con2.set('bootdir', get_option('bootdir'))
|
|
|
f35dbb |
-con2.set('sysconfdir', default_sysconfdir)
|
|
|
f35dbb |
+if get_option('systemd')
|
|
|
f35dbb |
+ con2 = configuration_data()
|
|
|
f35dbb |
+ con2.set('libexecdir', libexecdir)
|
|
|
f35dbb |
+ con2.set('bindir', bindir)
|
|
|
f35dbb |
+ con2.set('localstatedir', localstatedir)
|
|
|
f35dbb |
+ con2.set('datadir', datadir)
|
|
|
f35dbb |
+ con2.set('bootdir', get_option('bootdir'))
|
|
|
f35dbb |
+ con2.set('sysconfdir', default_sysconfdir)
|
|
|
f35dbb |
|
|
|
f35dbb |
-# replace @libexecdir@
|
|
|
f35dbb |
-configure_file(
|
|
|
f35dbb |
- input : 'org.freedesktop.fwupd.service.in',
|
|
|
f35dbb |
- output : 'org.freedesktop.fwupd.service',
|
|
|
f35dbb |
- configuration : con2,
|
|
|
f35dbb |
- install: true,
|
|
|
f35dbb |
- install_dir: join_paths(datadir,
|
|
|
f35dbb |
- 'dbus-1',
|
|
|
f35dbb |
- 'system-services'),
|
|
|
f35dbb |
-)
|
|
|
f35dbb |
+ rw_directories = []
|
|
|
f35dbb |
+ rw_directories += join_paths (localstatedir, 'lib', 'fwupd')
|
|
|
f35dbb |
+ rw_directories += join_paths (default_sysconfdir, 'fwupd', 'remotes.d')
|
|
|
0189f1 |
+ rw_directories += ['-/boot/efi', '-/boot', '-/efi']
|
|
|
0189f1 |
+
|
|
|
0189f1 |
+
|
|
|
f35dbb |
+
|
|
|
f35dbb |
+ dynamic_options = []
|
|
|
f35dbb |
+ if systemd.version().version_compare('>= 232')
|
|
|
f35dbb |
+ dynamic_options += 'ProtectControlGroups=yes'
|
|
|
f35dbb |
+ dynamic_options += 'ProtectKernelModules=yes'
|
|
|
f35dbb |
+ endif
|
|
|
f35dbb |
+ if systemd.version().version_compare('>= 231')
|
|
|
f35dbb |
+ dynamic_options += 'RestrictRealtime=yes'
|
|
|
f35dbb |
+ dynamic_options += 'MemoryDenyWriteExecute=yes'
|
|
|
f35dbb |
+ dynamic_options += ['ReadWritePaths=' + ' '.join(rw_directories)]
|
|
|
f35dbb |
+ else
|
|
|
f35dbb |
+ dynamic_options += ['ReadWriteDirectories=' + ' '.join(rw_directories)]
|
|
|
f35dbb |
+ endif
|
|
|
f35dbb |
+ con2.set('dynamic_options', '\n'.join(dynamic_options))
|
|
|
f35dbb |
+
|
|
|
f35dbb |
+ # replace @libexecdir@
|
|
|
f35dbb |
+ configure_file(
|
|
|
f35dbb |
+ input : 'org.freedesktop.fwupd.service.in',
|
|
|
f35dbb |
+ output : 'org.freedesktop.fwupd.service',
|
|
|
f35dbb |
+ configuration : con2,
|
|
|
f35dbb |
+ install: true,
|
|
|
f35dbb |
+ install_dir: join_paths(datadir,
|
|
|
f35dbb |
+ 'dbus-1',
|
|
|
f35dbb |
+ 'system-services'),
|
|
|
f35dbb |
+ )
|
|
|
f35dbb |
|
|
|
f35dbb |
-if get_option('systemd')
|
|
|
f35dbb |
# replace @bindir@
|
|
|
f35dbb |
configure_file(
|
|
|
f35dbb |
input : 'fwupd-offline-update.service.in',
|
|
|
f35dbb |
@@ -58,10 +79,8 @@ if get_option('systemd')
|
|
|
f35dbb |
install: true,
|
|
|
f35dbb |
install_dir: systemdunitdir,
|
|
|
f35dbb |
)
|
|
|
f35dbb |
-endif
|
|
|
f35dbb |
|
|
|
f35dbb |
-if get_option('systemd')
|
|
|
f35dbb |
- # replace @localstatedir@, @sysconfdir@ and @bootdir@
|
|
|
f35dbb |
+ # replace @dynamic_options@
|
|
|
f35dbb |
configure_file(
|
|
|
f35dbb |
input : 'fwupd.service.in',
|
|
|
f35dbb |
output : 'fwupd.service',
|
|
|
f35dbb |
diff --git a/meson.build b/meson.build
|
|
|
f35dbb |
index 2f2710c2..fecdfca5 100644
|
|
|
f35dbb |
--- a/meson.build
|
|
|
f35dbb |
+++ b/meson.build
|
|
|
f35dbb |
@@ -225,7 +225,7 @@ if get_option('plugin_thunderbolt')
|
|
|
f35dbb |
endif
|
|
|
f35dbb |
|
|
|
f35dbb |
if get_option('systemd')
|
|
|
f35dbb |
- systemd = dependency('systemd', version : '>= 231')
|
|
|
f35dbb |
+ systemd = dependency('systemd', version : '>= 211')
|
|
|
f35dbb |
conf.set('HAVE_SYSTEMD' , '1')
|
|
|
f35dbb |
endif
|
|
|
f35dbb |
|
|
|
f35dbb |
--
|
|
|
f35dbb |
2.17.1
|
|
|
f35dbb |
|