Skip to content

Commit

Permalink
Artifacts for Solaris package
Browse files Browse the repository at this point in the history
  • Loading branch information
d_pocock committed Aug 21, 2009
1 parent dc92bb1 commit 16b133a
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 3 deletions.
3 changes: 3 additions & 0 deletions configure.in
Expand Up @@ -682,13 +682,15 @@ AC_SUBST(moduledir)

AC_OUTPUT(Makefile
ganglia-config
contrib/ganglia_gmond.xml
tests/Makefile
ganglia.spec
gmetad/Makefile
lib/default_conf.h
lib/Makefile
gmond/Makefile
gstat/Makefile
gmond/gmond.solaris.init
gmond/modules/Makefile
gmond/modules/conf.d/modpython.conf
gmond/modules/example/Makefile
Expand All @@ -712,6 +714,7 @@ AC_OUTPUT(Makefile
gmetad-python/plugins/rrd_plugin.py
gmetric/Makefile
include/Makefile
solaris/pkginfo
web/conf.php
web/version.php)

Expand Down
6 changes: 3 additions & 3 deletions contrib/ganglia_gmond.xml → contrib/ganglia_gmond.xml.in
@@ -1,7 +1,7 @@
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='gmond'>
<service name='application/ganglia/gmond' type='service' version='1'>
<service name='ganglia/gmond' type='service' version='1'>

<dependency name='fs' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
Expand All @@ -10,10 +10,10 @@
<service_fmri value='svc:/network/physical:default'/>
</dependency>
<dependency name='config' grouping='require_all' restart_on='none' type='path'>
<service_fmri value='file://localhost/etc/gmond.conf'/>
<service_fmri value='file://localhost@prefix@/etc/gmond.conf'/>
</dependency>

<exec_method name='start' type='method' exec='/opt/ganglia/sbin/gmond' timeout_seconds='60'/>
<exec_method name='start' type='method' exec='@prefix@/sbin/gmond' timeout_seconds='60'/>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60' />

<instance name="default" enabled="true">
Expand Down
27 changes: 27 additions & 0 deletions gmond/gmond.solaris.init.in
@@ -0,0 +1,27 @@
#!/bin/sh

GANGLIA_BASEDIR=@prefix@
GMOND=${GANGLIA_BASEDIR}/sbin/gmond

test -f /etc/default/gmond && . /etc/default/gmond

[ ! -d ${GANGLIA_BASEDIR} ] && exit 1

case "$1" in

'start')
${GMOND}
;;

'stop')
/usr/bin/pkill -x gmond
;;

*)
echo "Usage: $0 { start | stop }"
exit 1
;;

esac
exit 0

100 changes: 100 additions & 0 deletions solaris/buildpkg
@@ -0,0 +1,100 @@
#!/bin/bash -x

# run configure and make
scripts/build-solaris.sh || exit 1

MAKE=/opt/csw/bin/gmake

# verify that configure has been run
if ! [ -f solaris/pkginfo ];
then
echo "Can't find solaris/pkginfo. Please run configure."
exit 1
fi

# Extract information about the package from pkginfo
# This information is needed to create the filename
# and for other purposes
PKGSNAME=`grep '^PKG=' solaris/pkginfo | cut -f2 -d=`
PKGNAME=`grep '^NAME=' solaris/pkginfo | cut -f2 -d= | cut -f1 -d' '`
PKGVERSION=`grep '^VERSION=' solaris/pkginfo | cut -f2- -d= | tr ' ' '_' `
BASEDIR=`grep '^BASEDIR=' solaris/pkginfo | cut -f2 -d=`
PKGARCH=`grep '^ARCH=' solaris/pkginfo | cut -f2 -d=`

PKGFILENAME=${PKGNAME}-${PKGVERSION}-${PKGARCH}.pkg

# Prepare a directory for DESTDIR
INST_TMP=`pwd`/inst_tmp
rm -rf "${ISNT_TMP}" || exit 1
mkdir -p "${ISNT_TMP}" || exit 1

