34bac8
From cd26e9e9a7816efe2c1ce9c36d9cb14988c70dc9 Mon Sep 17 00:00:00 2001
34bac8
From: Robbie Harwood <rharwood@redhat.com>
34bac8
Date: Mon, 8 Nov 2021 17:58:09 -0500
34bac8
Subject: [PATCH] Replace /var/run with /run
34bac8
34bac8
This change is in violation of the FHS and is forced by systemd being
34bac8
obnoxious and logging warnings about it as if it's some kind of problem.
34bac8
34bac8
This commit is a subset of the work in
34bac8
02d473fbfd782863a0dcef7e44822d1e7e56a4b3,
34bac8
f97d3b04a2eafb42272ede24e1353dd0a7f4347c,
34bac8
5f9058677e7241cc88b4e8620654bbaa08a4bce4, and
34bac8
cffa10d9b5eec9a9def3533b181a32b64fc29913 (all by pjones) because they
34bac8
don't backport well.
34bac8
34bac8
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
34bac8
---
34bac8
 src/Makefile           |  2 +-
34bac8
 src/daemon.h           |  4 ++--
34bac8
 src/macros.pesign      | 12 ++++++------
34bac8
 src/pesign-authorize   |  2 +-
34bac8
 src/pesign.service.in  |  2 +-
34bac8
 src/pesign.sysvinit.in | 10 +++++-----
34bac8
 src/tmpfiles.conf      |  2 +-
34bac8
 7 files changed, 17 insertions(+), 17 deletions(-)
34bac8
34bac8
diff --git a/src/Makefile b/src/Makefile
34bac8
index 7d68fa1..a11e2b4 100644
34bac8
--- a/src/Makefile
34bac8
+++ b/src/Makefile
34bac8
@@ -68,7 +68,7 @@ install_sysvinit: pesign.sysvinit
34bac8
 install :
34bac8
 	$(INSTALL) -d -m 700 $(INSTALLROOT)/etc/pki/pesign/
34bac8
 	$(INSTALL) -d -m 700 $(INSTALLROOT)/etc/pki/pesign-rh-test/
34bac8
-	$(INSTALL) -d -m 770 $(INSTALLROOT)/var/run/pesign/
34bac8
+	$(INSTALL) -d -m 770 $(INSTALLROOT)/run/pesign/
34bac8
 	$(INSTALL) -d -m 755 $(INSTALLROOT)$(bindir)
34bac8
 	$(INSTALL) -m 755 authvar $(INSTALLROOT)$(bindir)
34bac8
 	$(INSTALL) -m 755 pesign $(INSTALLROOT)$(bindir)
34bac8
diff --git a/src/daemon.h b/src/daemon.h
34bac8
index d97eab9..db42c16 100644
34bac8
--- a/src/daemon.h
34bac8
+++ b/src/daemon.h
34bac8
@@ -49,7 +49,7 @@ typedef enum {
34bac8
 } pesignd_cmd;
34bac8
 
34bac8
 #define PESIGND_VERSION 0x2a9edaf0
34bac8
-#define SOCKPATH	"/var/run/pesign/socket"
34bac8
-#define PIDFILE		"/var/run/pesign.pid"
34bac8
+#define SOCKPATH	"/run/pesign/socket"
34bac8
+#define PIDFILE		"/run/pesign.pid"
34bac8
 
34bac8
 #endif /* DAEMON_H */
34bac8
diff --git a/src/macros.pesign b/src/macros.pesign
34bac8
index dfdac02..f135c29 100644
34bac8
--- a/src/macros.pesign
34bac8
+++ b/src/macros.pesign
34bac8
@@ -48,17 +48,17 @@
34bac8
            "$(uname -m)" == "x86_64" ] &&				\\\
34bac8
          grep -q ID=fedora /etc/os-release && 				\\\
34bac8
          [[ "%{_buildhost}" =~ ^bkernel.* ]] &&			\\\
34bac8
-         ! [ -S /var/run/pesign/socket ]; then				\
34bac8
+         ! [ -S /run/pesign/socket ]; then				\
34bac8
       echo "No socket even though this is %{_buildhost}"		\
