Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
d068763
pmcd/pmie/pmlogger/pmprocxy: initial service hardening patch
kmcdonell Dec 18, 2023
c1244a6
pmie, pmlogger and pmproxy: refactor rc scripts
kmcdonell Dec 20, 2023
7be6be3
Merge branch 'main' into security
kmcdonell Dec 20, 2023
b30a530
qa/src/permslist: updated after rc and dir ownership changes
kmcdonell Dec 20, 2023
808bbfe
qa/common.check: be more careful in _restore_pmlogger_control
kmcdonell Dec 20, 2023
fe48014
qa/1379 and qa/1543: be more careful about save/restore files
kmcdonell Dec 20, 2023
5c5a1d1
qa/282.out: QA changes to track root:root -> pcp:pcp for rc scripts
kmcdonell Dec 20, 2023
b79b9ae
qa/common.check: fix path botch in _restore_pmlogger_control()
kmcdonell Dec 21, 2023
982f421
rc scripts: when running as pcp:pcp on older systems ... small tweak
kmcdonell Dec 21, 2023
2ab2281
add __pmCleanMapDir() to libpcp
kmcdonell Dec 21, 2023
30fb0aa
Merge branch 'main' into security
kmcdonell Dec 21, 2023
8217a49
qa/1848: valgrind dual of qa/1849
kmcdonell Dec 21, 2023
e613d7d
Merge branch 'main' into security
kmcdonell Dec 22, 2023
a95eb3d
pmie, pmlogger: call __pmCleanMapDir() during startup
kmcdonell Dec 22, 2023
7d9d036
src/pmcd/GNUmakefile: change ownership of $PCP_LOG_DIR/pmcd directory
kmcdonell Dec 26, 2023
d29aef2
src/pmproxy/GNUmakefile: fix typo for group ownership of $PCP_LOG_DIR…
kmcdonell Dec 26, 2023
6c61e8c
pmOpenLog: refactor .prev handling
kmcdonell Dec 26, 2023
2cb39dd
debian/pcp.postinst.tail: make actions match the GNUmakefiles
kmcdonell Dec 26, 2023
dd5495c
qa/src/permslist: updated to make GNUmakefiles
kmcdonell Dec 26, 2023
16a8df3
libpcp: rework __pmCleanMapDir()
kmcdonell Dec 28, 2023
b38256d
qa/255: rework after /var/log/pcp/pmcd hardening
kmcdonell Dec 28, 2023
676ad90
qa/1848 & 1849: changes after __pmCleanMapDir() symlink rules change
kmcdonell Dec 28, 2023
c693d9c
PCP_RUN_DIR: use tmpfiles.d method to create PCP_RUN_DIR
kmcdonell Dec 30, 2023
d27c371
qa: assorted log -> log.prev fallout
kmcdonell Dec 30, 2023
552ea92
src/selinux/pcp.te: changes from CentOS Stream8 (vm04)
kmcdonell Dec 30, 2023
2467e50
src/pmlogger/pmlogger_check.sh: drop log -> log.prior rename
kmcdonell Dec 30, 2023
6b25b06
build/tar/postinstall.tail: setup /var/run/pcp and /var/log/pcp/pmcd …
kmcdonell Dec 30, 2023
d541572
non-root rc script changes for OpenBSD
kmcdonell Dec 30, 2023
1b10f43
runaspcp: (new) for rc scripts
kmcdonell Dec 30, 2023
796336b
qa/188: tweak for FreeBSD
kmcdonell Dec 30, 2023
41cc018
tmpfiles.conf -> tmpfiles.run.setup.in
kmcdonell Dec 30, 2023
e503fef
GNUmakefile: small fix for $PCP_RUN_DIR setup
kmcdonell Dec 31, 2023
13d6d81
rc_wrapper scripts: setpriv is not the same everywhere
kmcdonell Dec 31, 2023
084c398
man/man1/runaspcp.1: man page for runaspcp(1)
kmcdonell Jan 1, 2024
b97abbd
pmlogger/pmlogger_daily.sh: cull PCP_RUN_DIR re-creation from this sc…
kmcdonell Jan 1, 2024
06dc66f
src/runaspcp/runaspcp.c: add --help|-? option
kmcdonell Jan 2, 2024
147ebc3
man/man1/runaspcp.1: small tweaks
kmcdonell Jan 2, 2024
8fa7c1f
qa/1429: fix new year breakage
kmcdonell Jan 3, 2024
0db06a1
scripts/pcp-push: leave us back in the branch we started from
kmcdonell Jan 3, 2024
3cd540d
scripts/pcp-push: try that last change again
kmcdonell Jan 3, 2024
b445545
src/pmie/GNUmakefile: missed PCP_USER and PCP_GROUP editing for pmie_…
kmcdonell Jan 3, 2024
6a69958
src/runaspcp/runaspcp.c: clear aux groups by calling setgroups() first
kmcdonell Jan 3, 2024
775353b
qa/common.check: from _service() pass -v to "rc" scripts
kmcdonell Jan 3, 2024
6936cd4
rc script wrappers: don't let glibc muck with order of command line o…
kmcdonell Jan 3, 2024
c3b42db
rc scripts: cleanup
kmcdonell Jan 3, 2024
65a05b6
qa/115: handle change rc script name for non-systemd platforms
kmcdonell Jan 3, 2024
de40a6a
qa/282.out: remade after changes to rc script error messages
kmcdonell Jan 3, 2024
f5ef3d9
qa/295: ensure $PCP_RUN_DIR is correct before (optionallly) restartin…
kmcdonell Jan 3, 2024
f959efb
rc scripts: need to ensure $PCP_RUN_DIR exists
kmcdonell Jan 4, 2024
8e5ca65
qa/1849: take control of gid for tmp dir
kmcdonell Jan 4, 2024
e2d9c24
qa/340, qa/603: _notrun on vm28
kmcdonell Jan 6, 2024
4ace3a5
qa/1848.out: remade after change in qa/1849
kmcdonell Jan 6, 2024
f250ddf
Merge branch 'main' into security
kmcdonell Jan 7, 2024
792e530
Merge branch 'main' into security
kmcdonell Jan 8, 2024
d1772bf
Merge branch 'main' into security
kmcdonell Jan 10, 2024
931323c
Merge branch 'main' into security
kmcdonell Jan 10, 2024
ff1b4b4
qa/admin/pcp-daily: demand at least one hostname on command line
kmcdonell Jan 11, 2024
b7be006
qa/tmparch/.gitignore: ignore log and log.prev here
kmcdonell Jan 11, 2024
d897ae3
Merge branch 'main' into security
kmcdonell Jan 11, 2024
041362e
Merge branch 'main' into security
kmcdonell Jan 12, 2024
c8a99a9
Merge branch 'main' into security
kmcdonell Jan 12, 2024
83b63f0
Merge branch 'main' into security
kmcdonell Jan 12, 2024
bfae93e
Merge branch 'main' into security
kmcdonell Jan 14, 2024
48b6490
Merge branch 'main' into security
kmcdonell Jan 14, 2024
bcf6261
Merge branch 'main' into security
kmcdonell Jan 14, 2024
db2b356
Merge branch 'main' into security
kmcdonell Jan 14, 2024
a26666d
Merge branch 'main' into security
kmcdonell Jan 15, 2024
cbeadee
Merge branch 'main' into security
kmcdonell Jan 15, 2024
19fff79
pcp-reboot-init: new systemd service for $PCP_RC_DIR setup
kmcdonell Jan 16, 2024
463582e
src/pcp-reboot-init: helps if you add the new files
kmcdonell Jan 16, 2024
89c2d4a
src/GNUmakefile: and descend into pcp-reboot-init ... sigh
kmcdonell Jan 16, 2024
70a409a
qa/1478.out: remade
kmcdonell Jan 17, 2024
ee9f69a
src/pcp-reboot-init/pcp-reboot-init.sh: rework id(1) use
kmcdonell Jan 18, 2024
624cfdf
qa/1478: tweak filtering
kmcdonell Jan 18, 2024
77e5b89
Merge branch 'main' into security
kmcdonell Jan 18, 2024
90adb94
qa/src/hashwalk.c: small changes
kmcdonell Jan 19, 2024
39de3cc
Merge branch 'main' into security
kmcdonell Jan 19, 2024
fd1b416
Merge branch 'main' into security
kmcdonell Jan 19, 2024
6765ef3
src/pcp-reboot-init/pcp-reboot-init.sh: stat(1) is not the same every…
kmcdonell Jan 20, 2024
c4b8ae4
Merge branch 'main' into security
kmcdonell Jan 20, 2024
223e5bb
Merge branch 'main' into security
kmcdonell Jan 20, 2024
a3e7b02
Merge branch 'main' into security
kmcdonell Jan 21, 2024
de6b0fe
Merge branch 'main' into security
kmcdonell Jan 21, 2024
408cdbb
Merge branch 'main' into security
kmcdonell Jan 21, 2024
31e6837
Merge branch 'main' into security
kmcdonell Jan 22, 2024
9237c1c
Merge branch 'main' into security
kmcdonell Jan 22, 2024
633f9e4
Merge branch 'main' into security
kmcdonell Jan 23, 2024
dfbcfcb
Merge branch 'main' into security
kmcdonell Jan 23, 2024
792afdd
Merge branch 'main' into security
kmcdonell Jan 24, 2024
41e920e
Merge branch 'main' into security
kmcdonell Jan 24, 2024
876b5b1
Merge branch 'main' into security
kmcdonell Jan 24, 2024
255b86b
Merge branch 'main' into security
kmcdonell Jan 25, 2024
b1724ae
qa/597 & qa/triaged: re-engineer guard
kmcdonell Jan 25, 2024
f5d30c9
qa/1407: more babble from MESA+ZLINK to be culled away
kmcdonell Jan 25, 2024
021b362
Merge branch 'main' into security
kmcdonell Jan 25, 2024
ee89d4d
Merge branch 'main' into security
kmcdonell Jan 26, 2024
7999a69
Merge branch 'main' into security
kmcdonell Jan 26, 2024
f1baba0
Merge branch 'main' into security
kmcdonell Jan 26, 2024
f0727e4
Merge branch 'main' into security
kmcdonell Jan 26, 2024
0f46814
Merge branch 'main' into security
kmcdonell Jan 26, 2024
e870465
Merge branch 'main' into security
kmcdonell Jan 26, 2024
353d83a
qa/1849: be POSIXLY_CORRECT ... options before args
kmcdonell Jan 26, 2024
f5e39e7
Merge branch 'main' into security
kmcdonell Jan 26, 2024
00af5b0
Merge branch 'main' into security
kmcdonell Jan 27, 2024
3d8fef2
Merge branch 'main' into security
kmcdonell Jan 27, 2024
3d3f2e1
Merge branch 'main' into security
kmcdonell Jan 27, 2024
b384c01
Merge branch 'main' into security
kmcdonell Jan 27, 2024
5029ed6
src/pmie/src/pmie.c: tweak for mode for $PCP_TMP_DIR/pmie
kmcdonell Jan 27, 2024
f4ff16d
qa/group: unreserve some tests we don't need for the security branch
kmcdonell Jan 27, 2024
582fd78
debian/pcp.preinst.head.in: remove some old cruft
kmcdonell Jan 27, 2024
2597ddf
build/tar/postinstall.tail: don't run makewhatis with -n
kmcdonell Jan 28, 2024
0b630fe
src/pmdas/linux: remove add-mptcp
kmcdonell Jan 28, 2024
81d2b3a
linux PMDA: add new snmp metric network.ip.outtransmits
kmcdonell Jan 28, 2024
25f284b
Merge branch 'main' into security
kmcdonell Jan 28, 2024
2d42361
qa/1479: (new) check network metrics from /proc/net/snmp
kmcdonell Jan 28, 2024
43a0c8c
qa: fix a couple of fallouts from the last linux PMDA snmp metrics ch…
kmcdonell Jan 28, 2024
03af2f5
build & qa: tidy up the tarball postinstall and preinstall scripts
kmcdonell Jan 28, 2024
8104062
Merge branch 'main' into security
kmcdonell Jan 28, 2024
283b560
src/pmie/rc_pmie: nuke _reboot_setup()
kmcdonell Jan 29, 2024
f28451a
tmpfiles.d for /run/pcp: small tweaks
kmcdonell Jan 29, 2024
197f858
GNUmakefile: rename the tmpfiles.d conf to pcp-reboot-init.conf
kmcdonell Jan 30, 2024
7531b64
man: fix spelling and typo errors
kmcdonell Jan 30, 2024
f29a6af
src/libpcp/src/util.c: stylistic change in inodetype()
kmcdonell Jan 30, 2024
3560059
src/pcp-reboot-init/pcp-reboot-init.sh: use mktemp(1)
kmcdonell Jan 30, 2024
3776be2
src/pmdas/linux/proc_net_snmp.c: fix typo in diagnostic
kmcdonell Jan 30, 2024
57a86db
Merge branch 'main' into security
kmcdonell Jan 30, 2024
a026cbb
src/pcp-reboot-init/pcp-reboot-init.sh: botched tmp= change
kmcdonell Jan 30, 2024
0b87398
qa/1479: linux.log has nothing to do with this test!
kmcdonell Jan 30, 2024
66658b7
pmfind/pmfind_check.sh: remove mkdir & chown for logfile dir
kmcdonell Jan 30, 2024
b83e1f8
Merge branch 'main' into security
kmcdonell Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ CmakeLists.txt
provisioning/osxsierra.legally.ok
*.gdb_history
*vgcore.*
tmpfiles.run.setup
20 changes: 10 additions & 10 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ LDIRT = config.cache config.status config.log files.rpm \
autom4te.cache install.manifest install.tmpfiles \
debug*.list devel_files libs_files conf_files \
base_files.rpm libs_files.rpm devel_files.rpm \
perl-pcp*.list* python-pcp*.list* python3-pcp*.list*
perl-pcp*.list* python-pcp*.list* python3-pcp*.list* \
tmpfiles.run.setup
LDIRDIRT = pcp-[0-9]*.[0-9]*.[0-9]* pcp-*-[0-9]*.[0-9]*.[0-9]*

