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