34bac8
-      ls -ld /var/run/pesign || :					\
34bac8
-      getfacl /var/run/pesign || :					\
34bac8
-      ls -l /var/run/pesign/socket || :				\
34bac8
-      getfacl /var/run/pesign/socket || :				\
34bac8
+      ls -ld /run/pesign || :					\
34bac8
+      getfacl /run/pesign || :					\
34bac8
+      ls -l /run/pesign/socket || :				\
34bac8
+      getfacl /run/pesign/socket || :				\
34bac8
       echo =========== env ==============				\
34bac8
       set								\
34bac8
       echo =========== env ==============				\
34bac8
       exit 1								\
34bac8
-    elif [ -S /var/run/pesign/socket ]; then				\
34bac8
+    elif [ -S /run/pesign/socket ]; then				\
34bac8
       %{_pesign_client} -t %{__pesign_client_token}			\\\
34bac8
                         -c %{__pesign_client_cert}			\\\
34bac8
                         %{-i} %{-o} %{-e} %{-s} %{-C}			\
34bac8
diff --git a/src/pesign-authorize b/src/pesign-authorize
34bac8
index a496f60..83a30cd 100755
34bac8
--- a/src/pesign-authorize
34bac8
+++ b/src/pesign-authorize
34bac8
@@ -47,7 +47,7 @@ update_subdir() {
34bac8
 	done
34bac8
 }
34bac8
 
34bac8
-for x in /var/run/pesign/ /etc/pki/pesign*/ ; do
34bac8
+for x in /run/pesign/ /etc/pki/pesign*/ ; do
34bac8
 	if [ -d "${x}" ]; then
34bac8
 		update_subdir "${x}"
34bac8
 	else
34bac8
diff --git a/src/pesign.service.in b/src/pesign.service.in
34bac8
index c75a000..4ac2199 100644
34bac8
--- a/src/pesign.service.in
34bac8
+++ b/src/pesign.service.in
34bac8
@@ -4,6 +4,6 @@ Description=Pesign signing daemon
34bac8
 [Service]
34bac8
 PrivateTmp=true
34bac8
 Type=forking
34bac8
-PIDFile=/var/run/pesign.pid
34bac8
+PIDFile=/run/pesign.pid
34bac8
 ExecStart=/usr/bin/pesign --daemonize
34bac8
 ExecStartPost=@@LIBEXECDIR@@/pesign/pesign-authorize
34bac8
diff --git a/src/pesign.sysvinit.in b/src/pesign.sysvinit.in
34bac8
index b0e0f84..bf8edec 100644
34bac8
--- a/src/pesign.sysvinit.in
34bac8
+++ b/src/pesign.sysvinit.in
34bac8
@@ -4,7 +4,7 @@
34bac8
 #
34bac8
 # chkconfig: - 50 50
34bac8
 # processname: /usr/bin/pesign
34bac8
-# pidfile: /var/run/pesign.pid
34bac8
+# pidfile: /run/pesign.pid
34bac8
 ### BEGIN INIT INFO 
34bac8
 # Provides: pesign
34bac8
 # Default-Start:
34bac8
@@ -20,9 +20,9 @@ RETVAL=0
34bac8
 
34bac8
 start(){
34bac8
     echo -n "Starting pesign: "
34bac8
-    mkdir /var/run/pesign 2>/dev/null &&
34bac8
-        chown pesign:pesign /var/run/pesign &&
34bac8
-        chmod 0770 /var/run/pesign
34bac8
+    mkdir /run/pesign 2>/dev/null &&
34bac8
+        chown pesign:pesign /run/pesign &&
34bac8
+        chmod 0770 /run/pesign
34bac8
     daemon /usr/bin/pesign --daemonize
34bac8
     RETVAL=$?
34bac8
     echo
34bac8
@@ -32,7 +32,7 @@ start(){
34bac8
 
34bac8
 stop(){
34bac8
     echo -n "Stopping pesign: "
34bac8
-    killproc -p /var/run/pesign.pid pesignd
34bac8
+    killproc -p /run/pesign.pid pesignd
34bac8
     RETVAL=$?
34bac8
     echo
34bac8
     rm -f /var/lock/subsys/pesign
34bac8
diff --git a/src/tmpfiles.conf b/src/tmpfiles.conf
34bac8
index c1cf355..3375ad5 100644
34bac8
--- a/src/tmpfiles.conf
34bac8
+++ b/src/tmpfiles.conf
34bac8
@@ -1 +1 @@
34bac8
-D /var/run/pesign 0770 pesign pesign -
34bac8
+D /run/pesign 0770 pesign pesign -
34bac8
-- 
34bac8
2.33.0
34bac8