# Prepare a directory for holding the output of pkgmk
PKG_TMP=`pwd`/pkg_tmp
rm -rf "${PKG_TMP}" || exit 1
mkdir -p "${PKG_TMP}" || exit 1

# Install the files to our working directory
${MAKE} DESTDIR="${INST_TMP}" install || exit 1

# Install some stuff that is not installed by make
cp -f contrib/ganglia_gmond.xml "${INST_TMP}"/gmond.xml || exit 1
cp -f gmond/gmond.solaris.init "${INST_TMP}/gmond.init" || exit 1
cp -f gmond/modules/conf.d/modgstatus.conf "${INST_TMP}" || exit 1
cp -f gmond/modules/conf.d/modpython.conf "${INST_TMP}" || exit 1
cp -f gmond/python_modules/conf.d/example.pyconf "${INST_TMP}/example.pyconf.disabled" || exit 1

# Generate a config file if necessary
if [ -f gmond/gmond.conf.solaris ];
then
cp -f gmond/gmond.conf.solaris "${INST_TMP}/gmond.conf" || exit 1
else
gmond/gmond -t > "${INST_TMP}/gmond.conf" || exit 1
fi

# Build a prototype file
SOLARIS_PKG=`pwd`/solaris
cat > "${INST_TMP}/prototype" << EOF
i pkginfo=${SOLARIS_PKG}/pkginfo
i checkinstall=${SOLARIS_PKG}/checkinstall
i preinstall=${SOLARIS_PKG}/preinstall
i postinstall=${SOLARIS_PKG}/postinstall
i preremove=${SOLARIS_PKG}/preremove
i i.nonsmf=${SOLARIS_PKG}/i.nonsmf
i i.smf=${SOLARIS_PKG}/i.smf
i depend=${SOLARIS_PKG}/depend
f nonsmf /etc/init.d/gmond=${INST_TMP}/gmond.init 0755 root bin
l nonsmf /etc/rc0.d/K15gmond=../init.d/gmond
l nonsmf /etc/rc1.d/K15gmond=../init.d/gmond
l nonsmf /etc/rc2.d/K15gmond=../init.d/gmond
l nonsmf /etc/rc3.d/S30gmond=../init.d/gmond
l nonsmf /etc/rcS.d/K15gmond=../init.d/gmond
d none etc 0755 root root
f none etc/gmond.conf=${INST_TMP}/gmond.conf 0644 root root
d none etc/conf.d 0755 root root
f none etc/conf.d/modpython.conf=${INST_TMP}/modpython.conf 0644 root root
f none etc/conf.d/example.pyconf.disabled=${INST_TMP}/example.pyconf.disabled 0644 root root
f none etc/conf.d/modgstatus.conf=${INST_TMP}/modgstatus.conf 0644 root root
d smf var 0755 root root
d smf var/svc 0755 root root
d smf var/svc/manifest 0755 root root
d smf var/svc/manifest/ganglia 0755 root root
f smf var/svc/manifest/ganglia/gmond.xml=${INST_TMP}/gmond.xml 0755 root root
d smf lib/svc 0755 root root
d smf lib/svc/method 0755 root root
f smf lib/svc/method/svc-gmond=${INST_TMP}/gmond.init 0755 root root
EOF

(cd inst_tmp/usr/local ; find . | pkgproto | sed -e 's/em_pocod other$/root bin/' ) >> "${INST_TMP}/prototype" || exit 1

# Prepare a package
(cd "${INST_TMP}" ; pkgmk \
-b "${INST_TMP}/${BASEDIR}" \
-f "${INST_TMP}/prototype" \
-d "${PKG_TMP}" ) || exit 1

# Bundle the package data into a single file
pkgtrans -s ${PKG_TMP} `pwd`/${PKGFILENAME} ${PKGSNAME} || exit 1

# Compress the package for distribution
gzip -f ${PKGFILENAME}

22 changes: 22 additions & 0 deletions solaris/checkinstall
@@ -0,0 +1,22 @@
#!/bin/sh
#
trap `exit 3` 15

# Assign Solaris release class to install release specific files
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ] ; then smf=yes ; fi
if [ $smf = yes ]
then
CLASSES='none smf'
else
CLASSES='none nonsmf'
fi

# Make env variables available to other packaging scripts

cat >$1 <<!
CLASSES='$CLASSES'
!

exit 0

4 changes: 4 additions & 0 deletions solaris/depend
@@ -0,0 +1,4 @@
P CSWpython python - The Python 2.3 language interpreter
P GNGconfuse GNGlibconfuse - provides an API for reading text based configuration files.
P CSWapr1 CSWapr1
P CSWexpat expat - XML Parser Toolkit
12 changes: 12 additions & 0 deletions solaris/i.nonsmf
@@ -0,0 +1,12 @@
#!/bin/sh


echo "Installing class <nonsmf>."
while read src dest
do
# Do copy
/usr/bin/cp $src $dest || exit 2
echo $dest
done
exit 0

11 changes: 11 additions & 0 deletions solaris/i.smf
@@ -0,0 +1,11 @@
#!/bin/sh

echo "Installing class <smf>."
while read src dest
do
# Do copy
/usr/bin/cp $src $dest || exit 2
echo $dest
done
exit 0

7 changes: 7 additions & 0 deletions solaris/pkginfo.in
@@ -0,0 +1,7 @@
PKG=GNGgmond
NAME=GNGganglia_gmond - Ganglia monitors system resources across the cluster.
ARCH=@host_cpu@
VERSION=@VERSION@,REV=@REL@
CATEGORY=system
EMAIL=ganglia-general@lists.sourceforge.net
BASEDIR=@prefix@
34 changes: 34 additions & 0 deletions solaris/postinstall
@@ -0,0 +1,34 @@
#!/bin/sh

GANGLIA_HOME=${CLIENT_BASEDIR}
GANGLIA_ETC=${GANGLIA_HOME}/etc

GMOND_CONF=${GANGLIA_ETC}/gmond.conf

# Set variable smf depending on the availability of SMF binaries
smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ]
then
smf=yes
fi

# If needed, configure SMF
if [ $smf = yes ]
then
# Register with SMF
echo "Configuring service in SMF"
/usr/sbin/svccfg import ${GANGLIA_HOME}/var/svc/manifest/ganglia/gmond.xml >/dev/null 2>&1
/usr/sbin/svcadm disable svc:/ganglia/gmond >/dev/null 2>&1
echo "gmond is using Service Management Facility. The FMRI is:"
echo " svc:/ganglia/gmond:default"
fi

if [ $smf = yes ]
then
/usr/sbin/svcadm enable svc:/ganglia/gmond
else
/etc/init.d/gmond start
fi

exit 0

21 changes: 21 additions & 0 deletions solaris/preinstall
@@ -0,0 +1,21 @@
#!/bin/sh

smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ]
then
smf=yes
fi

if [ $smf = yes ]
then
/usr/sbin/svcadm disable svc:/ganglia/gmond
else
if [ -f /etc/init.d/gmond ];
then

/etc/init.d/gmond stop >/dev/null 2>&1

fi
fi

exit 0
27 changes: 27 additions & 0 deletions solaris/preremove
@@ -0,0 +1,27 @@
#!/bin/sh

GANGLIA_HOME=${CLIENT_BASEDIR}
GANGLIA_ETC=${GANGLIA_HOME}/etc


smf=no
if [ -f /usr/sbin/svccfg -a -f /usr/sbin/svcadm ]
then
smf=yes
fi

if [ $smf = yes ]
then
/usr/sbin/svcadm disable svc:/ganglia/gmond
else
if [ -f /etc/init.d/gmond ];
then

/etc/init.d/gmond stop >/dev/null 2>&1

fi
fi


exit 0

0 comments on commit 16b133a

Please sign in to comment.