Skip to content

Commit

Permalink
pmcheck: changes to dodge conflict with pmtools package
Browse files Browse the repository at this point in the history
As per https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1071010
installing our pmcheck in /usr/bin causes a conflict with the
pmtools package.

Move pmcheck to $PCP_BINADM_DIR (defaults to /usr/lib/pcp/bin)
and provide a symlink alias of pcp-check which will be found
on most people's default $PATH.

Small man page and QA changes to address this.
  • Loading branch information
kmcdonell committed May 13, 2024
1 parent 4932ac6 commit bf6c6f5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 33 deletions.
11 changes: 9 additions & 2 deletions man/man1/pmcheck.1
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
.SH NAME
\f3pmcheck\f1 \- manage the configuration of optional PCP components
.SH SYNOPSIS
.B pmcheck
\f3$PCP_BINADM_DIR/pmcheck\f1
[\f3\-a\f1] [\f3\-d\f1] [\f3\-l\f1] [\f3\-n\f1] [\f3\-s\f1]
[\f3\-v\f1] [\f3\-x\f1] [component ...]
.br
.B pmcheck
\f3$PCP_BINADM_DIR/pmcheck\f1
[\f3\-a\f1] [\f3\-c\f1 script]] [\f3\-d\f1] [\f3\-l\f1] [\f3\-n\f1] [\f3\-s\f1]
[\f3\-v\f1] [\f3\-x\f1]
.br
\f3pcp-check\f1 ...
.SH DESCRIPTION
The Performance Co-Pilot (PCP) includes a number of core components
that are likely to be pre-configured and operational, but it also
Expand Down Expand Up @@ -132,6 +134,11 @@ option to
.PP
The \fB\-?\fR, \fB\-\-help\fR
option displays a usage message.
.PP
As a convience,
.B pcp-check
is an alias for
.B pmcheck .
.SH COMPONENT SCRIPTS
The
.B pmcheck
Expand Down
58 changes: 29 additions & 29 deletions qa/1491
Original file line number Diff line number Diff line change
Expand Up @@ -114,41 +114,41 @@ echo "basic stuff ..."
# requests, e.g. redis-server without systemd
#
echo '-- no args --'
$sudo pmcheck 2>&1 | _filter_states
$sudo $PCP_BINADM_DIR/pmcheck 2>&1 | _filter_states
echo '-- -l --'
pmcheck -l
$PCP_BINADM_DIR/pmcheck -l
echo '-- -lv --'
pmcheck -lv | _filter_states
$PCP_BINADM_DIR/pmcheck -lv | _filter_states
echo '-- -s --'
$sudo pmcheck -s 2>&1 | _filter_states
$sudo $PCP_BINADM_DIR/pmcheck -s 2>&1 | _filter_states

touch $tmp.pmcheck
echo
echo "=== usage ==="
echo '-- --help --'
pmcheck --help
$PCP_BINADM_DIR/pmcheck --help
echo '-- -l + -c --'
pmcheck -l -c /bin/echo
$PCP_BINADM_DIR/pmcheck -l -c /bin/echo
echo '-- -l + component arg --'
pmcheck -l pmcd
$PCP_BINADM_DIR/pmcheck -l pmcd
echo '-- -c does not exist --'
pmcheck -c /no.such.file -s
$PCP_BINADM_DIR/pmcheck -c /no.such.file -s
echo '-- -c not executable --'
pmcheck -c $tmp.pmcheck -s 2>&1 | _filter
$PCP_BINADM_DIR/pmcheck -c $tmp.pmcheck -s 2>&1 | _filter
echo '-- -c + component arg --'
pmcheck -c /bin/echo -s pmcd
$PCP_BINADM_DIR/pmcheck -c /bin/echo -s pmcd
echo '-- component arg + no action opt --'
pmcheck pmcd
$PCP_BINADM_DIR/pmcheck pmcd
echo '-- -n without -a or -d --'
pmcheck -n -s pmcd
$PCP_BINADM_DIR/pmcheck -n -s pmcd
echo '-- -c + no action opt --'
pmcheck -c /bin/echo
$PCP_BINADM_DIR/pmcheck -c /bin/echo
echo '-- multiple actions --'
pmcheck -a -d pmcd
pmcheck -l -s
$PCP_BINADM_DIR/pmcheck -a -d pmcd
$PCP_BINADM_DIR/pmcheck -l -s
echo '-- bad option --'
pmcheck -f -o -o
pmcheck -foo
$PCP_BINADM_DIR/pmcheck -f -o -o
$PCP_BINADM_DIR/pmcheck -foo

