Skip to content

Commit

Permalink
Merge branch 'main' of ../pcp
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcdonell committed Feb 21, 2024
2 parents 04377af + 29eb2d7 commit 8863741
Show file tree
Hide file tree
Showing 104 changed files with 1,505 additions and 346 deletions.
5 changes: 5 additions & 0 deletions Makepkgs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ then
# Slackware has rpm(1) and rpmbuild(1), but don't build RPMs
#
:
elif which mx-boot-repair >/dev/null 2>&1
then
# MX Linux has rpm(1) and rpmbuild(1), but don't build RPMs
#
:
else
[ -x /usr/bin/rpmbuild ] && dorpm=true
fi
Expand Down
38 changes: 32 additions & 6 deletions debian/pcp.postinst.tail
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,28 @@ chmod 755 /etc/pcp/pmlogger
chown root:root /etc/pcp/pmlogger/control
chmod 644 /etc/pcp/pmlogger/control

do_systemd_helper=true
which deb-systemd-helper >/dev/null 2>&1 || do_systemd_helper=false
do_systemctl=true
which systemctl >/dev/null 2>&1 || do_systemctl=false
# figure out what sort if init|systemctl|... we're using to
# launch daemons and services
do_systemctl=false
do_systemd_helper=false
do_update_rc=false
do_invoke_rc=false
if which systemctl >/dev/null 2>&1
then
# we have a systemctl executable, but it might be disabled,
# e.g. on MX Linux
systemctl -q is-active local-fs.target >/dev/null 2>&1 && do_systemctl=true
fi
if $do_systemctl
then
which deb-systemd-helper >/dev/null 2>&1 && do_systemd_helper=true
else
# not using systemctl(1), maybe need to install System-V style
# init script links with update-rc.d(1) and start/stop with
# invoke-rc.d(1)
which update-rc.d >/dev/null 2>&1 && do_update_rc=true
which invoke-rc.d >/dev/null 2>&1 && do_invoke_rc=true
fi
# only need to check pmcd.service, if it is here they will all
# be here
if [ -f /lib/systemd/system/pmcd.service ]
Expand All @@ -104,6 +122,14 @@ else
do_systemd_helper=false
do_systemctl=false
fi
# ditto for the System-V variant for pmlogger
if [ -f /etc/init.d/pmlogger ]
then
:
else
do_update_rc=false
do_invoke_rc=false
fi

if $do_systemd_helper
then
Expand All @@ -112,7 +138,7 @@ then
deb-systemd-helper enable pmlogger.service >/dev/null
deb-systemd-helper enable pmie.service >/dev/null
deb-systemd-helper enable pmproxy.service >/dev/null
elif which update-rc.d >/dev/null 2>&1
elif $do_update_rc
then
update-rc.d -f pmcd remove >/dev/null
update-rc.d pmcd defaults >/dev/null
Expand All @@ -130,7 +156,7 @@ then
systemctl start pcp-reboot-init.service >/dev/null
systemctl start pmcd.service >/dev/null
systemctl start pmlogger.service >/dev/null
elif which invoke-rc.d >/dev/null 2>&1
elif $do_invoke_rc
then
invoke-rc.d pmcd start
invoke-rc.d pmlogger start
Expand Down
47 changes: 42 additions & 5 deletions debian/pcp.postrm.tail
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,55 @@ then
_version_configs "$@"
fi

do_systemd=true
which deb-systemd-helper >/dev/null 2>&1 || do_systemd=false
# figure out what sort if init|systemctl|... we're using to
# launch daemons and services
do_systemctl=false
do_systemd_helper=false
do_update_rc=false
do_invoke_rc=false
if which systemctl >/dev/null 2>&1
then
# we have a systemctl executable, but it might be disabled,
# e.g. on MX Linux
systemctl -q is-active local-fs.target >/dev/null 2>&1 && do_systemctl=true
fi
if $do_systemctl
then
which deb-systemd-helper >/dev/null 2>&1 && do_systemd_helper=true
else
# not using systemctl(1), maybe need to install System-V style
# init script links with update-rc.d(1) and start/stop with
# invoke-rc.d(1)
which update-rc.d >/dev/null 2>&1 && do_update_rc=true
which invoke-rc.d >/dev/null 2>&1 && do_invoke_rc=true
fi
# only need to check pmcd.service, if it is here they will all
# be here
if [ -f /lib/systemd/system/pmcd.service ]
then
:
else
do_systemd_helper=false
do_systemctl=false
fi
# ditto for the System-V variant for pmlogger
if [ -f /etc/init.d/pmlogger ]
then
:
else
do_update_rc=false
do_invoke_rc=false
fi

