Blob Blame History Raw
91dd4ae6b logutil: use $PCP_TMPFILE_DIR for intermediate pmlogger_merge archives
b0c90d858 packaging: activate pmlogger_rewrite on upgrades
b5e602187 packaging: revert pcp_archive_dir subsitution in build/rpm/GNUmakefile

--- a/src/pmlogger/pmlogger_merge.sh	2018-06-18 16:24:25.000000000 +1000
+++ b/src/pmlogger/pmlogger_merge.sh	2020-06-11 13:10:57.401576513 +1000
@@ -26,8 +26,9 @@
 
 prog=`basename $0`
 tmp=`mktemp -d /tmp/pcp.XXXXXXXXX` || exit 1
+tmpmerge=`mktemp -d $PCP_TMPFILE_DIR/pcp.XXXXXXXXX` || exit 1
 status=0
-trap "rm -rf $tmp; exit \$status" 0 1 2 3 15
+trap "rm -rf $tmp $tmpmerge; exit \$status" 0 1 2 3 15
 
 force=false
 VERBOSE=false
@@ -229,8 +230,8 @@
 	    # output = 108 file descriptors which should be well below any
 	    # shell-imposed or system-imposed limits
 	    #
-	    $VERBOSE && echo "		-> partial merge to $tmp/$part"
-	    cmd="pmlogextract $list $tmp/$part"
+	    $VERBOSE && echo "		-> partial merge to $tmpmerge/$part"
+	    cmd="pmlogextract $list $tmpmerge/$part"
 	    if $SHOWME
 	    then
 		echo "+ $cmd"
@@ -239,13 +240,13 @@
 		then
 		    :
 		else
-		    $VERBOSE || echo "		-> partial merge to $tmp/$part"
+		    $VERBOSE || echo "		-> partial merge to $tmpmerge/$part"
 		    echo "$prog: Directory: `pwd`"
-		    echo "$prog: Failed: pmlogextract $list $tmp/$part"
+		    echo "$prog: Failed: pmlogextract $list $tmpmerge/$part"
 		    _warning
 		fi
 	    fi
-	    list=$tmp/$part
+	    list=$tmpmerge/$part
 	    part=`expr $part + 1`
 	    i=0
 	fi
--- a/build/rpm/fedora.spec	2020-05-29 09:15:44.000000000 +1000
+++ b/build/rpm/fedora.spec	2020-06-11 13:10:57.402576528 +1000
@@ -2814,6 +2814,7 @@
 chown -R pcp:pcp %{_logsdir}/pmie 2>/dev/null
 chown -R pcp:pcp %{_logsdir}/pmproxy 2>/dev/null
 %{install_file "$PCP_PMNS_DIR" .NeedRebuild}
+%{install_file "$PCP_LOG_DIR/pmlogger" .NeedRewrite}
 %if !%{disable_systemd}
     %systemd_postun_with_restart pmcd.service
     %systemd_post pmcd.service
--- a/build/rpm/pcp.spec.in	2020-05-29 09:16:19.000000000 +1000
+++ b/build/rpm/pcp.spec.in	2020-06-11 13:10:57.402576528 +1000
@@ -3149,6 +3149,7 @@
 chown -R pcp:pcp "$PCP_LOG_DIR/pmie" 2>/dev/null
 chown -R pcp:pcp "$PCP_LOG_DIR/pmproxy" 2>/dev/null
 %{install_file "$PCP_PMNS_DIR" .NeedRebuild}
+%{install_file "$PCP_LOG_DIR/pmlogger" .NeedRewrite}
 %if "@enable_systemd@" == "true"
     %systemd_postun_with_restart pmcd.service
     %systemd_post pmcd.service
--- a/debian/pcp.postinst.tail	2019-06-13 09:59:16.000000000 +1000
+++ b/debian/pcp.postinst.tail	2020-06-11 13:10:57.402576528 +1000
@@ -6,6 +6,8 @@
 
 touch /var/lib/pcp/pmns/.NeedRebuild
 chmod 644 /var/lib/pcp/pmns/.NeedRebuild
+touch /var/log/pcp/pmlogger/.NeedRewrite
+chmod 644 /var/log/pcp/pmlogger/.NeedRewrite
 
 getent group pcp >/dev/null || groupadd -r pcp
 getent passwd pcp >/dev/null || \
--- a/debian/pcp.prerm	2017-08-17 10:54:50.000000000 +1000
+++ b/debian/pcp.prerm	2020-06-11 13:10:57.402576528 +1000
@@ -24,3 +24,4 @@
     fi
 fi
 rm -f /var/lib/pcp/pmns/.NeedRebuild
+rm -f /var/log/pcp/pmlogger/.NeedRewrite