|
|
15f218 |
From 0f305d7d54b40fe13b1ef2134701b5169fe79d65 Mon Sep 17 00:00:00 2001
|
|
|
15f218 |
From: Tomas Jelinek <tojeline@redhat.com>
|
|
|
15f218 |
Date: Thu, 30 Jun 2016 17:23:19 +0200
|
|
|
15f218 |
Subject: [PATCH] add a wrapper for holding SELinux context when pcsd is
|
|
|
15f218 |
started by systemd
|
|
|
15f218 |
|
|
|
15f218 |
---
|
|
|
15f218 |
Makefile | 3 +++
|
|
|
15f218 |
pcsd/pcsd.service | 2 +-
|
|
|
15f218 |
pcsd/pcsd.service-runner | 13 +++++++++++++
|
|
|
15f218 |
3 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
15f218 |
create mode 100644 pcsd/pcsd.service-runner
|
|
|
15f218 |
|
|
|
15f218 |
diff --git a/Makefile b/Makefile
|
|
|
15f218 |
index de216ce..f0a5d03 100644
|
|
|
15f218 |
--- a/Makefile
|
|
|
15f218 |
+++ b/Makefile
|
|
|
15f218 |
@@ -126,6 +126,9 @@ else
|
|
|
15f218 |
ifeq ($(IS_SYSTEMCTL),true)
|
|
|
15f218 |
install -d ${DESTDIR}/${systemddir}/system/
|
|
|
15f218 |
install -m 644 pcsd/pcsd.service ${DESTDIR}/${systemddir}/system/
|
|
|
15f218 |
+# ${DESTDIR}${PREFIX}/lib/pcsd/pcsd holds the selinux context
|
|
|
15f218 |
+ install -m 755 pcsd/pcsd.service-runner ${DESTDIR}${PREFIX}/lib/pcsd/pcsd
|
|
|
15f218 |
+ rm ${DESTDIR}${PREFIX}/lib/pcsd/pcsd.service-runner
|
|
|
15f218 |
else
|
|
|
15f218 |
install -m 755 -D pcsd/pcsd ${DESTDIR}/${initdir}/pcsd
|
|
|
15f218 |
endif
|
|
|
15f218 |
diff --git a/pcsd/pcsd.service b/pcsd/pcsd.service
|
|
|
15f218 |
index 075a3a6..e506f1b 100644
|
|
|
15f218 |
--- a/pcsd/pcsd.service
|
|
|
15f218 |
+++ b/pcsd/pcsd.service
|
|
|
15f218 |
@@ -4,7 +4,7 @@ Description=PCS GUI and remote configuration interface
|
|
|
15f218 |
[Service]
|
|
|
15f218 |
EnvironmentFile=/etc/sysconfig/pcsd
|
|
|
15f218 |
Environment=GEM_HOME=/usr/lib/pcsd/vendor/bundle/ruby
|
|
|
15f218 |
-ExecStart=/usr/bin/ruby -C/var/lib/pcsd -I/usr/lib/pcsd -- /usr/lib/pcsd/ssl.rb > /dev/null &
|
|
|
15f218 |
+ExecStart=/usr/lib/pcsd/pcsd > /dev/null &
|
|
|
15f218 |
|
|
|
15f218 |
[Install]
|
|
|
15f218 |
WantedBy=multi-user.target
|
|
|
15f218 |
diff --git a/pcsd/pcsd.service-runner b/pcsd/pcsd.service-runner
|
|
|
15f218 |
new file mode 100644
|
|
|
15f218 |
index 0000000..1949a68
|
|
|
15f218 |
--- /dev/null
|
|
|
15f218 |
+++ b/pcsd/pcsd.service-runner
|
|
|
15f218 |
@@ -0,0 +1,13 @@
|
|
|
15f218 |
+#!/usr/bin/ruby
|
|
|
15f218 |
+# this file is a pcsd runner callable from a systemd unit
|
|
|
15f218 |
+# it also serves as a holder of a selinux context
|
|
|
15f218 |
+
|
|
|
15f218 |
+# add pcsd to the load path (ruby -I)
|
|
|
15f218 |
+libdir = File.dirname(__FILE__)
|
|
|
15f218 |
+$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
|
15f218 |
+
|
|
|
15f218 |
+# change current directory (ruby -C)
|
|
|
15f218 |
+Dir.chdir('/var/lib/pcsd')
|
|
|
15f218 |
+
|
|
|
15f218 |
+# import and run pcsd
|
|
|
15f218 |
+require 'ssl'
|
|
|
15f218 |
--
|
|
|
15f218 |
1.8.3.1
|
|
|
15f218 |
|