echo
echo "=== parsing and arg hand-off to component script ==="
Expand All @@ -159,10 +159,10 @@ exit 0
End-of-File
chmod 755 $tmp.pmcheck
echo '-- -c ... -s --'
pmcheck -c $tmp.pmcheck -s 2>&1 | _filter
$PCP_BINADM_DIR/pmcheck -c $tmp.pmcheck -s 2>&1 | _filter
# no action/state output for this one
echo '-- -c ... -nav --'
pmcheck -c $tmp.pmcheck -nav 2>&1 | _filter
$PCP_BINADM_DIR/pmcheck -c $tmp.pmcheck -nav 2>&1 | _filter
cat <<'End-of-File' >$tmp.pmcheck
#!/bin/sh
. $PCP_DIR/etc/pcp.env || exit 1
Expand Down Expand Up @@ -198,58 +198,58 @@ then
fi
End-of-File
echo "-- -c ... -lv --"
pmcheck -c $tmp.pmcheck -lv 2>&1 | _filter
$PCP_BINADM_DIR/pmcheck -c $tmp.pmcheck -lv 2>&1 | _filter
for rc in 0 1 2
do
echo "-- RC=$rc -c ... -s --"
RC=$rc pmcheck -c $tmp.pmcheck -s 2>&1 | _filter
RC=$rc $PCP_BINADM_DIR/pmcheck -c $tmp.pmcheck -s 2>&1 | _filter
done
for rc in 0 1
do
for opt in '-a' '-av' '-an' '-anv' '-d' '-dv' '-dn' '-dnv'
do
echo "-- RC=$rc -c ... $opt --"
RC=$rc pmcheck -c $tmp.pmcheck $opt 2>&1 | _filter
RC=$rc $PCP_BINADM_DIR/pmcheck -c $tmp.pmcheck $opt 2>&1 | _filter
done
done

echo
echo "=== glob expansion ==="
echo '-- -s pm[cl]* --'
pmcheck -s 'pm[cl]*'
$PCP_BINADM_DIR/pmcheck -s 'pm[cl]*'

echo
echo "=== actions ==="
echo '-- -d --'
$sudo pmcheck -d pmcd
$sudo $PCP_BINADM_DIR/pmcheck -d pmcd
_wait_for_pmcd_stop
if [ -f $PCP_RUN_DIR/pmcd.pid ]
then
echo "$seq: Botch: $PCP_RUN_DIR/pmcd.pid => `cat $PCP_RUN_DIR/pmcd.pid`"
else
echo "$seq: pmcd stopped"
fi
pmcheck -s pmcd
$PCP_BINADM_DIR/pmcheck -s pmcd
echo '-- and -d again with -v --'
$sudo pmcheck -v -d pmcd 2>&1 \
$sudo $PCP_BINADM_DIR/pmcheck -v -d pmcd 2>&1 \
| sed \
-e '/^ *already /d' \
-e 's/ stopped via .*/ STOPPED via .../' \
-e 's/ disabled via .*/ STOPPED via .../' \
# end

echo '-- -a --'
$sudo pmcheck -a pmcd
$sudo $PCP_BINADM_DIR/pmcheck -a pmcd
_wait_for_pmcd
if [ -f $PCP_RUN_DIR/pmcd.pid ]
then
echo "$seq: pmcd started"
else
echo "$seq: Botch: $PCP_RUN_DIR/pmcd.pid missing"
fi
pmcheck -s pmcd
$PCP_BINADM_DIR/pmcheck -s pmcd
echo '-- and -a again with -v --'
pmcheck -v -a pmcd 2>&1 \
$PCP_BINADM_DIR/pmcheck -v -a pmcd 2>&1 \
| sed \
-e '/^ *already /d' \
-e 's/ enabled via .*/ STARTED via .../' \
Expand Down
2 changes: 1 addition & 1 deletion qa/1505
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ for FAULT in 0 1 2
do
echo
echo "-- FAULT=$FAULT --"
pmcheck -c $tmp.pmcheck -sv 2>&1 | _filter
$PCP_BINADM_DIR/pmcheck -c $tmp.pmcheck -sv 2>&1 | _filter
done

# success, all done
Expand Down
3 changes: 2 additions & 1 deletion src/pmcheck/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ default:
include $(BUILDRULES)

install: default
$(INSTALL) -m 755 pmcheck.sh $(PCP_BIN_DIR)/pmcheck$(SHELLSUFFIX)
$(INSTALL) -m 755 pmcheck.sh $(PCP_BINADM_DIR)/pmcheck$(SHELLSUFFIX)
$(INSTALL) -S $(PCP_BINADM_DIR)/pmcheck$(SHELLSUFFIX) $(PCP_BINADM_DIR)/pcp-check$(SHELLSUFFIX)
$(INSTALL) -m 644 -t $(PCP_SHARE_DIR)/lib/checkproc.sh checkproc.sh $(PCP_LIBADM_DIR)/checkproc.sh
$(INSTALL) -m 755 -d $(PCP_SHARE_DIR)/lib/pmcheck

Expand Down

0 comments on commit bf6c6f5

Please sign in to comment.