diff options
Diffstat (limited to 'build/sun')
-rw-r--r-- | build/sun/GNUmakefile | 62 | ||||
-rw-r--r-- | build/sun/README | 27 | ||||
-rw-r--r-- | build/sun/pcp.xml | 173 | ||||
-rwxr-xr-x | build/sun/postinstall | 48 | ||||
-rwxr-xr-x | build/sun/preinstall | 9 | ||||
-rwxr-xr-x | build/sun/preremove | 43 |
6 files changed, 362 insertions, 0 deletions
diff --git a/build/sun/GNUmakefile b/build/sun/GNUmakefile new file mode 100644 index 0000000..4b111af --- /dev/null +++ b/build/sun/GNUmakefile @@ -0,0 +1,62 @@ +# +# Copyright (c) 2013 Red Hat. +# Copyright (c) 2009 Max Matveev. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# + +TOPDIR = ../.. +include $(TOPDIR)/src/include/builddefs + +LSRCFILES = pcp.xml preinstall postinstall preremove +LDIRT += pkginfo proto pcp pcp-$(PACKAGE_VERSION) +PACKAGE_ARCH = $(shell uname -p) + +default install default_pcp : + +install_pcp : +ifeq "$(TARGET_OS)" "solaris" + $(INSTALL) -m644 pcp.xml /var/svc/manifest/application/pcp.xml +endif + +pack_pcp : proto pkginfo + @rm -rf pcp + $(PKGMK) -b $${DIST_ROOT} -d . -f proto + pkgtrans . $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(PACKAGE_NAME) + +proto : $(_FORCE) + @rm -f $@ + @sort -u ../pack_pcp.bin | \ + awk 'BEGIN { print "i pkginfo=pkginfo"; \ + print "i preremove=preremove"; \ + print "i preinstall=preinstall"; \ + print "i postinstall=postinstall"; \ + } \ + $$1 == "l" {printf "s none %s=%s\n", substr($$3, 2), $$2; next; } \ + {printf "%s none %s 0%d %s %s\n", \ + $$1, substr($$NF, 2) , $$2, $$3, $$4}' > $@ + +pkginfo : $(_FORCE) + @rm -f $@ + @echo "PKG=$(PACKAGE_NAME)" > $@ + @echo "NAME=Performance Co-Pilot" >> $@ + @echo "ARCH=$(PACKAGE_ARCH)" >> $@ + @echo "VERSION=$(PACKAGE_VERSION)" >> $@ + @echo "EMAIL=pcp@mail.performancecopilot.org" >> $@ + @echo "CATEGORY=application" >> $@ + @echo "BASEDIR=/" >> $@ + @echo "CLASSES=application none" >> $@ +ifneq "$(GIT)" "" + @echo "PSTAMP="`$(GIT) log -n1 --pretty=format:%H` >> $@ +endif + +include $(BUILDRULES) + diff --git a/build/sun/README b/build/sun/README new file mode 100644 index 0000000..e360316 --- /dev/null +++ b/build/sun/README @@ -0,0 +1,27 @@ +Instructions for installing Performance Co-Pilot (PCP) from a Solaris package + +If PCP is delivered as a Solaris package, there will be a package +datastream file in this directory named pcp-<version_number> + +There will also be tar files in the sibling ../tar directory: + +pcp-<version_number>-<build>.src.tar.gz all of the source +pcp-<version_number>-<build>.tar.gz a binary distribution + +To install or upgrade, run the following commands as "root": + + # /usr/sbin/pkgadd -d pcp-* all + +To start pmcd (and enable persistent restart after reboot) + + # /usr/sbin/svcadm enable pcp/pcp + +Similarly (if needed) ... + + # /usr/sbin/svcadm enable pcp/pmie + # /usr/sbin/svcadm enable pcp/pmwebd + # /usr/sbin/svcadm enable pcp/pmproxy + +To remove PCP, run the following command as "root": + + # /usr/sbin/pkgrm pcp diff --git a/build/sun/pcp.xml b/build/sun/pcp.xml new file mode 100644 index 0000000..1094077 --- /dev/null +++ b/build/sun/pcp.xml @@ -0,0 +1,173 @@ +<?xml version="1.0"?> +<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> +<!-- + Copyright (c) 2009 Max Matveev. All rights reserved. +--> + +<service_bundle type='manifest' name='pcp'> + +<service name='application/pcp/pcp' type='service' version='1'> + <create_default_instance enabled='false' /> + <single_instance /> + <dependency name='root' grouping='require_all' restart_on='none' + type='service'> + <service_fmri value='svc:/system/filesystem/local:default'/> + <service_fmri value='svc:/milestone/network:default'/> + </dependency> + <exec_method type='method' name='start' exec='/etc/init.d/pcp start' + timeout_seconds='60' /> + <exec_method type='method' name='stop' exec='/etc/init.d/pcp stop' + timeout_seconds='60' /> + <property_group name='startd' type='framework'> + <propval name='ignore_error' type='astring' value='core' /> + </property_group> + <stability value='Unstable' /> + <template> + <common_name> + <loctext xml:lang='C'> + Performance Co-Pilot Legacy scripts + </loctext> + </common_name> + <documentation> + <manpage title='pcpinfo' section='1' + manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +<service name='application/pcp/pmcd' type='service' version='1'> + <create_default_instance enabled='false' /> + <single_instance /> + <dependency name='root' grouping='require_all' restart_on='none' + type='service'> + <service_fmri value='svc:/system/filesystem/local:default'/> + <service_fmri value='svc:/milestone/network:default'/> + </dependency> + <exec_method type='method' name='start' exec='/etc/init.d/pmcd start' + timeout_seconds='60' /> + <exec_method type='method' name='stop' exec='/etc/init.d/pmcd stop' + timeout_seconds='60' /> + <property_group name='startd' type='framework'> + <propval name='ignore_error' type='astring' value='core' /> + </property_group> + <stability value='Unstable' /> + <template> + <common_name> + <loctext xml:lang='C'> + Performance Co-Pilot Collector Daemon + </loctext> + </common_name> + <documentation> + <manpage title='pmcd' section='1' + manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +<service name='application/pcp/pmlogger' type='service' version='1'> + <create_default_instance enabled='false' /> + <single_instance /> + <dependency name='root' grouping='require_all' restart_on='none' + type='service'> + <service_fmri value='svc:/system/filesystem/local:default'/> + <service_fmri value='svc:/milestone/network:default'/> + </dependency> + <exec_method type='method' name='start' exec='/etc/init.d/pmlogger start' + timeout_seconds='60' /> + <exec_method type='method' name='stop' exec='/etc/init.d/pmlogger stop' + timeout_seconds='60' /> + <property_group name='startd' type='framework'> + <propval name='ignore_error' type='astring' value='core' /> + </property_group> + <stability value='Unstable' /> + <template> + <common_name> + <loctext xml:lang='C'> + Performance Co-Pilot Logger + </loctext> + </common_name> + <documentation> + <manpage title='pmlogger' section='1' + manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +<service name='application/pcp/pmie' type='service' version='1'> + <create_default_instance enabled='false' /> + <single_instance /> + <dependency name='root' grouping='require_all' restart_on='none' + type='service'> + <service_fmri value='svc:/system/filesystem/local:default'/> + <service_fmri value='svc:/milestone/network:default'/> + </dependency> + <exec_method type='method' name='start' exec='/etc/init.d/pmie start' + timeout_seconds='60' /> + <exec_method type='method' name='stop' exec='/etc/init.d/pmie stop' + timeout_seconds='60' /> + <stability value='Unstable' /> + <template> + <common_name> + <loctext xml:lang='C'> + Performance Co-Pilot Inference Engine + </loctext> + </common_name> + <documentation> + <manpage title='pmie' section='1' + manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +<service name='application/pcp/pmwebd' type='service' version='1'> + <create_default_instance enabled='false' /> + <single_instance /> + <dependency name='root' grouping='require_all' restart_on='none' + type='service'> + <service_fmri value='svc:/system/filesystem/local:default'/> + <service_fmri value='svc:/milestone/network:default'/> + </dependency> + <exec_method type='method' name='start' exec='/etc/init.d/pmwebd start' + timeout_seconds='60' /> + <exec_method type='method' name='stop' exec='/etc/init.d/pmwebd stop' + timeout_seconds='60' /> + <stability value='Unstable' /> + <template> + <common_name> + <loctext xml:lang='C'> + Performance Co-Pilot Web Daemon + </loctext> + </common_name> + <documentation> + <manpage title='pmwebd' section='1' + manpath='/usr/share/man' /> + </documentation> + </template> +</service> + +<service name='application/pcp/pmproxy' type='service' version='1'> + <create_default_instance enabled='false' /> + <single_instance /> + <dependency name='root' grouping='require_all' restart_on='none' + type='service'> + <service_fmri value='svc:/system/filesystem/local:default'/> + <service_fmri value='svc:/milestone/network:default'/> + </dependency> + <exec_method type='method' name='start' exec='/etc/init.d/pmproxy start' + timeout_seconds='60' /> + <exec_method type='method' name='stop' exec='/etc/init.d/pmproxy stop' + timeout_seconds='60' /> + <stability value='Unstable' /> + <template> + <common_name> + <loctext xml:lang='C'> + Performance Co-Pilot Proxy Daemon + </loctext> + </common_name> + <documentation> + <manpage title='pmproxy' section='1' + manpath='/usr/share/man' /> + </documentation> + </template> +</service> +</service_bundle> diff --git a/build/sun/postinstall b/build/sun/postinstall new file mode 100755 index 0000000..693f0ce --- /dev/null +++ b/build/sun/postinstall @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Import PCP services into SMF but do not start them - let admin do it +# when she's ready. +# + +export PATH=/usr/sbin:$PATH + +if [ -f /etc/pcp.conf ] +then + # for all the configuration files we know about, try to keep + # any local modifications, and salt away file with a .orig + # suffix for a subsequent upgrade + # + . /etc/pcp.conf + for conf in \ + $PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH $PCP_PMCDRCLOCAL_PATH \ + $PCP_PMIECONTROL_PATH $PCP_PMLOGGERCONTROL_PATH \ + $PCP_PMPROXYOPTIONS_PATH $PCP_PMWEBDOPTIONS_PATH + do + if [ -f $conf.pre -a -f $conf ] + then + if cmp -s $conf.pre $conf + then + cp $conf $conf.orig + rm $conf.pre + else + # restore local modifications ... + cp $conf $conf.orig + mv $conf.pre $conf + fi + elif [ -f $conf ] + then + cp $conf $conf.orig + fi + done +fi + +chown -R pcp:pcp /var/log/pcp/pmcd 2>/dev/null +chown -R pcp:pcp /var/log/pcp/pmlogger 2>/dev/null +chown -R pcp:pcp /var/log/pcp/pmie 2>/dev/null +chown -R pcp:pcp /var/log/pcp/pmwebd 2>/dev/null +chown -R pcp:pcp /var/log/pcp/pmproxy 2>/dev/null + +touch /var/lib/pcp/pmns/.NeedRebuild 2>/dev/null +chmod 644 /var/lib/pcp/pmns/.NeedRebuild 2>/dev/null +svccfg import /var/svc/manifest/application/pcp.xml + diff --git a/build/sun/preinstall b/build/sun/preinstall new file mode 100755 index 0000000..aa6fce9 --- /dev/null +++ b/build/sun/preinstall @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Install unprivileged user (and group) account for PCP daemons. +# + +export PATH=/usr/sbin:$PATH +getent group pcp >/dev/null || groupadd pcp +getent passwd pcp >/dev/null || \ + useradd -c "Performance Co-Pilot" -g pcp -d /var/lib/pcp -s /usr/bin/false pcp diff --git a/build/sun/preremove b/build/sun/preremove new file mode 100755 index 0000000..221ce4c --- /dev/null +++ b/build/sun/preremove @@ -0,0 +1,43 @@ +#!/bin/sh +# +# Stop PCP related services before removing the package +# + +export PATH=/usr/sbin:$PATH + +svcs -H svc:/application/pcp/\* \ +| while read state ts svc; do + if [ "$state" = "online" ] ; then + svcadm -v disable -s $svc + fi + svccfg delete -f $svc +done + +if [ -f /etc/pcp.conf ] +then + # for all the configuration files we know about, the goal is it + # have files with a .pre suffix unless we're certain they have + # not been locally altered + # + . /etc/pcp.conf + for conf in \ + $PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH $PCP_PMCDRCLOCAL_PATH \ + $PCP_PMIECONTROL_PATH $PCP_PMLOGGERCONTROL_PATH \ + $PCP_PMPROXYOPTIONS_PATH $PCP_PMWEBDOPTIONS_PATH + do + if [ -f $conf.orig -a -f $conf ] + then + if cmp -s $conf.orig $conf + then + # file not changed since installation + rm $conf.orig + else + cp $conf $conf.pre + rm $conf.orig + fi + elif [ -f $conf ] + then + cp $conf $conf.pre + fi + done +fi |