SUBDIRS = vendor src
Expand All @@ -45,7 +46,7 @@ default :: default_pcp

pcp : default_pcp

default_pcp : $(CONFIGURE_GENERATED)
default_pcp : $(CONFIGURE_GENERATED) tmpfiles.run.setup
+for d in `echo $(SUBDIRS)`; do \
if test -d "$$d" ; then \
echo === $$d ===; \
Expand Down Expand Up @@ -77,15 +78,11 @@ ifneq "$(findstring $(TARGET_OS),darwin mingw)" ""
$(INSTALL) -m 755 -d $(PCP_MAN_DIR)/man5
endif
$(INSTALL) -m 775 -o $(PCP_USER) -g $(PCP_GROUP) -d $(PCP_TMP_DIR)
ifeq (, $(filter debian suse, $(PACKAGE_DISTRIBUTION)))
# PCP_RUN_DIR usually -> /var/run which may be a temporary filesystem
# and lint checks may complain about packages including /var/run/xxx
# artifacts ... PCP_RUN_DIR is also conditionally created on the
# fly in each before use case, so the inclusion in the package is
# sometimes desirable, but not mandatory
#
# this works if PCP_RUN_DIR is persistent
$(INSTALL) -m 775 -o $(PCP_USER) -g $(PCP_GROUP) -d $(PCP_RUN_DIR)
endif
# this works if PCP_RUN_DIR is within a tmpfs that is mounted
# empty on re-boot and managed by systemd-tmpfiles(8)
$(INSTALL) -m 644 tmpfiles.run.setup /usr/lib/tmpfiles.d/pcp-reboot-init.conf
$(INSTALL) -m 755 -d $(PCP_SYSCONFIG_DIR)
$(INSTALL) -m 755 -d $(PCP_SYSCONF_DIR)
$(INSTALL) -m 755 -d $(PCP_SYSCONF_DIR)/labels
Expand Down Expand Up @@ -134,3 +131,6 @@ aclocal.m4:
pcp.lsm src/include/builddefs src/include/pcp/platform_defs.h: configure pcp.lsm.in src/include/builddefs.in src/include/pcp/platform_defs.h.in
@echo Please run ./configure with the appropriate options to generate $@.
@false