if [ "$1" = remove ]
then
if $do_systemd
if $do_systemd_helper
then
deb-systemd-helper remove pmproxy.service >/dev/null
deb-systemd-helper remove pmie.service >/dev/null
deb-systemd-helper remove pmlogger.service >/dev/null
deb-systemd-helper remove pmcd.service >/dev/null
elif which update-rc.d >/dev/null 2>&1
elif $do_update_rc
then
update-rc.d pmproxy remove >/dev/null
update-rc.d pmie remove >/dev/null
Expand All @@ -26,7 +63,7 @@ fi

if [ "$1" = purge ]
then
if $do_systemd
if $do_systemd_helper
then
deb-systemd-helper purge pmproxy.service >/dev/null
deb-systemd-helper purge pmie.service >/dev/null
Expand Down
44 changes: 43 additions & 1 deletion debian/pcp.prerm
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
#!/bin/sh -e
#DEBHELPER#

# figure out what sort if init|systemctl|... we're using to
# launch daemons and services
do_systemctl=false
do_systemd_helper=false
do_update_rc=false
do_invoke_rc=false
if which systemctl >/dev/null 2>&1
then
# we have a systemctl executable, but it might be disabled,
# e.g. on MX Linux
systemctl -q is-active local-fs.target >/dev/null 2>&1 && do_systemctl=true
fi
if $do_systemctl
then
which deb-systemd-helper >/dev/null 2>&1 && do_systemd_helper=true
else
# not using systemctl(1), maybe need to install System-V style
# init script links with update-rc.d(1) and start/stop with
# invoke-rc.d(1)
which update-rc.d >/dev/null 2>&1 && do_update_rc=true
which invoke-rc.d >/dev/null 2>&1 && do_invoke_rc=true
fi
# only need to check pmcd.service, if it is here they will all
# be here
if [ -f /lib/systemd/system/pmcd.service ]
then
:
else
do_systemctl=false
do_systemd_helper=false
fi
# ditto for the System-V variant for pmlogger
if [ -f /etc/init.d/pmlogger ]
then
:
else
do_update_rc=false
do_invoke_rc=false
fi

if $do_systemctl
then
systemctl stop pmlogger.service >/dev/null
systemctl stop pmcd.service >/dev/null
elif which invoke-rc.d >/dev/null 2>&1
elif $do_invoke_rc
then
invoke-rc.d pmproxy stop
invoke-rc.d pmie stop
Expand All @@ -28,5 +69,6 @@ else
/etc/init.d/pcp stop
fi
fi

rm -f /var/lib/pcp/pmns/.NeedRebuild
rm -f /var/log/pcp/pmlogger/.NeedRewrite
55 changes: 25 additions & 30 deletions qa/025
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,32 @@ _stop_auto_restart pmcd
_stop_auto_restart pmlogger

use_systemd=''
if [ -f $PCP_INC_DIR/builddefs ]
if [ "$PCPQA_SYSTEMD" = yes ]
then
ENABLE_SYSTEMD=false
eval `sed -n <$PCP_INC_DIR/builddefs -e '/ENABLE_SYSTEMD/s/ //gp'`
if $ENABLE_SYSTEMD
then
use_systemd='-s'
# these other services really get in the way and prevent a
# clean pmlogger restart from src/pmcdgone
#
for svc in \
pmlogger_check.timer pmlogger_check.service \
pmlogger_daily.timer pmlogger_daily.service
do
case "$svc" in
*.timer)
;;
*)
$sudo systemctl disable $svc >>$seq.full 2>&1
;;
esac
$sudo systemctl stop $svc >>$seq.full 2>&1
echo "+ after stop $svc ..." >>$seq.full
_get_pids_by_name pmlogger >>$seq.full 2>&1
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep '[p]mlogger' >>$seq.full
done
# and now get a clean pmlogger without the other hangers-on
#
$sudo systemctl restart pmlogger
_wait_for_pmlogger
fi
use_systemd='-s'
# these other services really get in the way and prevent a
# clean pmlogger restart from src/pmcdgone
#
for svc in \
pmlogger_check.timer pmlogger_check.service \
pmlogger_daily.timer pmlogger_daily.service
do
case "$svc" in
*.timer)
;;
*)
$sudo systemctl disable $svc >>$seq.full 2>&1
;;
esac
$sudo systemctl stop $svc >>$seq.full 2>&1
echo "+ after stop $svc ..." >>$seq.full
_get_pids_by_name pmlogger >>$seq.full 2>&1
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep '[p]mlogger' >>$seq.full
done
# and now get a clean pmlogger without the other hangers-on
#
$sudo systemctl restart pmlogger
_wait_for_pmlogger
fi
echo "Using system? \"$use_systemd\" (-s => yes)" >>$seq.full

Expand Down
7 changes: 1 addition & 6 deletions qa/033
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ then
else
# assume linux-like
#
if pmprobe filesys.readonly >/dev/null
then
ln $seq.out.3 $seq.out
else
ln $seq.out.1 $seq.out
fi
ln $seq.out.3 $seq.out
fi

