Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@562 | 1 | ## |
michael@562 | 2 | ## cfengine.spec -- OpenPKG RPM Package Specification |
michael@562 | 3 | ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@562 | 4 | ## |
michael@562 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@562 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@562 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@562 | 8 | ## copies. |
michael@562 | 9 | ## |
michael@562 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@562 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@562 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@562 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@562 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@562 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@562 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@562 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@562 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@562 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@562 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@562 | 21 | ## SUCH DAMAGE. |
michael@562 | 22 | ## |
michael@562 | 23 | |
michael@562 | 24 | # package information |
michael@562 | 25 | Name: cfengine |
michael@562 | 26 | Summary: Automated System Administration Tool |
michael@562 | 27 | URL: http://www.cfengine.org/ |
michael@562 | 28 | Vendor: Oslo University College, Norway |
michael@562 | 29 | Packager: OpenPKG Foundation e.V. |
michael@562 | 30 | Distribution: OpenPKG Community |
michael@562 | 31 | Class: BASE |
michael@562 | 32 | Group: System |
michael@562 | 33 | License: GPL |
michael@563 | 34 | Version: 3.3.5 |
michael@563 | 35 | Release: 20120800 |
michael@562 | 36 | |
michael@562 | 37 | # package options |
michael@562 | 38 | %option with_fsl yes |
michael@562 | 39 | |
michael@562 | 40 | # list of sources |
michael@562 | 41 | Source0: http://cfengine.com/source-code/download?file=cfengine-%{version}.tar.gz |
michael@562 | 42 | Source1: rc.cfengine |
michael@562 | 43 | Source2: fsl.cfengine |
michael@562 | 44 | |
michael@562 | 45 | # build information |
michael@563 | 46 | BuildPreReq: OpenPKG, openpkg >= 20100101, bison, flex, make, gcc, pkgconfig |
michael@562 | 47 | PreReq: OpenPKG, openpkg >= 20100101 |
michael@563 | 48 | BuildPreReq: tokyocabinet, openssl, pcre |
michael@563 | 49 | PreReq: tokyocabinet, openssl, pcre |
michael@562 | 50 | %if "%{with_fsl}" == "yes" |
michael@562 | 51 | BuildPreReq: fsl |
michael@562 | 52 | PreReq: fsl |
michael@562 | 53 | %endif |
michael@562 | 54 | |
michael@562 | 55 | %description |
michael@562 | 56 | Cfengine is a tool for setting up and maintaining BSD and System-5-like |
michael@562 | 57 | operating system optionally attached to a TCP/IP network. You can think |
michael@562 | 58 | of cfengine as a very high level language, much higher level than Perl |
michael@562 | 59 | or shell: a single statement can result in many hundreds of operations |
michael@562 | 60 | being performed on multiple hosts. Cfengine is good at performing a lot |
michael@562 | 61 | of common system administration tasks, and allows you to build on its |
michael@562 | 62 | strengths with your own scripts. You can also use it as a netwide |
michael@562 | 63 | front-end for `cron'. |
michael@562 | 64 | |
michael@562 | 65 | %track |
michael@562 | 66 | prog cfengine = { |
michael@562 | 67 | version = %{version} |
michael@562 | 68 | url = http://cfengine.com/source-code |
michael@563 | 69 | regex = cfengine-(\d+.\d+\.\d+(p\d+)?)\.tar\.gz |
michael@562 | 70 | } |
michael@562 | 71 | |
michael@562 | 72 | %prep |
michael@562 | 73 | %setup -q |
michael@563 | 74 | %{l_shtool} subst \ |
michael@563 | 75 | -e 's;\(LIBS=.*\)-ltokyocabinet;\1`%{l_prefix}/bin/pkg-config --libs-only-l tokyocabinet`;' \ |
michael@563 | 76 | -e 's;\(LIBS=.*\)-lcrypto;\1`%{l_prefix}/bin/pkg-config --libs-only-l openssl`;' \ |
michael@692 | 77 | -e "s;mandir=.\${datarootdir}/man.;;" \ |
michael@692 | 78 | -e "s;mandir=.\${exec_prefix}/share/man.;;" \ |
michael@563 | 79 | configure |
michael@563 | 80 | %{l_shtool} subst \ |
michael@563 | 81 | -e 's;\(masterfilesdir = \$(projdatadir)\)/CoreBase;\1/cfengine;' \ |
michael@563 | 82 | masterfiles/Makefile.in |
michael@692 | 83 | %{l_shtool} subst \ |
michael@692 | 84 | -e 's;\(string *=>\) "/var/cfengine/masterfiles";\1 translatepath("$(sys.workdir)/masterfiles");' \ |
michael@692 | 85 | -e 's;"/usr/local/sbin";"%{l_prefix}/bin";' \ |
michael@692 | 86 | masterfiles/failsafe.cf |
michael@692 | 87 | %{l_shtool} subst \ |
michael@692 | 88 | -e 's;\(/var/cfengine/masterfiles\);%{l_prefix}\1;g' \ |
michael@692 | 89 | src/bootstrap.c |
michael@562 | 90 | |
michael@562 | 91 | %build |
michael@562 | 92 | # configure package |
michael@562 | 93 | CC="%{l_cc}" \ |
michael@562 | 94 | CFLAGS="%{l_cflags -O}" \ |
michael@563 | 95 | CPPFLAGS="%{l_cppflags}" \ |
michael@563 | 96 | LDFLAGS="%{l_fsl_ldflags}" \ |
michael@563 | 97 | LIBS="%{l_fsl_libs}" \ |
michael@562 | 98 | ./configure \ |
michael@562 | 99 | --prefix=%{l_prefix} \ |
michael@562 | 100 | --mandir=%{l_prefix}/man \ |
michael@562 | 101 | --infodir=%{l_prefix}/info \ |
michael@562 | 102 | --with-workdir=%{l_prefix}/var/cfengine \ |
michael@563 | 103 | --with-tokyocabinet=%{l_prefix} \ |
michael@562 | 104 | --with-openssl=%{l_prefix} \ |
michael@562 | 105 | --with-pcre=%{l_prefix} \ |
michael@563 | 106 | --without-sql \ |
michael@563 | 107 | --disable-shared |
michael@562 | 108 | |
michael@562 | 109 | # build package |
michael@563 | 110 | %{l_make} %{l_mflags -O} |
michael@562 | 111 | |
michael@562 | 112 | %install |
michael@562 | 113 | # install package |
michael@562 | 114 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@692 | 115 | $RPM_BUILD_ROOT%{l_prefix}/var/cfengine \ |
michael@692 | 116 | $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase |
michael@692 | 117 | %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT" |
michael@692 | 118 | |
michael@692 | 119 | # copy or move files to correct subdirectories |
michael@692 | 120 | mv \ |
michael@692 | 121 | $RPM_BUILD_ROOT%{l_prefix}/share/doc/examples \ |
michael@692 | 122 | $RPM_BUILD_ROOT%{l_prefix}/share/cfengine |
michael@692 | 123 | mv \ |
michael@692 | 124 | $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/*.cf \ |
michael@692 | 125 | $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/ |
michael@692 | 126 | cp \ |
michael@692 | 127 | $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/* \ |
michael@692 | 128 | $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/masterfiles/ |
michael@692 | 129 | cp -rp \ |
michael@692 | 130 | $RPM_BUILD_ROOT%{l_prefix}/bin \ |
michael@692 | 131 | $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/ |
michael@562 | 132 | |
michael@562 | 133 | # strip down installation |
michael@562 | 134 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc >/dev/null 2>&1 || true |
michael@562 | 135 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib* >/dev/null 2>&1 || true |
michael@562 | 136 | rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir >/dev/null 2>&1 || true |
michael@692 | 137 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
michael@692 | 138 | strip $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/bin/* >/dev/null 2>&1 || true |
michael@562 | 139 | |
michael@562 | 140 | # install run-command script |
michael@562 | 141 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@562 | 142 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@562 | 143 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@562 | 144 | %{SOURCE rc.cfengine} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@562 | 145 | |
michael@562 | 146 | # install OSSP fsl configuration |
michael@562 | 147 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@562 | 148 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@562 | 149 | %{SOURCE fsl.cfengine} \ |
michael@562 | 150 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@562 | 151 | |
michael@562 | 152 | # determine installation files |
michael@562 | 153 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@562 | 154 | %{l_files_std} \ |
michael@692 | 155 | '%config %{l_prefix}/var/cfengine/masterfiles/*' \ |
michael@562 | 156 | '%config %{l_prefix}/etc/fsl/fsl.cfengine' |
michael@562 | 157 | |
michael@562 | 158 | %files -f files |
michael@562 | 159 | |
michael@562 | 160 | %clean |
michael@562 | 161 | |
michael@562 | 162 | %post |
michael@562 | 163 | # generate a public/private key pair for localhost |
michael@562 | 164 | if [ ! -f $RPM_INSTALL_PREFIX/var/cfengine/ppkeys/localhost.priv ]; then |
michael@563 | 165 | $RPM_INSTALL_PREFIX/bin/cf-key |
michael@562 | 166 | fi |
michael@692 | 167 | ( echo "You must choose a policy server (hub) to use and supply the" |
michael@692 | 168 | echo "corresponding IP address while bootstrapping CFEngine for it" |
michael@692 | 169 | echo "to be useful:" |
michael@692 | 170 | echo "" |
michael@692 | 171 | echo " # $RPM_INSTALL_PREFIX/var/cfengine/bin/cf-agent --bootstrap --policy-server <ipddr>" |
michael@692 | 172 | ) | %{l_rpmtool} msg -b -t notice |
michael@562 | 173 |