Solaris package build system

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@449 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
Jeremy T. Bouse 2003-03-23 07:01:20 +00:00
parent c9d73535b5
commit 739ea144d2
6 changed files with 114 additions and 31 deletions

View file

@ -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)

View file

@ -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 && {

View file

@ -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])

View file

@ -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)

12
pkg/solaris/pkginfo.in Normal file
View file

@ -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"

80
pkg/solaris/solpkg Executable file
View file

@ -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";