status=1 # failure is the default
Expand Down
21 changes: 0 additions & 21 deletions qa/033.out.1

This file was deleted.

2 changes: 2 additions & 0 deletions qa/033.out.3
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ filesys.avail
inst [DISK] value NUMBER
filesys.readonly
inst [DISK] value NUMBER
filesys.uuid
inst [DISK] value STRING
2 changes: 1 addition & 1 deletion qa/1060.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ pmie/myhost/2017:
mode=drwxrwxr-x user=pcp group=pcp name=02

pmie/myhost/2017/02:
mode=-rw-rw-r-- user=pcp group=pcp name=12
mode=-rw-r--r-- user=pcp group=pcp name=12

1 change: 1 addition & 0 deletions qa/1083
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ echo "QA output created by $seq"
. ./common.filter
. ./common.check

[ "$PCPQA_SYSTEMD" = no ] && _notrun "we're not using systemd here"
[ -n "$PCP_SYSTEMDUNIT_DIR" ] || _notrun "PCP_SYSTEMDUNIT_DIR not set, so no systemd here"
[ -f $PCP_SYSTEMDUNIT_DIR/pmcd.service ] || _notrun "$PCP_SYSTEMDUNIT_DIR/pmcd.service not found"

Expand Down
7 changes: 1 addition & 6 deletions qa/1147
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ echo "QA output created by $seq"
. ./common.filter
. ./common.check

if which systemctl >/dev/null
then
:
else
_notrun no systemctl executable
fi
[ "$PCPQA_SYSTEMD" = yes ] || _notrun "systemctl not installed or not active"

_cleanup()
{
Expand Down
4 changes: 2 additions & 2 deletions qa/115
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ _filter()
-e 's/^[ ]*//' \
-e "s@$PCP_RC_DIR@PCP_RC_DIR@g" \
-e '/PCP_RC_DIR\/pmie:/d' \
-e '/PCP_RC_DIR\/rc:/d' \
-e '/PCP_ETC_DIR\/pcp\/pmie\/rc:/d' \
-e '/^Error: PCP inference engine control file/d' \
-e '/^is missing! /d' \
-e '/^failed /d' \
Expand Down Expand Up @@ -241,7 +241,7 @@ echo === check for missing control file === | tee -a $here/$seq.full
_change_config pmie off
$sudo rm -f $PCP_PMIECONTROL_PATH
_change_config pmie on
_service pmie restart 2>&1 | _filter_pmie_start | _filter
_service pmie restart 2>&1 | tee -a $here/$seq.full | _filter_pmie_start | _filter
_count_pmies
echo "pmie count after attempt without control file: $?"
echo
Expand Down
2 changes: 2 additions & 0 deletions qa/1173
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ echo "QA output created by $seq"
_pmdabcc_check
_pmdabcc_require_kernel_version 4 18
_python_probe_check
$sudo [ -f /sys/kernel/tracing/uprobe_events ] || _notrun "/sys/kernel/tracing/uprobe_events not present"


status=1 # failure is the default!
signal=$PCP_BINADM_DIR/pmsignal
Expand Down
2 changes: 1 addition & 1 deletion qa/1204.out
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ localhost n n PCP_ARCHIVE_DIR/localhost -c ./localhost.config
--- end control file ---
Installing control file: PCP_ETC_DIR/pcp/pmlogger/control.d/localhost
+ cp PCP_TMPFILE_DIR/pmlogctl.XXXXX/control PCP_ETC_DIR/pcp/pmlogger/control.d/localhost
+ sudo -u pcp -g pcp PCP_BINADM_DIR/pmlogger_check -c PCP_ETC_DIR/pcp/pmlogger/control.d/localhost
+ PCP_BINADM_DIR/runaspcp PCP_BINADM_DIR/pmlogger_check -c "PCP_ETC_DIR/pcp/pmlogger/control.d/localhost"

== create
== status
Expand Down
2 changes: 1 addition & 1 deletion qa/1205.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ localhost n n PCP_ARCHIVE_DIR/1205-localhost -c TMP.config
--- end control file ---
Installing control file: PCP_ETC_DIR/pcp/pmlogger/control.d/1205-localhost
+ cp PCP_TMPFILE_DIR/pmlogctl.XXXXX/control PCP_ETC_DIR/pcp/pmlogger/control.d/1205-localhost
+ sudo -u pcp -g pcp PCP_BINADM_DIR/pmlogger_check -c PCP_ETC_DIR/pcp/pmlogger/control.d/1205-localhost
+ PCP_BINADM_DIR/runaspcp PCP_BINADM_DIR/pmlogger_check -c "PCP_ETC_DIR/pcp/pmlogger/control.d/1205-localhost"

== -p -c create
== status
Expand Down
Loading

0 comments on commit 8863741

Please sign in to comment.