diff options
author | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | 2003-03-23 07:01:20 +0000 |
---|---|---|
committer | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | 2003-03-23 07:01:20 +0000 |
commit | 739ea144d276ca475730d0c928ed9fd82f3cba03 (patch) | |
tree | 58fad2d7ab1427e06150c53cdcb3e41a5d03f9f5 | |
parent | c9d73535b59fef3056c65c3be6e1e18e4509629a (diff) | |
download | monitoring-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.am | 32 | ||||
-rwxr-xr-x | autogen.sh | 9 | ||||
-rw-r--r-- | configure.in | 10 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | pkg/solaris/pkginfo.in | 12 | ||||
-rwxr-xr-x | pkg/solaris/solpkg | 80 |
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 @@ | |||
3 | SUBDIRS = lib plugins plugins-scripts | 3 | SUBDIRS = lib plugins plugins-scripts |
4 | 4 | ||
5 | EXTRA_DIST = CODING FAQ LEGAL REQUIREMENTS SUPPORT \ | 5 | EXTRA_DIST = CODING FAQ LEGAL REQUIREMENTS SUPPORT \ |
6 | Helper.pm contrib nagios-plugins.spec.in | 6 | Helper.pm contrib pkg nagios-plugins.spec.in |
7 | 7 | ||
8 | ACLOCAL_AMFLAGS = -I lib | 8 | ACLOCAL_AMFLAGS = -I lib |
9 | 9 | ||
@@ -18,31 +18,17 @@ nagios-plugins.spec: nagios-plugins.spec.in | |||
18 | sed "s/%%{VER}/${VER}/;s/%%{REL}/${REL}/;" $? > $@ | 18 | sed "s/%%{VER}/${VER}/;s/%%{REL}/${REL}/;" $? > $@ |
19 | 19 | ||
20 | # Solaris pkgmk | 20 | # Solaris pkgmk |
21 | PACKDIR=build-pkg | 21 | BUILDDIR=`pwd`/build-solaris |
22 | PACKDIR=`pwd`/build-pkg | ||
22 | VERSION=@PACKAGE_VERSION@ | 23 | VERSION=@PACKAGE_VERSION@ |
23 | 24 | ||
24 | Prototype: | 25 | solpkg: |
26 | if [ ! -d $(BUILDDIR) ] ; then mkdir $(BUILDDIR); fi | ||
25 | if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi | 27 | if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi |
26 | cd build-solaris | ||
27 | $(MAKE) all | 28 | $(MAKE) all |
28 | $(MAKE) DESTDIR=../$(PACKDIR) install | 29 | $(MAKE) DESTDIR=$(BUILDDIR) install |
29 | cd .. | 30 | $(INSTALL) pkg/solaris/pkginfo $(BUILDDIR) |
30 | echo i pkginfo> Prototype | 31 | $(cd $(BUILDDIR) && `pwd`/pkg/solaris/solpkg $(PACKDIR)) |
31 | if [ -f checkinstall ] ; then echo i checkinstall>> Prototype; fi | ||
32 | if [ -f preinstall ] ; then echo i preinstall>> Prototype; fi | ||
33 | if [ -f postinstall ] ; then echo i postinstall>> Prototype; fi | ||
34 | pkgproto $(PACKDIR)=/ | sed -e "s|$(LOGNAME) $(GROUP)$$|root root|" | egrep -v "(s|d) none (/|/etc|/var|/usr|/usr/local) " >> Prototype | ||
35 | |||
36 | pkgmap: ../Prototype | ||
37 | mkdir -p $(PACKDIR)/nagiosp | ||
38 | cd $(PACKDIR)/nagiosp | ||
39 | pkgmk -o -r / -f ../Prototype -d $(PACKDIR) nagiosp | ||
40 | cd .. | ||
41 | |||
42 | nagios.SPARC.pkg.tar.gz: pkgmap | ||
43 | cd $(PACKDIR) && tar -cf - nagiosp | gzip -9 -c > ../nagiosp.SPARC.pkg.tar.gz | ||
44 | |||
45 | pkgset: nagiosp.SPARC.pkg.tar.gz | ||
46 | 32 | ||
47 | pkgclean: | 33 | pkgclean: |
48 | rm -rf Prototype nagiosp.SPARC.pkg.tar.gz | 34 | rm -rf $(BUILDDIR) $(PACKDIR) |
@@ -19,18 +19,13 @@ else | |||
19 | fi | 19 | fi |
20 | 20 | ||
21 | # Refresh GNU autotools toolchain. | 21 | # Refresh GNU autotools toolchain. |
22 | for i in config.guess config.sub missing install-sh mkinstalldirs ; do | 22 | for i in config.guess config.sub missing install-sh mkinstalldirs depcomp; do |
23 | test -r /usr/share/automake/${i} && { | 23 | test -r /usr/share/automake/${i} && { |
24 | rm -f ${i} | 24 | rm -f ${i} |
25 | cp /usr/share/automake/${i} . | ||
26 | } | 25 | } |
27 | chmod 755 ${i} | ||
28 | done | 26 | done |
29 | 27 | ||
30 | aclocal -I lib | 28 | tools/setup |
31 | autoheader | ||
32 | automake -c -a | ||
33 | autoconf | ||
34 | 29 | ||
35 | # For the Debian build | 30 | # For the Debian build |
36 | test -d debian && { | 31 | 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` | |||
99 | ac_cv_uname_r=`uname -r` | 99 | ac_cv_uname_r=`uname -r` |
100 | ac_cv_uname_v=`uname -v` | 100 | ac_cv_uname_v=`uname -v` |
101 | 101 | ||
102 | PKG_ARCH=`uname -p` | ||
103 | REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'` | ||
104 | REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'` | ||
105 | |||
106 | AC_SUBST(PKG_ARCH) | ||
107 | AC_SUBST(REV_DATESTAMP) | ||
108 | AC_SUBST(REV_TIMESTAMP) | ||
109 | |||
102 | dnl Checks for programs. | 110 | dnl Checks for programs. |
103 | AC_PATH_PROG(PYTHON,python) | 111 | AC_PATH_PROG(PYTHON,python) |
104 | AC_PATH_PROG(PERL,perl) | 112 | AC_PATH_PROG(PERL,perl) |
@@ -1469,7 +1477,7 @@ AC_SUBST(DEPLIBS) | |||
1469 | 1477 | ||
1470 | AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version]) | 1478 | AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version]) |
1471 | 1479 | ||
1472 | 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) | 1480 | 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) |
1473 | 1481 | ||
1474 | ACX_FEATURE([with],[cgiurl]) | 1482 | ACX_FEATURE([with],[cgiurl]) |
1475 | ACX_FEATURE([with],[nagios-user]) | 1483 | 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 | |||
6 | 6 | ||
7 | libnagiosplug_a_SOURCES = getopt.c getopt1.c getloadavg.c snprintf.c fsusage.c mountlist.c | 7 | libnagiosplug_a_SOURCES = getopt.c getopt1.c getloadavg.c snprintf.c fsusage.c mountlist.c |
8 | 8 | ||
9 | EXTRA_DIST = afs.m4 fstypename.m4 fsusage.m4 ls-mntd-fs.m4 | ||
10 | |||
9 | INCLUDES = -I$(srcdir) | 11 | 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 @@ | |||
1 | PKG="NPDTplugins" | ||
2 | NAME="nagiosplugins" | ||
3 | DESC="Nagios network monitoring plugins" | ||
4 | ARCH="@PKG_ARCH@" | ||
5 | VERSION="@PACKAGE_VERSION@,REV=@REV_DATESTAMP@" | ||
6 | CATEGORY="application" | ||
7 | VENDOR="Nagios Plugin Development Team" | ||
8 | EMAIL="nagiosplug-devel@lists.sourceforge.net" | ||
9 | PSTAMP="sfw@REV_TIMESTAMP@" | ||
10 | BASEDIR="/usr/local" | ||
11 | CLASSES="none" | ||
12 | |||
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 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | $pkgdevice = $ARGV[0] || die "Unable to determine device ($!)\n"; | ||
4 | |||
5 | $find = "/usr/bin/find"; | ||
6 | $pkgproto = "/usr/bin/pkgproto"; | ||
7 | $pkgmk = "/usr/bin/pkgmk"; | ||
8 | $pkgtrans = "/usr/bin/pkgtrans"; | ||
9 | $prototype = "prototype"; | ||
10 | $pkginfo = "pkginfo"; | ||
11 | |||
12 | # Sanity check | ||
13 | |||
14 | $pwd = `pwd`; | ||
15 | if ($pwd =~ '\/usr\/local') { | ||
16 | $pwd = $`; | ||
17 | } | ||
18 | die "Wrong location, please cd to <PKGBASE>/usr/local/ and run again.\n" | ||
19 | if ($pwd eq ""); | ||
20 | |||
21 | open (PREPROTO,"$find . -print |$pkgproto |") || | ||
22 | die "Unable to read prototype information ($!)\n"; | ||
23 | open (PROTO,">$prototype") || | ||
24 | die "Unable to write file prototype ($!)\n"; | ||
25 | print PROTO "i pkginfo=./$pkginfo\n"; | ||
26 | while (<PREPROTO>) { | ||
27 | # Read in the prototype information | ||
28 | chomp; | ||
29 | $thisline = $_; | ||
30 | if ($thisline =~ " prototype " | ||
31 | or $thisline =~ " pkginfo ") { | ||
32 | # Don't do anything as they aren't important | ||
33 | } elsif ($thisline =~ "^[fd] ") { | ||
34 | # Change the ownership of files and directories | ||
35 | ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline; | ||
36 | print PROTO "$dir $none $file $mode bin bin\n"; | ||
37 | } else { | ||
38 | # Symlinks and other stuff should be printed also | ||
39 | print PROTO "$thisline\n"; | ||
40 | } | ||
41 | } | ||
42 | close PROTO; | ||
43 | close PREPROTO; | ||
44 | |||
45 | # Now we can start building the package | ||
46 | |||
47 | $os = `uname -r`; | ||
48 | $os =~ '\.'; | ||
49 | $os = "sol$'"; | ||
50 | chomp $os; | ||
51 | |||
52 | open (PKGINFO,"<$pkginfo") || | ||
53 | die "Unable to read package information ($!)\n"; | ||
54 | while (<PKGINFO>) { | ||
55 | # Read in the package information | ||
56 | chomp; | ||
57 | $thisline = $_; | ||
58 | ($var,$value) = split /=/,$thisline; | ||
59 | if ("$var" eq "NAME" | ||
60 | or "$var" eq "VERSION" | ||
61 | or "$var" eq "ARCH") { | ||
62 | $tmp = lc($var); | ||
63 | $value =~ s/\"//g; | ||
64 | if ("$tmp" eq "version" | ||
65 | and $value =~ ",REV") { | ||
66 | ($value,$var) = split /\,/,$value; | ||
67 | $$tmp = $value; | ||
68 | } else { | ||
69 | $$tmp = $value; | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | close PKGINFO; | ||
74 | |||
75 | $packagename = "$name-$version-$os-$arch-local"; | ||
76 | |||
77 | print "Building package\n"; | ||
78 | system ("$pkgmk -o -r `pwd` -d $pkgdevice"); | ||
79 | system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename)"); | ||
80 | print "Done. ($packagename)\n"; | ||