Project import
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0365ead --- /dev/null +++ b/Makefile
@@ -0,0 +1,139 @@ +# +# Copyright (c) 2010-2013 Nest Labs, Inc. +# All rights reserved. +# +# This document is the property of Nest. It is considered +# confidential and proprietary information. +# +# This document may not be reproduced or transmitted in any form, +# in whole or in part, without the express written permission of +# Nest. +# +# Description: +# This file is the make file for the daemon-monitoring daemon +# (DMD), monit. +# + +BuildConfigSpecialized := No +BuildProductSpecialized := No + +include pre.mak + +PackageName := monit + +PackageExtension := tar.gz +PackageSeparator := - + +PackagePatchArgs := -p1 + +PackageArchive := $(PackageName).$(PackageExtension) +PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion) + +PackageBuildMakefile = $(call GenerateBuildPaths,Makefile) + +PackageBuildConfigure = $(call GenerateBuildPaths,configure) + +LicenseSourceFiles := LICENSE COPYING +LicenseSourcePaths := $(addprefix $(PackageSourceDir)/,$(LicenseSourceFiles)) + +CleanPaths += $(PackageLicenseFile) + +OpenSSLDir := sw/tps/openssl +OpenSSLIncDir := $(call GenerateResultPaths,$(OpenSSLDir),usr/include) +OpenSSLLibDir := $(call GenerateResultPaths,$(OpenSSLDir),usr/lib) + +ZlibDir := sw/tps/zlib +ZlibIncDir := $(call GenerateResultPaths,$(ZlibDir),usr/include) +ZlibLibDir := $(call GenerateResultPaths,$(ZlibDir),usr/lib) + +all: $(PackageDefaultGoal) + +# Generate the package license contents. + +$(LicenseSourcePaths): source + +$(PackageLicenseFile): $(LicenseSourcePaths) + $(Verbose)touch $@ + $(Verbose)for file in $(LicenseSourcePaths); do \ + echo "Concatenating \"$${file}\"..."; \ + cat $${file} >> $@; \ + done + +# Extract the source from the archive and apply patches, if any. + +$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths) + $(expand-and-patch-package) + +# Prepare the sources. + +.PHONY: source +source: | $(PackageSourceDir) + +# Patch the sources, if necessary. + +.PHONY: patch +patch: source + +# Generate the package build configure script by shadowing the source +# tree as a link farm. +# +# This is generally unnecessary for most GNU autoconf-based packages; +# however, monit completely drops the ball on non-colocated builds. + +$(PackageBuildConfigure): | $(PackageSourceDir) $(BuildDirectory) + $(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory)) + +# Generate the package build makefile. + +$(PackageBuildMakefile): $(PackageBuildConfigure) + $(Verbose)cd $(BuildDirectory) && \ + ./configure \ + --config-cache \ + CC="$(CC)" CXX="$(CXX)" AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) NM=$(NM) OBJDUMP=$(OBJDUMP) \ + LDFLAGS="-Wl,-rpath-link -Wl,$(ZlibLibDir)" \ + INSTALL="$(INSTALL) $(INSTALLFLAGS)" \ + libmonit_cv_setjmp_available=yes \ + libmonit_cv_vsnprintf_c99_conformant=yes \ + ac_cv_ipv6=yes \ + --build=$(HostTuple) \ + --host=$(TargetTuple) \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --enable-optimized \ + --with-ssl-incl-dir=$(OpenSSLIncDir) \ + --with-ssl-lib-dir=$(OpenSSLLibDir) \ + --without-pam + +# Configure the source for building. + +.PHONY: configure +configure: source $(PackageBuildMakefile) + +# Build the source. +# +# We have to unset MAKEFLAGS since they confuse the package build otherwise. + +.PHONY: build +build: configure + $(Verbose)unset MAKEFLAGS && \ + $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) all + +# Stage the build to a temporary installation area. +# +# We have to unset MAKEFLAGS since they confuse the package build otherwise. + +.PHONY: stage +stage: build | $(ResultDirectory) + $(Verbose)unset MAKEFLAGS && \ + $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \ + DESTDIR=$(ResultDirectory) \ + MODE_PROGS=775 \ + install + +clean: + $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir) + $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) + $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) + +include post.mak
diff --git a/monit.patches/monit-50.description b/monit.patches/monit-50.description new file mode 100644 index 0000000..16b2b97 --- /dev/null +++ b/monit.patches/monit-50.description
@@ -0,0 +1 @@ +This patch prints out a human reabable string indicating why the preceding fork call failed.
diff --git a/monit.patches/monit-50.patch b/monit.patches/monit-50.patch new file mode 100644 index 0000000..8fb8b7c --- /dev/null +++ b/monit.patches/monit-50.patch
@@ -0,0 +1,12 @@ +diff -aruN a/src/spawn.c b/src/spawn.c +--- a/src/spawn.c 2012-05-06 02:40:45.000000000 -0700 ++++ b/src/spawn.c 2013-03-16 16:31:41.808861381 -0700 +@@ -157,7 +157,7 @@ + + pid= fork(); + if(pid < 0) { +- LogError("Cannot fork a new process\n"); ++ LogError("Cannot fork a new process: %s\n", strerror(errno)); + exit(1); + } +
diff --git a/monit.patches/monit-51.description b/monit.patches/monit-51.description new file mode 100644 index 0000000..3f5d463 --- /dev/null +++ b/monit.patches/monit-51.description
@@ -0,0 +1,4 @@ +Forces a linux reboot if monit ever exits from a failure to fork. + +Monit can unexpected stop (which is pretty lame for a system monitor) if the +system runs out of memory. This patch forces a linux reboot if that happens.
diff --git a/monit.patches/monit-51.patch b/monit.patches/monit-51.patch new file mode 100644 index 0000000..be57788 --- /dev/null +++ b/monit.patches/monit-51.patch
@@ -0,0 +1,66 @@ +diff -aru monit-5.4/src/daemonize.c monit-edited/src/daemonize.c +--- monit-5.4/src/daemonize.c 2012-05-06 02:40:45.000000000 -0700 ++++ monit-edited/src/daemonize.c 2016-01-07 17:54:13.979175325 -0800 +@@ -61,6 +61,7 @@ + #include <string.h> + #endif + ++#include <sys/reboot.h> + #include "monit.h" + + +@@ -93,8 +94,9 @@ + */ + if((pid= fork ()) < 0) { + +- LogError("Cannot fork of a new process\n"); +- exit (1); ++ LogError("Cannot fork of a new process, rebooting\n"); ++ sync(); ++ reboot(RB_AUTOBOOT); + + } + else if(pid != 0) { +@@ -107,8 +109,9 @@ + + if((pid= fork ()) < 0) { + +- LogError("Cannot fork of a new process\n"); +- exit (1); ++ LogError("Cannot fork of a new process, rebooting\n"); ++ sync(); ++ reboot(RB_AUTOBOOT); + + } + else if(pid != 0) { +Only in monit-edited/src: .daemonize.c.swp +diff -aru monit-5.4/src/spawn.c monit-edited/src/spawn.c +--- monit-5.4/src/spawn.c 2016-01-07 14:15:22.132302393 -0800 ++++ monit-edited/src/spawn.c 2016-01-07 17:53:54.130841558 -0800 +@@ -64,10 +64,13 @@ + #include <sys/stat.h> + #endif + ++ + #ifdef HAVE_FCNTL_H + #include <fcntl.h> + #endif + ++#include <sys/reboot.h> ++ + #include "event.h" + #include "alert.h" + #include "monit.h" +@@ -157,8 +160,9 @@ + + pid= fork(); + if(pid < 0) { +- LogError("Cannot fork a new process: %s\n", strerror(errno)); +- exit(1); ++ LogError("Cannot fork a new process, rebooting: %s\n", strerror(errno)); ++ sync(); ++ reboot(RB_AUTOBOOT); + } + + if(pid == 0) { +Only in monit-edited/src: .spawn.c.swp
diff --git a/monit.tar.gz b/monit.tar.gz new file mode 100644 index 0000000..adaafb1 --- /dev/null +++ b/monit.tar.gz Binary files differ
diff --git a/monit.url b/monit.url new file mode 100644 index 0000000..70bfc2f --- /dev/null +++ b/monit.url
@@ -0,0 +1 @@ +http://mmonit.com/monit/dist/monit-5.4.tar.gz
diff --git a/monit.version b/monit.version new file mode 100644 index 0000000..37c2d99 --- /dev/null +++ b/monit.version
@@ -0,0 +1 @@ +5.4