tmpfiles.run.setup: tmpfiles.run.setup.in
sed -e "s@PCP_RUN_DIR@$(PCP_RUN_DIR)@" -e "s/PCP_USER/$(PCP_USER)/" -e "s/PCP_GROUP/$(PCP_GROUP)/" <tmpfiles.run.setup.in >tmpfiles.run.setup
23 changes: 17 additions & 6 deletions build/cleanconfigs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,26 @@
_clean_configs()
{
#
# Usage: _clean_configs [-v] new_dir old_dir ...
# Usage: _clean_configs [-n|-v] new_dir old_dir ...
#
# Across all the files in the new_dir and old_dir args, match
# names and pick the most recently modified version and leave
# this (same mode and modification date) in new_dir
#
# -v option is verbose mode for debugging
# -n option is show-me for benign debugging
# -v option is verbose mode for active debugging
#

if [ $# -gt 0 -a X"$1" = "X-n" ]
then
MKDIR="echo + mkdir "
CP="echo + cp "
shift
else
MKDIR=mkdir
CP=cp
fi

_verbose=false
if [ $# -gt 0 -a X"$1" = "X-v" ]
then
Expand All @@ -21,15 +32,15 @@ _clean_configs()

if [ $# -lt 2 ]
then
echo >&2 "Usage: _clean_configs [-v] new_dir old_dir ..."
echo >&2 "Usage: _clean_configs [-n|-v] new_dir old_dir ..."
return
fi

_new="$1"
if [ ! -d "$_new" ]
then
$verbose && echo >&2 + mkdir -p "$_new"
mkdir -p "$_new"
$MKDIR -p "$_new"
fi

shift
Expand Down Expand Up @@ -59,10 +70,10 @@ _clean_configs()
if [ ! -d "$_dest" ]
then
$verbose && >&2 echo + mkdir "$_dest"
mkdir "$_dest"
$MKDIR "$_dest"
fi
$_verbose && echo >&2 + cp -p "$_dir/$_file" "$_new/$_file"
cp -p "$_dir/$_file" "$_new/$_file"
$CP -p "$_dir/$_file" "$_new/$_file"
fi
done
fi
Expand Down
12 changes: 6 additions & 6 deletions build/rpm/redhat.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2773,8 +2773,8 @@ semodule -r pcpqa >/dev/null 2>&1 || true
chown -R pcpqa:pcpqa %{_testsdir} 2>/dev/null
%if 0%{?rhel}
%if !%{disable_systemd}
systemctl restart pmcd pmlogger >/dev/null 2>&1
systemctl enable pmcd pmlogger >/dev/null 2>&1
systemctl restart pcp-reboot-init pmcd pmlogger >/dev/null 2>&1
systemctl enable pcp-reboot-init pmcd pmlogger >/dev/null 2>&1
%else
/sbin/chkconfig --add pmcd >/dev/null 2>&1
/sbin/chkconfig --add pmlogger >/dev/null 2>&1
Expand Down Expand Up @@ -3059,9 +3059,9 @@ if [ "$1" -eq 0 ]
then
# stop daemons before erasing the package
%if !%{disable_systemd}
%systemd_preun pmlogger_check.timer pmlogger_daily.timer pmlogger_farm_check.timer pmlogger_farm_check.service pmlogger_farm.service pmlogger.service pmie_check.timer pmie_daily.timer pmie_farm_check.timer pmie_farm_check.service pmie_farm.service pmie.service pmproxy.service pmfind.service pmcd.service
%systemd_preun pmlogger_check.timer pmlogger_daily.timer pmlogger_farm_check.timer pmlogger_farm_check.service pmlogger_farm.service pmlogger.service pmie_check.timer pmie_daily.timer pmie_farm_check.timer pmie_farm_check.service pmie_farm.service pmie.service pmproxy.service pmfind.service pmcd.service pcp-reboot-init.service

systemctl stop pmlogger.service pmie.service pmproxy.service pmfind.service pmcd.service >/dev/null 2>&1
systemctl stop pmlogger.service pmie.service pmproxy.service pmfind.service pmcd.service pcp-reboot-init.service >/dev/null 2>&1
%else
/sbin/service pmlogger stop >/dev/null 2>&1
/sbin/service pmie stop >/dev/null 2>&1
Expand Down Expand Up @@ -3095,8 +3095,8 @@ done
%{run_pmieconf "$PCP_PMIECONFIG_DIR" dmthin}
%if 0%{?rhel}
%if !%{disable_systemd}
systemctl restart pmcd pmlogger pmie >/dev/null 2>&1
systemctl enable pmcd pmlogger pmie >/dev/null 2>&1
systemctl restart pcp-reboot-init pmcd pmlogger pmie >/dev/null 2>&1
systemctl enable pcp-reboot-init pmcd pmlogger pmie >/dev/null 2>&1
%else
/sbin/chkconfig --add pmcd >/dev/null 2>&1
/sbin/chkconfig --add pmlogger >/dev/null 2>&1
Expand Down
11 changes: 7 additions & 4 deletions build/tar/postinstall.tail
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ then
CHOWN="echo + chown"
SYSTEMCTL="echo + systemctl"
RC_UPDATE="echo + rc-update"
MAKEWHATIS="echo + makewhatis"
else
show_me=false
RM=rm
Expand All @@ -52,6 +53,7 @@ else
CHOWN=chown
SYSTEMCTL=systemctl
RC_UPDATE=rc-update
MAKEWHATIS=makewhatis
fi

_cd()
Expand Down Expand Up @@ -310,8 +312,6 @@ done

# directories that may be empty and hence not in the tarball
#
# from src/pmcd/GNUmakefile
_do_dir "root:$grp" 700 "$PCP_TMP_DIR"/pmcd
# from GNUmakefile
_do_dir "root:$grp" 755 "$PCP_SYSCONF_DIR"/labels
_do_dir "root:$grp" 755 "$PCP_SYSCONF_DIR"/labels/optional
Expand All @@ -320,6 +320,9 @@ then
# from src/pmdas/openmetrics
_do_dir "root:$grp" 755 "$PCP_PMDAS_DIR"/openmetrics/config.d
fi
# from src/pmcd/GNUmakefile
_do_dir "root:$grp" 700 "$PCP_VAR_DIR"/pmcd
_do_dir "root:$grp" 755 "$PCP_LOG_DIR"/pmcd
# from src/pmfind/GNUmakefile
_do_dir "pcp:pcp" 775 "$PCP_LOG_DIR"/pmfind
_do_dir "root:$grp" 755 "$PCP_SYSCONF_DIR"/pmfind
Expand Down Expand Up @@ -348,7 +351,7 @@ done
# pcp:pcp and mode 775 directories
#
for dir in "$PCP_LOG_DIR" \
"$PCP_LOG_DIR"/pmcd "$PCP_LOG_DIR"/pmproxy \
"$PCP_LOG_DIR"/pmproxy \
"$PCP_LOG_DIR"/pmie "$PCP_LOG_DIR"/pmlogger \
"$PCP_SA_DIR" \
"$PCP_RUN_DIR" \
Expand Down Expand Up @@ -471,7 +474,7 @@ fi
if which makewhatis >/dev/null 2>&1
then
echo "Rebuilding whatis DB in the background"
makewhatis &
$MAKEWHATIS &
fi

# cull any old files or directories that used to be in the distribution
Expand Down
23 changes: 22 additions & 1 deletion build/tar/preinstall.head.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,35 @@ else
exit
fi

# -n (show-me) is the only command line option ...
#
if [ $# -eq 1 -a X"$1" = X"-n" ]
then
show_me=true
RM="echo + rm"
MV="echo + mv"
MKDIR="echo + mkdir"
SYSTEMCTL="echo + systemctl"
RC_UPDATE="echo + rc-update"
KILL="echo + kill"
else
show_me=false
RM=rm
MV=mv
MKDIR=mkdir
SYSTEMCTL=systemctl
RC_UPDATE=rc-update
KILL=kill
fi

# The new place ... this should match the setting in /etc/pcp.conf
# _after_ the installation
#
PCP_SYSCONF_DIR=@pcp_sysconf_dir@
# and same here ...
#
PCP_LOG_DIR=@pcp_log_dir@
[ -d "$PCP_LOG_DIR" ] || mkdir "$PCP_LOG_DIR"
[ -d "$PCP_LOG_DIR" ] || $MKDIR "$PCP_LOG_DIR"

# and some other things we need ...
#
Expand Down
23 changes: 14 additions & 9 deletions build/tar/preinstall.tail
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ done
export PATH

# migrate and clean configs
echo >>$PCP_LOG_DIR/install.log
date >>$PCP_LOG_DIR/install.log
$show_me || echo >>$PCP_LOG_DIR/install.log
$show_me || date >>$PCP_LOG_DIR/install.log
for base in pmcd pmie pmlogger pmproxy
do
_clean_configs -v 2>>$PCP_LOG_DIR/install.log $PCP_SYSCONF_DIR/$base /var/lib/pcp/config/$base /etc/$base /etc/pcp/$base /etc/sysconfig/$base
if $show_me
then
_clean_configs -n $PCP_SYSCONF_DIR/$base /var/lib/pcp/config/$base /etc/$base /etc/pcp/$base /etc/sysconfig/$base
else
_clean_configs -v 2>>$PCP_LOG_DIR/install.log $PCP_SYSCONF_DIR/$base /var/lib/pcp/config/$base /etc/$base /etc/pcp/$base /etc/sysconfig/$base
fi
done

for svc in pmproxy pmie pmlogger pmmgr pmcd pcp
Expand All @@ -33,21 +38,21 @@ do
# may have clobbered libpcp.so during the earlier build on this host.
#
pids=`_get_pids_by_name -a $svc`
[ -n "$pids" ] && kill -TERM $pids
[ -n "$pids" ] && $KILL -TERM $pids
if which systemctl >/dev/null 2>&1
then
if systemctl list-unit-files $svc.service 2>&1 | grep "^$svc.service" >/dev/null
then
systemctl stop $svc.service
systemctl disable $svc.service
$SYSTEMCTL stop $svc.service
$SYSTEMCTL disable $svc.service
fi
elif which rc-update >/dev/null 2>&1
then
if rc-update show | grep " $svc " >/dev/null 2>&1
then
# service is installed ...
#
rc-update delete $svc
$RC_UPDATE delete $svc
fi
fi
done
Expand All @@ -61,8 +66,8 @@ for conf in \
do
if [ -f "$conf" ]
then
rm -f "$conf.pre"
mv "$conf" "$conf.pre"
$RM -f "$conf.pre"
$MV "$conf" "$conf.pre"
fi
done

Expand Down
1 change: 1 addition & 0 deletions debian/libpcp3-dev.install
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ usr/share/man/man3/__pmAFunblock.3.gz
usr/share/man/man3/__pmAFunregister.3.gz
usr/share/man/man3/__pmAddIPC.3.gz
usr/share/man/man3/__pmConnectLogger.3.gz
usr/share/man/man3/__pmCleanMapDir.3.gz
usr/share/man/man3/__pmControlLog.3.gz
usr/share/man/man3/__pmConvertHighResTime.3.gz
usr/share/man/man3/__pmConvertTime.3.gz
Expand Down
33 changes: 23 additions & 10 deletions debian/pcp.postinst.tail
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,36 @@ then
_version_configs "$@"
fi

getent group pcp >/dev/null || groupadd -r pcp
getent passwd pcp >/dev/null || \
useradd -c "Performance Co-Pilot" -g pcp -d /var/lib/pcp -M -r -s /usr/sbin/nologin pcp

# must match pmns/GNUmakefile, owned by root:root so $PCP_SYSCONF_DIR/pmcd/rc
# can remove it once PMNS rebuild is done on first pmcd startup
#
touch /var/lib/pcp/pmns/.NeedRebuild
chmod 644 /var/lib/pcp/pmns/.NeedRebuild

# owned by pcp:pcp so pmlogger_daily can remove it once rewriting
# is done
#
touch /var/log/pcp/pmlogger/.NeedRewrite
chown pcp:pcp /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 || \
useradd -c "Performance Co-Pilot" -g pcp -d /var/lib/pcp -M -r -s /usr/sbin/nologin pcp

# must match GNUmakefile
#
chown pcp:pcp /var/lib/pcp/config/pmda
chmod 775 /var/lib/pcp/config/pmda
chown pcp:pcp /var/lib/pcp/tmp
chmod 775 /var/lib/pcp/tmp
chown pcp:pcp /var/log/pcp
chmod 775 /var/log/pcp

# must match src/pmcd/GNUmakefile
chown pcp:pcp /var/log/pcp/pmcd
chmod 775 /var/log/pcp/pmcd
chown pcp:pcp /var/run/pcp
chmod 775 /var/run/pcp

# must match src/pmdas/{json,bash,mmv}/GNUmakefile
#
for PMDA in bash json mmv; do
# directory may be in optionally build component, so test first
#
Expand All @@ -37,13 +45,13 @@ for PMDA in bash json mmv; do
done

# must match src/pmdas/mmv/src/GNUmakefile
chown pcp:pcp /var/lib/pcp/tmp/mmv
chmod 775 /var/lib/pcp/tmp/mmv
# (strange but true, the "pmproxy" pmda is built in the mmv dir)
#
chown pcp:pcp /var/lib/pcp/tmp/pmproxy
chmod 775 /var/lib/pcp/tmp/pmproxy

# must match src/pmie/GNUmakefile
#
chown pcp:pcp /var/lib/pcp/config/pmie
chmod 775 /var/lib/pcp/config/pmie
chown pcp:pcp /var/lib/pcp/tmp/pmie
Expand All @@ -52,6 +60,7 @@ chown pcp:pcp /var/log/pcp/pmie
chmod 775 /var/log/pcp/pmie

# must match src/pmlogger/GNUmakefile
#
chown pcp:pcp /var/lib/pcp/config/pmlogger
chmod 775 /var/lib/pcp/config/pmlogger
chown pcp:pcp /var/lib/pcp/tmp/pmlogger
Expand All @@ -62,10 +71,12 @@ chown pcp:pcp /var/log/pcp/sa
chmod 775 /var/log/pcp/sa

# must match src/pmproxy/GNUmakefile
#
chown pcp:pcp /var/log/pcp/pmproxy
chmod 775 /var/log/pcp/pmproxy

# must match src/pmfind/GNUmakefile
#
chown pcp:pcp /var/log/pcp/pmfind
chmod 775 /var/log/pcp/pmfind

Expand Down Expand Up @@ -96,6 +107,7 @@ fi

if $do_systemd_helper
then
deb-systemd-helper enable pcp-reboot-init.service >/dev/null
deb-systemd-helper enable pmcd.service >/dev/null
deb-systemd-helper enable pmlogger.service >/dev/null
deb-systemd-helper enable pmie.service >/dev/null
Expand All @@ -115,6 +127,7 @@ fi
if $do_systemctl
then
systemctl daemon-reload >/dev/null
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
Expand Down
Loading