diff --git a/0001-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch b/0001-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch new file mode 100644 index 0000000..0e1b64b --- /dev/null +++ b/0001-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch @@ -0,0 +1,266 @@ +From 2790065efcf484d5b51e2f5ab410983d9f37c74c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= +Date: Fri, 11 Apr 2014 09:25:05 +0200 +Subject: [PATCH] Simplify and fix parsing of /etc/SuSE-release (fixes issue + #5423) + +This patch is a simplification of sysinfo.c:Linux_Suse_Version() +to achieve the following + +- distinction between "SUSE Linux Enterprise Server" (sles) and "... Desktop" (sled) +- distinction between SUSE Linux Enterprise products (suse) and openSUSE (opensuse) +- extract version from VERSION and PATCHLEVEL lines instead of + first line of /etc/SuSE-release +- verified for sles version 9,10,11,12; sled versions 10,11,12, openSUSE 13.1 +--- + libenv/sysinfo.c | 187 ++++++++++++++++++------------------------------------- + 1 file changed, 60 insertions(+), 127 deletions(-) + +diff --git a/libenv/sysinfo.c b/libenv/sysinfo.c +index 72eb71f75d8d..6f2a05fc4cdd 100644 +--- a/libenv/sysinfo.c ++++ b/libenv/sysinfo.c +@@ -1629,6 +1629,7 @@ static int Linux_Suse_Version(EvalContext *ctx) + #define SUSE_RELEASE_FLAG "linux " + + char classbuf[CF_MAXVARSIZE]; ++ char *vendor = "suse"; + + Log(LOG_LEVEL_VERBOSE, "This appears to be a SUSE system."); + EvalContextClassPutHard(ctx, "SUSE", "inventory,attribute_name=none,source=agent"); +@@ -1648,23 +1649,26 @@ static int Linux_Suse_Version(EvalContext *ctx) + return 1; + } + +- char vbuf[CF_BUFSIZE], strversion[CF_MAXVARSIZE], strpatch[CF_MAXVARSIZE]; +- strversion[0] = '\0'; +- strpatch[0] = '\0'; ++ char vbuf[CF_BUFSIZE]; + + int major = -1, minor = -1; + while (fgets(vbuf, sizeof(vbuf), fp) != NULL) + { + if (strncmp(vbuf, "VERSION", strlen("version")) == 0) + { +- strlcpy(strversion, vbuf, sizeof(strversion)); +- sscanf(vbuf, "VERSION = %d", &major); ++ int res; ++ res = sscanf(vbuf, "VERSION = %d.%d", &major, &minor); ++ Log(LOG_LEVEL_VERBOSE, "VERSION sscanf returned %d.", res); ++ if (res < 1) ++ major = -1; ++ else if (res < 2) ++ minor = -1; + } + + if (strncmp(vbuf, "PATCH", strlen("PATCH")) == 0) + { +- strlcpy(strpatch, vbuf, sizeof(strpatch)); +- sscanf(vbuf, "PATCHLEVEL = %d", &minor); ++ if (sscanf(vbuf, "PATCHLEVEL = %d", &minor) != 1) ++ minor = -1; + } + } + if (ferror(fp)) +@@ -1678,28 +1682,38 @@ static int Linux_Suse_Version(EvalContext *ctx) + + fclose(fp); + +- /* Check if it's a SUSE Enterprise version */ ++ /* Check which SUSE/openSUSE product it is */ + +- Log(LOG_LEVEL_VERBOSE, "Looking for SUSE enterprise info in '%s'", relstring); ++ Log(LOG_LEVEL_VERBOSE, "Looking for SUSE product info in '%s'", relstring); + +- /* Convert relstring to lowercase to handle rename of SuSE to +- * SUSE with SUSE 10.0. +- */ +- +- for (int i = 0; i < strlen(relstring); i++) ++ if (!strncasecmp(relstring, SUSE_SLES8_ID, strlen(SUSE_SLES8_ID))) + { +- relstring[i] = tolower(relstring[i]); ++ EvalContextClassPutHard(ctx, "SLES8", "inventory,attribute_name=none,source=agent"); + } +- +- /* Check if it's a SUSE Enterprise version (all in lowercase) */ +- +- if (!strncmp(relstring, SUSE_SLES8_ID, strlen(SUSE_SLES8_ID))) ++ else if (!strncasecmp(relstring, SUSE_SLES_ID, strlen(SUSE_SLES_ID))) + { +- classbuf[0] = '\0'; +- strcat(classbuf, "SLES8"); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); ++ EvalContextClassPutHard(ctx, "sles", "inventory,attribute_name=none,source=agent"); ++ if (major != -1) ++ { ++ snprintf(classbuf, CF_MAXVARSIZE, "SLES%d", major); ++ EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); ++ } ++ } ++ else if (!strncasecmp(relstring, SUSE_SLED_ID, strlen(SUSE_SLED_ID))) ++ { ++ EvalContextClassPutHard(ctx, "sled", "inventory,attribute_name=none,source=agent"); ++ if (major != -1) ++ { ++ snprintf(classbuf, CF_MAXVARSIZE, "SLED%d", major); ++ EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); ++ } ++ } ++ else if (!strncasecmp(relstring, "opensuse", strlen("opensuse"))) ++ { ++ vendor = "opensuse"; ++ EvalContextClassPutHard(ctx, vendor, "inventory,attribute_name=none,source=agent"); + } +- else if (strncmp(relstring, "sles", 4) == 0) ++ else if (strncasecmp(relstring, "sles", 4) == 0) + { + Item *list, *ip; + +@@ -1717,120 +1731,39 @@ static int Linux_Suse_Version(EvalContext *ctx) + } + else + { +- for (int version = 9; version < 13; version++) +- { +- snprintf(vbuf, CF_BUFSIZE, "%s %d ", SUSE_SLES_ID, version); +- Log(LOG_LEVEL_DEBUG, "Checking for SUSE [%s]", vbuf); +- +- if (!strncmp(relstring, vbuf, strlen(vbuf))) +- { +- snprintf(classbuf, CF_MAXVARSIZE, "SLES%d", version); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- } +- else +- { +- snprintf(vbuf, CF_BUFSIZE, "%s %d ", SUSE_SLED_ID, version); +- Log(LOG_LEVEL_DEBUG, "Checking for SUSE [%s]", vbuf); +- +- if (!strncmp(relstring, vbuf, strlen(vbuf))) +- { +- snprintf(classbuf, CF_MAXVARSIZE, "SLED%d", version); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- } +- } +- } ++ Log(LOG_LEVEL_WARNING, "Unknown product '%s' in /etc/SuSE-release", relstring); + } + +- /* Determine release version. We assume that the version follows +- * the string "SuSE Linux" or "SUSE LINUX". +- */ +- +- char *release = strstr(relstring, SUSE_RELEASE_FLAG); +- if (release == NULL) ++ if (major != -1) + { +- release = strstr(relstring, "opensuse"); +- if (release == NULL) ++ strncpy(classbuf, vendor, CF_MAXVARSIZE); ++ EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); ++ snprintf(classbuf + strlen(classbuf), CF_MAXVARSIZE - strlen(classbuf), "_%d", major); ++ SetFlavour(ctx, classbuf); ++ if (minor != -1) + { +- release = strversion; ++ snprintf(classbuf + strlen(classbuf), CF_MAXVARSIZE - strlen(classbuf), "_%d", minor); ++ EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); + } +- } +- +- if (release == NULL) +- { +- Log(LOG_LEVEL_VERBOSE, +- "Could not find a numeric OS release in %s", +- SUSE_REL_FILENAME); +- return 2; ++ /* The correct spelling for SUSE is "SUSE" but CFEngine used to use "SuSE". ++ * Keep this for backwards compatibility until CFEngine 3.7 ++ */ ++ strncpy(classbuf, "SuSE", CF_MAXVARSIZE); ++ EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); ++ snprintf(classbuf + strlen(classbuf), CF_MAXVARSIZE - strlen(classbuf), "_%d", major); ++ EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); ++ if (minor != -1) ++ { ++ snprintf(classbuf + strlen(classbuf), CF_MAXVARSIZE - strlen(classbuf), "_%d", minor); ++ EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); ++ } ++ Log(LOG_LEVEL_VERBOSE, "Discovered %s version %d.%d", vendor, major, minor); + } + else + { +- char strmajor[PRINTSIZE(major)], strminor[PRINTSIZE(minor)]; +- if (strchr(release, '.')) +- { +- sscanf(release, "%*s %d.%d", &major, &minor); +- sprintf(strmajor, "%d", major); +- sprintf(strminor, "%d", minor); +- +- if (major != -1 && minor != -1) +- { +- strcpy(classbuf, "SUSE"); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- strcat(classbuf, "_"); +- strcat(classbuf, strmajor); +- SetFlavour(ctx, classbuf); +- strcat(classbuf, "_"); +- strcat(classbuf, strminor); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- +- /* The correct spelling for SUSE is "SUSE" but CFEngine used to use "SuSE". +- * Keep this for backwards compatibility until CFEngine 3.7 +- */ +- strcpy(classbuf, "SuSE"); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- strcat(classbuf, "_"); +- strcat(classbuf, strmajor); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- strcat(classbuf, "_"); +- strcat(classbuf, strminor); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- +- Log(LOG_LEVEL_VERBOSE, "Discovered SUSE version %s", classbuf); +- return 0; +- } +- } +- else +- { +- sscanf(strversion, "VERSION = %s", strmajor); +- sscanf(strpatch, "PATCHLEVEL = %s", strminor); +- +- if (major != -1 && minor != -1) +- { +- strcpy(classbuf, "SLES"); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- strcat(classbuf, "_"); +- strcat(classbuf, strmajor); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- strcat(classbuf, "_"); +- strcat(classbuf, strminor); +- EvalContextClassPutHard(ctx, classbuf, "inventory,attribute_name=none,source=agent"); +- +- snprintf(classbuf, CF_MAXVARSIZE, "SUSE_%d", major); +- SetFlavour(ctx, classbuf); +- +- /* The correct spelling for SUSE is "SUSE" but CFEngine used to use "SuSE". +- * Keep this for backwards compatibility until CFEngine 3.7 +- */ +- snprintf(classbuf, CF_MAXVARSIZE, "SuSE_%d", major); +- EvalContextClassPutHard(ctx, classbuf, "source=agent"); +- +- Log(LOG_LEVEL_VERBOSE, "Discovered SUSE version %s", classbuf); +- return 0; +- } +- } ++ Log(LOG_LEVEL_VERBOSE, "Could not find a numeric OS release in %s", SUSE_REL_FILENAME); + } + +- Log(LOG_LEVEL_VERBOSE, "Could not find a numeric OS release in %s", SUSE_REL_FILENAME); +- + return 0; + } + +-- +1.8.4.5 + diff --git a/cf-execd.service b/cf-execd.service index 9c77067..0336159 100644 --- a/cf-execd.service +++ b/cf-execd.service @@ -3,6 +3,7 @@ Description=CFEngine Execution Daemon After=syslog.target [Service] +Type=forking ExecStart=/usr/sbin/cf-execd [Install] diff --git a/cf-monitord.service b/cf-monitord.service index 5d2670c..34db31b 100644 --- a/cf-monitord.service +++ b/cf-monitord.service @@ -3,6 +3,7 @@ Description=CFEngine Monitoring Daemon After=syslog.target [Service] +Type=forking ExecStart=/usr/sbin/cf-monitord [Install] diff --git a/cf-serverd.service b/cf-serverd.service index c112715..13d236c 100644 --- a/cf-serverd.service +++ b/cf-serverd.service @@ -3,6 +3,7 @@ Description=CFEngine Server Daemon After=syslog.target [Service] +Type=forking ExecStart=/usr/sbin/cf-serverd [Install] diff --git a/cfengine-3.5.3.tar.gz b/cfengine-3.5.3.tar.gz deleted file mode 100644 index 71f14be..0000000 --- a/cfengine-3.5.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0e2d13ba1d75f826bf15411912ce21075734796a35e8fb8ecf545d70d60f41e1 -size 1542468 diff --git a/cfengine.SuSEfirewall2 b/cfengine.SuSEfirewall2 new file mode 100644 index 0000000..decd296 --- /dev/null +++ b/cfengine.SuSEfirewall2 @@ -0,0 +1,6 @@ +## Name: CFEngine server +## Description: opens ports for CFEngine server in order to be used as a policy hub + +# space separated list of allowed ports +TCP="5308" + diff --git a/cfengine.changes b/cfengine.changes index 25e4b03..0f0949f 100644 --- a/cfengine.changes +++ b/cfengine.changes @@ -1,3 +1,114 @@ +------------------------------------------------------------------- +Fri Apr 11 07:32:08 UTC 2014 - kkaempf@suse.com + +- Upgrade to 3.6.0rc + Bugfix release + Full ChangeLog at https://raw.githubusercontent.com/cfengine/core/3.6.x/ChangeLog + +------------------------------------------------------------------- +Thu Apr 10 14:02:11 UTC 2014 - kkaempf@suse.com + +- add 0001-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch + * add 'suse' class for consistency with other vendor classes + (fixes #5417) + * distinction between "SUSE Linux Enterprise Server" (sles) and + "... Desktop" (sled) + * distinction between SUSE Linux Enterprise products (suse) and + openSUSE (opensuse) + * extract version from VERSION and PATCHLEVEL lines instead of + first line of /etc/SuSE-release + +------------------------------------------------------------------- +Fri Apr 4 19:36:47 UTC 2014 - kkaempf@suse.com + +- merge cfengine-server with cfengine. A policy server only + gets cfengine-masterfiles but is otherwise identical to + a client. + +------------------------------------------------------------------- +Thu Apr 3 13:10:56 UTC 2014 - kkaempf@suse.com + +- install cfengine.SuSEfirewall2 + +------------------------------------------------------------------- +Thu Apr 3 12:41:44 UTC 2014 - kkaempf@suse.com + +- install cfengine-masterfiles together with cfengine-server only. + A cfengine client will get the masterfiles from the server. + +------------------------------------------------------------------- +Wed Apr 2 13:14:34 UTC 2014 - kkaempf@suse.com + +- clean up /var/cfengine/inputs cache on removal. + +------------------------------------------------------------------- +Wed Mar 26 16:08:16 UTC 2014 - kkaempf@suse.com + +- remove '.unknown' from reported version + add drop-revision.patch + +------------------------------------------------------------------- +Wed Mar 26 08:24:00 UTC 2014 - kkaempf@suse.com + +- Fix all .service files, type is forking. + +------------------------------------------------------------------- +Tue Mar 18 11:30:23 UTC 2014 - kkaempf@suse.com + +- Update to 3.6.0b2 + - performance has been significantly improved, with a 10-20% speed + increase over 3.5 when using the default masterfiles + - agents support the legacy protocol without TLS envelope + This allows upgrading of an agent before the policy server. + - several general improvements and bug fixes too numerous to list + here. + +- remove cfengine-bootstrap.patch, included upstream + +- split masterfiles off as cfengine-masterfiles package + +------------------------------------------------------------------- +Tue Mar 18 10:20:55 UTC 2014 - aeszter@gwdg.de + +- fix build for RHEL + * MySQL connector: disabled + * docs go into versioned directory + +------------------------------------------------------------------- +Thu Feb 20 23:54:22 UTC 2014 - chris@computersalat.de + +- merge with my last (not committed changes) + * bootstrap patch +- fix changes file + * update 3.0.4b2 -> 3.4.0b2 +- fix docs install +- fix build for SLE_11 (MySQL connector: disabled) + +------------------------------------------------------------------- +Sun Feb 9 12:02:45 UTC 2014 - kkaempf@suse.com + +- use lmdb instead of tokyocabinet +- add primer.pdf + +------------------------------------------------------------------- +Tue Feb 4 07:10:49 UTC 2014 - kkaempf@suse.com + +- split off -examples sub-package + +------------------------------------------------------------------- +Mon Feb 3 18:30:23 UTC 2014 - kkaempf@suse.com + +- Upgrade to 3.6.0b1 + - New promise type "users" for managing local user accounts. + - TLS authentication and fully encrypted network protocol + - New attributes in 'bundle server access_rules' + - New variable type 'data' for handling of structured data + - Tagging of classes and variables with meta data + - Many new built-in variables + - Many new functions + + - Replace tokyocabinet with lmdb database + ------------------------------------------------------------------- Wed Dec 11 07:25:59 UTC 2013 - kkaempf@suse.com @@ -277,7 +388,7 @@ Thu Oct 4 08:48:10 UTC 2012 - kkaempf@suse.com - support systemd where applicable -- update to 3.0.4b2 +- update to 3.4.0b2 New features: - XML editing capabilities. See the documentation for edit_xml body. Note the new dependency: libxml2. @@ -316,6 +427,12 @@ Thu Oct 4 08:48:10 UTC 2012 - kkaempf@suse.com easier to run from systemd, launchd and other supervision systems. +------------------------------------------------------------------- +Wed Mar 7 13:02:30 UTC 2012 - chris@computersalat.de + +- add bootstrap patch + * set correct "workdir" + ------------------------------------------------------------------- Wed Feb 15 13:49:18 UTC 2012 - chris@computersalat.de diff --git a/cfengine.spec b/cfengine.spec index a4b9c71..f3a34bb 100644 --- a/cfengine.spec +++ b/cfengine.spec @@ -1,7 +1,7 @@ # # spec file for package cfengine # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,6 +17,7 @@ Name: cfengine +%define srcname core %define libname libpromises %define libsoname %{libname}3 @@ -24,25 +25,19 @@ Name: cfengine # reported upstream as https://cfengine.com/dev/issues/1896 %define basedir /var/%{name} %define workdir %{basedir} +# This is the place where workdir should be +#define basedir /var/lib/%{name} +#define workdir %{basedir}/work Summary: CFEngine automates large-scale IT computing infrastructure License: GPL-3.0 Group: Productivity/Networking/System -Version: 3.5.3 +Version: 3.6rc Release: 0 Url: http://www.cfengine.org/ -Source: %{name}-%{version}.tar.gz -# there's no /usr/include/acl.h in SUSE or Fedora, kkaempf@suse.de -Patch1: libacl-headers.patch -# SLE 11 or RHEL5 autoconf does not support AM_SUBST_NOTMAKE, kkaempf@suse.de -Patch2: remove-am_subst_notmake.patch +Source: %{srcname}-%{version}.tar.gz +Source1: %{name}.SuSEfirewall2 -Source1: http://www.cfengine.org/manuals/cf3-Reference.pdf -Source2: http://www.cfengine.org/manuals/cf3-conceptguide.pdf -Source3: http://www.cfengine.org/manuals/cf3-glossary.pdf -Source4: http://www.cfengine.org/manuals/cf3-quickstart.pdf -Source5: http://www.cfengine.org/manuals/cf3-solutions.pdf -Source6: http://www.cfengine.org/manuals/cf3-tutorial.pdf # wtf? SLE_11 does not honor rpmlintrc %if 0%{?suse_version} <= 1130 BuildRequires: -post-build-checks @@ -58,13 +53,35 @@ Source9: cf-serverd %endif Source10: %{name}.cron Source11: %{name}-rpmlintrc + +# docs +Source101: http://www.cfengine.org/manuals/cf3-Reference.pdf +Source102: http://www.cfengine.org/manuals/cf3-conceptguide.pdf +Source103: http://www.cfengine.org/manuals/cf3-glossary.pdf +Source104: http://www.cfengine.org/manuals/cf3-quickstart.pdf +Source105: http://www.cfengine.org/manuals/cf3-solutions.pdf +Source106: http://www.cfengine.org/manuals/cf3-tutorial.pdf +Source107: http://www.verticalsysadmin.com/cfengine/primer.pdf + +# SLE 11 or RHEL5 autoconf does not support AM_SUBST_NOTMAKE, kkaempf@suse.de +Patch2: remove-am_subst_notmake.patch + +# drop revision from configure.ac, autotools will evaluate it as 'unkwown' +# kkaempf@suse.de +Patch3: drop-revision.patch + +# PATCH-FIX-UPSTREAM add 'suse' class for consistency with other vendor classes +# PATCH-FEATURE-UPSTREAM better /etc/SuSE-release parsing, upstream #5423 +Patch5: 0001-Simplify-and-fix-parsing-of-etc-SuSE-release-fixes-i.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: bison BuildRequires: db-devel BuildRequires: flex -BuildRequires: libtokyocabinet-devel BuildRequires: libtool BuildRequires: libxml2-devel +BuildRequires: lmdb-devel +BuildRequires: pam-devel # # Disable mysql for SLE_11: # @@ -73,7 +90,7 @@ BuildRequires: libxml2-devel # library or disable MySQL connector. See # http://bugs.mysql.com/bug.php?id=65055 for details. # -%if 0%{?suse_version} != 1110 +%if 0%{?suse_version} != 1110 && 0%{?rhel_version} == 0 BuildRequires: mysql-devel %endif BuildRequires: libacl-devel @@ -101,6 +118,8 @@ BuildRequires: systemd BuildRequires: fdupes %endif +Requires: %{libsoname} = %{version} + %description CFEngine is the core of a configuration management system: ensuring the availability, security and compliance of mission-critical @@ -114,8 +133,8 @@ impact on system resources or performance. %package -n %{libsoname} Summary: Shared library of cfengine Group: System/Libraries -Provides: %{libname}1 -Obsoletes: %{libname}1 +Provides: %{libname}1 = %{version} +Obsoletes: %{libname}1 < %{version} %if 0%{?suse_version} == 1010 Requires: glibc %endif @@ -126,7 +145,7 @@ This package contains the shared libpromises (cfengine) library. %package -n %{libname}-devel Summary: Development package for libpromises Group: Development/Libraries/C and C++ -Provides: %{name}-devel < %{version} +Provides: %{name}-devel = %{version} Obsoletes: %{name}-devel < %{version} Requires: %{libsoname} = %{version} Requires: glibc-devel @@ -139,7 +158,7 @@ libpromises library. %package doc Summary: CFEngine automates large-scale IT computing infrastructure - documentation -Group: Productivity/Networking/System +Group: Documentation/Other %if 0%{?rhel_version} || 0%{?centos_version} BuildRequires: tetex BuildRequires: tetex-dvips @@ -150,26 +169,23 @@ BuildRequires: texinfo %description doc Full documentation for cfengine -%package server -Summary: CFEngine automates large-scale IT computing infrastructure - server -Group: Productivity/Networking/System -Requires: %{name} = %{version}-%{release} - -%description server -This package contains the files of the cfengine server. +%package examples +Summary: CFEngine example promises +Group: Documentation/Other +%description examples +Lots of examples promises for CFEngine. %prep -%setup -q -n %{name}-%{version} -%if 0%{?suse_version} || 0%{?fedora_version} || 0%{?rhel_version} -%patch1 -p1 -%endif -%if 0%{?suse_version} > 0 && 0%{?suse_version} <= 1110 +%setup -q -n %{srcname}-%{version} +%if 0%{?suse_version} <= 1110 %patch2 -p1 %endif %if 0%{?rhel_version} >= 500 && 0%{?rhel_version} < 600 %patch2 -p1 %endif +%patch3 -p1 +%patch5 -p1 ##### rpmlint #### wrong-file-end-of-line-encoding @@ -177,25 +193,36 @@ This package contains the files of the cfengine server. ### http://www.fsf.org/about/contact/ find ./examples -type f -name "*.cf" -exec perl -p -i -e 's|\r\n|\n|,s|^# Foundation.*|# Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA|' {} \; +### install extra docs +%{__install} -d docs +cp -a $RPM_SOURCE_DIR/*pdf docs/ + %build -autoreconf -fi +autoreconf -fi -I m4 # /usr/include/sys for acl.h CC=gcc CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \ %configure \ --disable-static \ --enable-fhs \ - --with-libxml2 \ --datadir=/var \ --with-workdir=%{workdir} \ --with-postgresql \ +%if 0%{?suse_version} != 1110 && 0%{?rhel_version} == 0 && 0%{?fedora_version} != 20 + --with-mysql \ +%endif + --without-qdbm \ + --without-tokyocabinet \ + --with-lmdb \ --with-pthreads \ --with-openssl \ --with-pcre \ --with-libvirt \ --with-libacl \ --with-libxml2 \ -%if 0%{?suse_version} >= 1110 || 0%{?rhel_version} >= 600 +%if 0%{?suse_version} >= 1110 --docdir=%{_docdir}/%{name} +%else if 0%{?rhel_version} >= 600 + --docdir=%{_docdir}/%{name}-%{version} %endif # SLE 10 and RHEL5 don't recognize --docdir @@ -211,10 +238,16 @@ chmod -x ChangeLog [ -d %{buildroot} ] && [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} %endif %{__make} "DESTDIR=%{buildroot}" install + +%if 0%{?suse_version} >= 1110 || 0%{?rhel_version} >= 600 +# will appear in cfengine-examples +rm -rf %{buildroot}/%{_docdir}/%{name}/examples +%endif + %{__install} -d %{buildroot}/{usr/sbin,%{workdir}/{bin,inputs,reports}} # create dirs needed for better organizing dirs and files -%{__install} -d %{buildroot}/%{basedir}/{backup,failsafe,config} +%{__install} -d %{buildroot}/%{basedir}/{backup,failsafe,config,plugins} #%%{__install} -d %{buildroot}/%%{basedir}/config/{development,production} # install cron file @@ -239,28 +272,30 @@ sed -i\ %{buildroot}/etc/init.d/cf-* %{buildroot}/etc/cron.d/%{name} %endif -# install docs -%{__install} -d %{buildroot}/%{_datadir}/doc/%{name} -%{__install} -m 0644 %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} %{S:6} %{buildroot}/%{_datadir}/doc/%{name} - # create symlinks for sbin_PROGRAMS # because: cf-promises needs to be installed in /var/cfengine/work/bin for pre-validation of full configuration -for i in cf-agent cf-execd cf-key cf-monitord cf-promises cf-runagent cf-serverd; do +for i in cf-agent cf-execd cf-key cf-monitord cf-promises cf-runagent cf-serverd cf-upgrade; do %{__ln_s} -f ../../..%{_sbindir}/${i} %{buildroot}%{workdir}/bin/${i} done -# Install masterfiles (as %%config(noreplace) ) -%{__install} -d %{buildroot}/%{basedir}/masterfiles -%{__install} -m 0644 masterfiles/def.cf %{buildroot}/%{basedir}/masterfiles -%{__install} -m 0644 masterfiles/promises.cf %{buildroot}/%{basedir}/masterfiles -%{__install} -m 0644 masterfiles/libraries/cfengine_stdlib.cf %{buildroot}/%{basedir}/masterfiles - rm -rf %{buildroot}/%{_libdir}/%{name}/libpromises.la # will appear in %%docdir rm -rf %{buildroot}/%{_datadir}/%{name}/ChangeLog rm -rf %{buildroot}/%{_datadir}/%{name}/README +# create man pages, see https://cfengine.com/dev/issues/2989 +%{__install} -d %{buildroot}/%{_mandir}/man8 +for i in cf-agent cf-execd cf-key cf-monitord cf-promises cf-runagent cf-serverd +do + LD_LIBRARY_PATH=%{buildroot}%{_libdir}/%{name} %{buildroot}%{_sbindir}/$i -M > %{buildroot}%{_mandir}/man8/$i.8 + gzip %{buildroot}%{_mandir}/man8/$i.8 +done + +%if 0%{?suse_version} > 1010 +install -D -m 644 %{S:1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/cfengine +%endif + %if 0%{?suse_version} > 01020 %fdupes %{buildroot}/usr/share/cfengine %endif @@ -268,55 +303,53 @@ rm -rf %{buildroot}/%{_datadir}/%{name}/README # systemd %if 0%{?suse_version} >= 1210 +#################################################################### +# Systemd +#################################################################### + %pre -%service_add_pre cf-execd.service cf-monitord.service +%service_add_pre cf-execd.service cf-monitord.service cf-serverd.service %post -%service_add_post cf-execd.service cf-monitord.service +%service_add_post cf-execd.service cf-monitord.service cf-serverd.service %if 0%{?suse_version} > 1010 %install_info --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz %endif /sbin/ldconfig if [ $1 -lt 2 ]; then + # first install, generate key pair cf-key fi %preun -%service_del_preun cf-execd.service cf-monitord.service +%service_del_preun cf-execd.service cf-monitord.service cf-serverd.service %postun -%service_del_postun cf-execd.service cf-monitord.service +%service_del_postun cf-execd.service cf-monitord.service cf-serverd.service %if 0%{?suse_version} > 1010 %install_info_delete --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz %endif +if [ $1 -eq 0 ]; then + # clean up inputs cache dir on removal + rm -rf %{basedir}/inputs/* +fi /sbin/ldconfig -%pre server -%service_add_pre cf-serverd.service - -%post server -if [ ${1:-0} -ne 1 ]; then - cp -a /usr/share/cfengine/CoreBase/controls /var/cfengine/inputs - cp -a /usr/share/cfengine/CoreBase/libraries /var/cfengine/inputs - cp -a /usr/share/cfengine/CoreBase/services /var/cfengine/inputs -fi -%service_add_post cf-serverd.service - -%preun server -%service_del_preun cf-serverd.service - -%postun server -%service_del_postun cf-serverd.service - %else # !systemd +#################################################################### +# Non-systemd +#################################################################### + %preun %if 0%{?suse_version} %stop_on_removal cf-monitord %stop_on_removal cf-execd +%stop_on_removal cf-serverd %else /etc/init.d/cf-execd stop /etc/init.d/cf-monitord stop +/etc/init.d/cf-serverd stop %endif %post @@ -329,13 +362,13 @@ fi %if 0%{?suse_version} > 1010 %install_info_delete --name=%{name} --info-dir=%{_infodir} %{_infodir}/cf3-reference.info.gz %insserv_cleanup - for i in execd monitord; do + for i in execd monitord serverd; do %restart_on_update cf-${i} done %else # Update ? if [ ${1:-0} -eq 1 ]; then - for i in execd monitord; do + for i in execd monitord serverd; do /etc/init.d/cf-${i} restart done else @@ -344,25 +377,6 @@ fi %endif /sbin/ldconfig -%preun server -%if 0%{?suse_version} -%stop_on_removal cf-serverd -%else -/etc/init.d/cf-serverd stop -%endif - -%postun server -%if 0%{?suse_version} -%restart_on_update cf-serverd -%else - # Update ? - if [ ${1:-0} -eq 1 ]; then - /etc/init.d/cf-serverd restart - else -: - fi -%endif - %endif # !systemd %post -n %{libsoname} -p /sbin/ldconfig @@ -371,45 +385,38 @@ fi %files %defattr(-,root,root) -%doc LICENSE -# %doc README -%doc ChangeLog +%doc ChangeLog LICENSE README.md %{_sbindir}/cf-agent %{_sbindir}/cf-execd %{_sbindir}/cf-key %{_sbindir}/cf-monitord %{_sbindir}/cf-promises +%{_sbindir}/cf-serverd +%{_sbindir}/cf-upgrade %{_sbindir}/cf-runagent %{_sbindir}/rpmvercmp %if 0%{?suse_version} >= 1210 %_unitdir/cf-execd.service %_unitdir/cf-monitord.service +%_unitdir/cf-serverd.service %else -%exclude /etc/init.d/cf-serverd %config %attr(0755,root,root) /etc/init.d/* %{_sbindir}/rccf-execd %{_sbindir}/rccf-monitord +%{_sbindir}/rccf-serverd +%endif +%if 0%{?suse_version} > 1010 +%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/cfengine %endif -# %{_mandir}/man?/* +%{_mandir}/man8/* %dir %{basedir} -/var/%{name} -%exclude %{basedir}/backup -%exclude %{basedir}/config -#%%exclude %%{basedir}/failsafe - -%dir %{_datadir}/%{name} -%{_datadir}/%{name}/* %dir %{workdir} %{workdir}/* -%exclude %{workdir}/bin/cf-serverd %config(noreplace) /etc/cron.d/%{name} -%dir %{basedir}/masterfiles -%config(noreplace) %{basedir}/masterfiles/*.cf - %files -n %{libsoname} %defattr(-,root,root) %dir %{_libdir}/%{name} @@ -421,20 +428,10 @@ fi %files doc %defattr(-,root,root) -%dir %{_datadir}/doc/%{name} -%{_datadir}/doc/%{name}/* +%doc docs/*.pdf -%files server +%files examples %defattr(-,root,root) -%{basedir}/backup -%{basedir}/config -%{_sbindir}/cf-serverd -%{workdir}/bin/cf-serverd -%if 0%{?suse_version} >= 1210 -%_unitdir/cf-serverd.service -%else -/etc/init.d/cf-serverd -%{_sbindir}/rccf-serverd -%endif +%doc examples/*cf %changelog diff --git a/core-3.6rc.tar.gz b/core-3.6rc.tar.gz new file mode 100644 index 0000000..5f915b5 --- /dev/null +++ b/core-3.6rc.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2128b34f6cf4a3d8a3a7b8f2f31c8f7d818a15dc4445e44623e4ef0c961cbbdc +size 1412258 diff --git a/drop-revision.patch b/drop-revision.patch new file mode 100644 index 0000000..77c3e35 --- /dev/null +++ b/drop-revision.patch @@ -0,0 +1,12 @@ +diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-core-3.6rc/configure.ac ./configure.ac +--- ../orig-core-3.6rc/configure.ac 2014-04-10 14:27:57.000000000 +0200 ++++ ./configure.ac 2014-04-11 09:30:17.105777237 +0200 +@@ -25,7 +25,7 @@ + dnl + + _AM_SET_OPTION([tar-ustar]) +-AM_INIT_AUTOMAKE(cfengine, 3.6.0rc.revision) ++AM_INIT_AUTOMAKE(cfengine, 3.6.0rc) + AM_MAINTAINER_MODE([enable]) + + AC_DEFINE(BUILD_YEAR, esyscmd([date +%Y | tr -d '\n']), "Software build year") diff --git a/libacl-headers.patch b/libacl-headers.patch deleted file mode 100644 index 49fd5af..0000000 --- a/libacl-headers.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-cfengine-3.5.0/configure.ac ./configure.ac ---- ../orig-cfengine-3.5.0/configure.ac 2013-06-12 15:09:56.000000000 +0200 -+++ ./configure.ac 2013-07-09 09:11:22.387724353 +0200 -@@ -350,7 +350,7 @@ - if test "x$with_libacl" != xno; then - CF3_WITH_LIBRARY(libacl, [ - AC_CHECK_LIB(acl, acl_init, [], [if test "x$with_libacl" != xcheck; then AC_MSG_ERROR(Cannot find libacl library); fi]) -- AC_CHECK_HEADERS([acl.h sys/acl.h acl/libacl.h], [], [if test "x$with_libacl" != xcheck; then AC_MSG_ERROR(Cannot find libacl library headers); fi]) -+ AC_CHECK_HEADERS([sys/acl.h acl/libacl.h], [], [if test "x$with_libacl" != xcheck; then AC_MSG_ERROR(Cannot find libacl library headers); fi]) - ]) - fi - diff --git a/primer.pdf b/primer.pdf new file mode 100644 index 0000000..e026b4d --- /dev/null +++ b/primer.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf1a0385d355136810cd278ab70033c7402fc31437c763305c1836f7690813ad +size 23415