michael@562: ## michael@562: ## cfengine.spec -- OpenPKG RPM Package Specification michael@562: ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. michael@562: ## michael@562: ## Permission to use, copy, modify, and distribute this software for michael@562: ## any purpose with or without fee is hereby granted, provided that michael@562: ## the above copyright notice and this permission notice appear in all michael@562: ## copies. michael@562: ## michael@562: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@562: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@562: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@562: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@562: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@562: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@562: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@562: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@562: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@562: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@562: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@562: ## SUCH DAMAGE. michael@562: ## michael@562: michael@562: # package information michael@562: Name: cfengine michael@562: Summary: Automated System Administration Tool michael@562: URL: http://www.cfengine.org/ michael@562: Vendor: Oslo University College, Norway michael@562: Packager: OpenPKG Foundation e.V. michael@562: Distribution: OpenPKG Community michael@562: Class: BASE michael@562: Group: System michael@562: License: GPL michael@563: Version: 3.3.5 michael@563: Release: 20120800 michael@562: michael@562: # package options michael@562: %option with_fsl yes michael@562: michael@562: # list of sources michael@562: Source0: http://cfengine.com/source-code/download?file=cfengine-%{version}.tar.gz michael@562: Source1: rc.cfengine michael@562: Source2: fsl.cfengine michael@562: michael@562: # build information michael@563: BuildPreReq: OpenPKG, openpkg >= 20100101, bison, flex, make, gcc, pkgconfig michael@562: PreReq: OpenPKG, openpkg >= 20100101 michael@563: BuildPreReq: tokyocabinet, openssl, pcre michael@563: PreReq: tokyocabinet, openssl, pcre michael@562: %if "%{with_fsl}" == "yes" michael@562: BuildPreReq: fsl michael@562: PreReq: fsl michael@562: %endif michael@562: michael@562: %description michael@562: Cfengine is a tool for setting up and maintaining BSD and System-5-like michael@562: operating system optionally attached to a TCP/IP network. You can think michael@562: of cfengine as a very high level language, much higher level than Perl michael@562: or shell: a single statement can result in many hundreds of operations michael@562: being performed on multiple hosts. Cfengine is good at performing a lot michael@562: of common system administration tasks, and allows you to build on its michael@562: strengths with your own scripts. You can also use it as a netwide michael@562: front-end for `cron'. michael@562: michael@562: %track michael@562: prog cfengine = { michael@562: version = %{version} michael@562: url = http://cfengine.com/source-code michael@563: regex = cfengine-(\d+.\d+\.\d+(p\d+)?)\.tar\.gz michael@562: } michael@562: michael@562: %prep michael@562: %setup -q michael@563: %{l_shtool} subst \ michael@563: -e 's;\(LIBS=.*\)-ltokyocabinet;\1`%{l_prefix}/bin/pkg-config --libs-only-l tokyocabinet`;' \ michael@563: -e 's;\(LIBS=.*\)-lcrypto;\1`%{l_prefix}/bin/pkg-config --libs-only-l openssl`;' \ michael@692: -e "s;mandir=.\${datarootdir}/man.;;" \ michael@692: -e "s;mandir=.\${exec_prefix}/share/man.;;" \ michael@563: configure michael@563: %{l_shtool} subst \ michael@563: -e 's;\(masterfilesdir = \$(projdatadir)\)/CoreBase;\1/cfengine;' \ michael@563: masterfiles/Makefile.in michael@692: %{l_shtool} subst \ michael@692: -e 's;\(string *=>\) "/var/cfengine/masterfiles";\1 translatepath("$(sys.workdir)/masterfiles");' \ michael@692: -e 's;"/usr/local/sbin";"%{l_prefix}/bin";' \ michael@692: masterfiles/failsafe.cf michael@692: %{l_shtool} subst \ michael@692: -e 's;\(/var/cfengine/masterfiles\);%{l_prefix}\1;g' \ michael@692: src/bootstrap.c michael@562: michael@562: %build michael@562: # configure package michael@562: CC="%{l_cc}" \ michael@562: CFLAGS="%{l_cflags -O}" \ michael@563: CPPFLAGS="%{l_cppflags}" \ michael@563: LDFLAGS="%{l_fsl_ldflags}" \ michael@563: LIBS="%{l_fsl_libs}" \ michael@562: ./configure \ michael@562: --prefix=%{l_prefix} \ michael@562: --mandir=%{l_prefix}/man \ michael@562: --infodir=%{l_prefix}/info \ michael@562: --with-workdir=%{l_prefix}/var/cfengine \ michael@563: --with-tokyocabinet=%{l_prefix} \ michael@562: --with-openssl=%{l_prefix} \ michael@562: --with-pcre=%{l_prefix} \ michael@563: --without-sql \ michael@563: --disable-shared michael@562: michael@562: # build package michael@563: %{l_make} %{l_mflags -O} michael@562: michael@562: %install michael@562: # install package michael@562: %{l_shtool} mkdir -f -p -m 755 \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/var/cfengine \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase michael@692: %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT" michael@692: michael@692: # copy or move files to correct subdirectories michael@692: mv \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/share/doc/examples \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/share/cfengine michael@692: mv \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/*.cf \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/ michael@692: cp \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/* \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/masterfiles/ michael@692: cp -rp \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/bin \ michael@692: $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/ michael@562: michael@562: # strip down installation michael@562: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc >/dev/null 2>&1 || true michael@562: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib* >/dev/null 2>&1 || true michael@562: rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir >/dev/null 2>&1 || true michael@692: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true michael@692: strip $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/bin/* >/dev/null 2>&1 || true michael@562: michael@562: # install run-command script michael@562: %{l_shtool} mkdir -f -p -m 755 \ michael@562: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@562: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@562: %{SOURCE rc.cfengine} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@562: michael@562: # install OSSP fsl configuration michael@562: %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@562: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@562: %{SOURCE fsl.cfengine} \ michael@562: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@562: michael@562: # determine installation files michael@562: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@562: %{l_files_std} \ michael@692: '%config %{l_prefix}/var/cfengine/masterfiles/*' \ michael@562: '%config %{l_prefix}/etc/fsl/fsl.cfengine' michael@562: michael@562: %files -f files michael@562: michael@562: %clean michael@562: michael@562: %post michael@562: # generate a public/private key pair for localhost michael@562: if [ ! -f $RPM_INSTALL_PREFIX/var/cfengine/ppkeys/localhost.priv ]; then michael@563: $RPM_INSTALL_PREFIX/bin/cf-key michael@562: fi michael@692: ( echo "You must choose a policy server (hub) to use and supply the" michael@692: echo "corresponding IP address while bootstrapping CFEngine for it" michael@692: echo "to be useful:" michael@692: echo "" michael@692: echo " # $RPM_INSTALL_PREFIX/var/cfengine/bin/cf-agent --bootstrap --policy-server " michael@692: ) | %{l_rpmtool} msg -b -t notice michael@562: