aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jeremy T. Bouse <undrgrid@users.sourceforge.net> 2003-03-23 07:01:20 +0000
committerGravatar Jeremy T. Bouse <undrgrid@users.sourceforge.net> 2003-03-23 07:01:20 +0000
commit739ea144d276ca475730d0c928ed9fd82f3cba03 (patch)
tree58fad2d7ab1427e06150c53cdcb3e41a5d03f9f5
parentc9d73535b59fef3056c65c3be6e1e18e4509629a (diff)
downloadmonitoring-plugins-739ea144d276ca475730d0c928ed9fd82f3cba03.tar.gz
Solaris package build system
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@449 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--Makefile.am32
-rwxr-xr-xautogen.sh9
-rw-r--r--configure.in10
-rw-r--r--lib/Makefile.am2
-rw-r--r--pkg/solaris/pkginfo.in12
-rwxr-xr-xpkg/solaris/solpkg80
6 files changed, 114 insertions, 31 deletions
diff --git a/Makefile.am b/Makefile.am
index 33182593..8cc15144 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@
SUBDIRS = lib plugins plugins-scripts
EXTRA_DIST = CODING FAQ LEGAL REQUIREMENTS SUPPORT \
- Helper.pm contrib nagios-plugins.spec.in
+ Helper.pm contrib pkg nagios-plugins.spec.in
ACLOCAL_AMFLAGS = -I lib
@@ -18,31 +18,17 @@ nagios-plugins.spec: nagios-plugins.spec.in
sed "s/%%{VER}/${VER}/;s/%%{REL}/${REL}/;" $? > $@
# Solaris pkgmk
-PACKDIR=build-pkg
+BUILDDIR=`pwd`/build-solaris
+PACKDIR=`pwd`/build-pkg
VERSION=@PACKAGE_VERSION@
-Prototype:
+solpkg:
+ if [ ! -d $(BUILDDIR) ] ; then mkdir $(BUILDDIR); fi
if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi
- cd build-solaris
$(MAKE) all
- $(MAKE) DESTDIR=../$(PACKDIR) install
- cd ..
- echo i pkginfo> Prototype
- if [ -f checkinstall ] ; then echo i checkinstall>> Prototype; fi
- if [ -f preinstall ] ; then echo i preinstall>> Prototype; fi
- if [ -f postinstall ] ; then echo i postinstall>> Prototype; fi
- pkgproto $(PACKDIR)=/ | sed -e "s|$(LOGNAME) $(GROUP)$$|root root|" | egrep -v "(s|d) none (/|/etc|/var|/usr|/usr/local) " >> Prototype
-
-pkgmap: ../Prototype
- mkdir -p $(PACKDIR)/nagiosp
- cd $(PACKDIR)/nagiosp
- pkgmk -o -r / -f ../Prototype -d $(PACKDIR) nagiosp
- cd ..
-
-nagios.SPARC.pkg.tar.gz: pkgmap
- cd $(PACKDIR) && tar -cf - nagiosp | gzip -9 -c > ../nagiosp.SPARC.pkg.tar.gz
-
-pkgset: nagiosp.SPARC.pkg.tar.gz
+ $(MAKE) DESTDIR=$(BUILDDIR) install
+ $(INSTALL) pkg/solaris/pkginfo $(BUILDDIR)
+ $(cd $(BUILDDIR) && `pwd`/pkg/solaris/solpkg $(PACKDIR))
pkgclean:
- rm -rf Prototype nagiosp.SPARC.pkg.tar.gz
+ rm -rf $(BUILDDIR) $(PACKDIR)
diff --git a/autogen.sh b/autogen.sh
index 0357d93a..b833a308 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -19,18 +19,13 @@ else
fi
# Refresh GNU autotools toolchain.
-for i in config.guess config.sub missing install-sh mkinstalldirs ; do
+for i in config.guess config.sub missing install-sh mkinstalldirs depcomp; do
test -r /usr/share/automake/${i} && {
rm -f ${i}
- cp /usr/share/automake/${i} .
}
- chmod 755 ${i}
done
-aclocal -I lib
-autoheader
-automake -c -a
-autoconf
+tools/setup
# For the Debian build
test -d debian && {
diff --git a/configure.in b/configure.in
index 035ae36e..646519f8 100644
--- a/configure.in
+++ b/configure.in
@@ -99,6 +99,14 @@ ac_cv_uname_s=`uname -s`
ac_cv_uname_r=`uname -r`
ac_cv_uname_v=`uname -v`
+PKG_ARCH=`uname -p`
+REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
+REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
+
+AC_SUBST(PKG_ARCH)
+AC_SUBST(REV_DATESTAMP)
+AC_SUBST(REV_TIMESTAMP)
+
dnl Checks for programs.
AC_PATH_PROG(PYTHON,python)
AC_PATH_PROG(PERL,perl)
@@ -1469,7 +1477,7 @@ AC_SUBST(DEPLIBS)
AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
-AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl,PATH=.:..:$PATH command.cfg)
+AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl pkg/solaris/pkginfo)
ACX_FEATURE([with],[cgiurl])
ACX_FEATURE([with],[nagios-user])
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 6353d01c..4c99944d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -6,4 +6,6 @@ noinst_HEADERS = getopt.h fsusage.h mountlist.h
libnagiosplug_a_SOURCES = getopt.c getopt1.c getloadavg.c snprintf.c fsusage.c mountlist.c
+EXTRA_DIST = afs.m4 fstypename.m4 fsusage.m4 ls-mntd-fs.m4
+
INCLUDES = -I$(srcdir)
diff --git a/pkg/solaris/pkginfo.in b/pkg/solaris/pkginfo.in
new file mode 100644
index 00000000..be4b97fa
--- /dev/null
+++ b/pkg/solaris/pkginfo.in
@@ -0,0 +1,12 @@
+PKG="NPDTplugins"
+NAME="nagiosplugins"
+DESC="Nagios network monitoring plugins"
+ARCH="@PKG_ARCH@"
+VERSION="@PACKAGE_VERSION@,REV=@REV_DATESTAMP@"
+CATEGORY="application"
+VENDOR="Nagios Plugin Development Team"
+EMAIL="nagiosplug-devel@lists.sourceforge.net"
+PSTAMP="sfw@REV_TIMESTAMP@"
+BASEDIR="/usr/local"
+CLASSES="none"
+
diff --git a/pkg/solaris/solpkg b/pkg/solaris/solpkg
new file mode 100755
index 00000000..0b82bce0
--- /dev/null
+++ b/pkg/solaris/solpkg
@@ -0,0 +1,80 @@
+#!/usr/bin/perl
+
+$pkgdevice = $ARGV[0] || die "Unable to determine device ($!)\n";
+
+$find = "/usr/bin/find";
+$pkgproto = "/usr/bin/pkgproto";
+$pkgmk = "/usr/bin/pkgmk";
+$pkgtrans = "/usr/bin/pkgtrans";
+$prototype = "prototype";
+$pkginfo = "pkginfo";
+
+# Sanity check
+
+$pwd = `pwd`;
+if ($pwd =~ '\/usr\/local') {
+ $pwd = $`;
+}
+die "Wrong location, please cd to <PKGBASE>/usr/local/ and run again.\n"
+ if ($pwd eq "");
+
+open (PREPROTO,"$find . -print |$pkgproto |") ||
+ die "Unable to read prototype information ($!)\n";
+open (PROTO,">$prototype") ||
+ die "Unable to write file prototype ($!)\n";
+print PROTO "i pkginfo=./$pkginfo\n";
+while (<PREPROTO>) {
+ # Read in the prototype information
+ chomp;
+ $thisline = $_;
+ if ($thisline =~ " prototype "
+ or $thisline =~ " pkginfo ") {
+ # Don't do anything as they aren't important
+ } elsif ($thisline =~ "^[fd] ") {
+ # Change the ownership of files and directories
+ ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline;
+ print PROTO "$dir $none $file $mode bin bin\n";
+ } else {
+ # Symlinks and other stuff should be printed also
+ print PROTO "$thisline\n";
+ }
+}
+close PROTO;
+close PREPROTO;
+
+# Now we can start building the package
+
+$os = `uname -r`;
+$os =~ '\.';
+$os = "sol$'";
+chomp $os;
+
+open (PKGINFO,"<$pkginfo") ||
+ die "Unable to read package information ($!)\n";
+while (<PKGINFO>) {
+ # Read in the package information
+ chomp;
+ $thisline = $_;
+ ($var,$value) = split /=/,$thisline;
+ if ("$var" eq "NAME"
+ or "$var" eq "VERSION"
+ or "$var" eq "ARCH") {
+ $tmp = lc($var);
+ $value =~ s/\"//g;
+ if ("$tmp" eq "version"
+ and $value =~ ",REV") {
+ ($value,$var) = split /\,/,$value;
+ $$tmp = $value;
+ } else {
+ $$tmp = $value;
+ }
+ }
+}
+close PKGINFO;
+
+$packagename = "$name-$version-$os-$arch-local";
+
+print "Building package\n";
+system ("$pkgmk -o -r `pwd` -d $pkgdevice");
+system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename)");
+print "Done. ($packagename)\n";