atop: Merge all path-fixing to a single patch, comment the remaining patches

This commit is contained in:
Paul Schyska 2021-05-16 22:08:05 +02:00
parent 27d323d281
commit 76554beed8
No known key found for this signature in database
GPG Key ID: D49D4F8259DB724F
7 changed files with 58 additions and 44 deletions

View File

@ -1,13 +0,0 @@
--- a/atop-pm.sh
+++ b/atop-pm.sh
@@ -2,8 +2,8 @@
case "$1" in
- pre) /usr/bin/systemctl stop atop
+ pre) @systemd@/bin/systemctl stop atop
exit 0
;;
- post) /usr/bin/systemctl start atop
+ post) @systemd@/bin/systemctl start atop
exit 0
;;

View File

@ -1,7 +0,0 @@
--- a/atop-rotate.service
+++ b/atop-rotate.service
@@ -4,3 +4,3 @@
[Service]
Type=oneshot
-ExecStart=/usr/bin/systemctl try-restart atop.service
+ExecStart=@systemd@/bin/systemctl try-restart atop.service

View File

@ -1,14 +1,10 @@
--- a/atop.service
+++ b/atop.service
@@ -9,7 +9,8 @@
@@ -9,5 +9,6 @@
Environment=LOGPATH=/var/log/atop
-EnvironmentFile=/etc/default/atop
+EnvironmentFile=-/etc/default/atop
ExecStartPre=/bin/sh -c 'test -n "$LOGINTERVAL" -a "$LOGINTERVAL" -eq "$LOGINTERVAL"'
ExecStartPre=/bin/sh -c 'test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS"'
-ExecStart=/bin/sh -c 'exec /usr/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'
-ExecStartPost=/usr/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \;
+ExecStartPre=/bin/sh -c 'mkdir -p "${LOGPATH}"'
+ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'
+ExecStartPost=@findutils@/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \;
KillSignal=SIGUSR2
ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'

View File

@ -1,11 +1,7 @@
--- a/atopacct.service
+++ b/atopacct.service
@@ -8,6 +8,6 @@
[Service]
@@ -9,3 +9,3 @@
Type=forking
-PIDFile=/var/run/atopacctd.pid
-ExecStart=/usr/sbin/atopacctd
+PIDFile=/run/atopacctd.pid
+ExecStart=@out@/bin/atopacctd
[Install]
ExecStart=@out@/bin/atopacctd

View File

@ -1,9 +0,0 @@
--- a/atopgpu.service
+++ b/atopgpu.service
@@ -6,5 +6,5 @@
[Service]
-ExecStart=/usr/sbin/atopgpud
+ExecStart=@out@/bin/atopgpud
Type=oneshot
RemainAfterExit=yes

View File

@ -35,11 +35,14 @@ stdenv.mkDerivation rec {
];
patches = [
./atop-pm.sh.patch
./atop-rotate.service.patch
# Fix paths in atop.service, atop-rotate.service, atopgpu.service, atopacct.service,
# and atop-pm.sh
./fix-paths.patch
# Don't fail on missing /etc/default/atop, make sure /var/log/atop exists pre-start
./atop.service.patch
# Specify PIDFile in /run, not /var/run to silence systemd warning
./atopacct.service.patch
] ++ (if withAtopgpu then [ ./atopgpu.service.patch ] else [ ]);
];
preConfigure = ''
for f in *.{sh,service}; do

View File

@ -0,0 +1,48 @@
--- a/atop.service
+++ b/atop.service
@@ -12,4 +12,4 @@
ExecStartPre=/bin/sh -c 'test -n "$LOGGENERATIONS" -a "$LOGGENERATIONS" -eq "$LOGGENERATIONS"'
-ExecStart=/bin/sh -c 'exec /usr/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'
-ExecStartPost=/usr/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \;
+ExecStart=/bin/sh -c 'exec @out@/bin/atop ${LOGOPTS} -w "${LOGPATH}/atop_$(date +%%Y%%m%%d)" ${LOGINTERVAL}'
+ExecStartPost=@findutils@/bin/find "${LOGPATH}" -name "atop_*" -mtime +${LOGGENERATIONS} -exec rm -v {} \;
KillSignal=SIGUSR2
--- a/atop-rotate.service
+++ b/atop-rotate.service
@@ -4,3 +4,3 @@
[Service]
Type=oneshot
-ExecStart=/usr/bin/systemctl try-restart atop.service
+ExecStart=@systemd@/bin/systemctl try-restart atop.service
--- a/atopgpu.service
+++ b/atopgpu.service
@@ -6,5 +6,5 @@
[Service]
-ExecStart=/usr/sbin/atopgpud
+ExecStart=@out@/bin/atopgpud
Type=oneshot
RemainAfterExit=yes
--- a/atopacct.service
+++ b/atopacct.service
@@ -10,3 +10,3 @@
PIDFile=/var/run/atopacctd.pid
-ExecStart=/usr/sbin/atopacctd
+ExecStart=@out@/bin/atopacctd
--- a/atop-pm.sh
+++ b/atop-pm.sh
@@ -2,8 +2,8 @@
case "$1" in
- pre) /usr/bin/systemctl stop atop
+ pre) @systemd@/bin/systemctl stop atop
exit 0
;;
- post) /usr/bin/systemctl start atop
+ post) @systemd@/bin/systemctl start atop
exit 0
;;