Correct pathnames and generally migrate buildconf from version 2 to 3.

Mon, 17 Sep 2012 19:13:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 17 Sep 2012 19:13:34 +0200
changeset 692
67831a9de168
parent 691
a9cbdfa9697a
child 693
165d980aa5f1

Correct pathnames and generally migrate buildconf from version 2 to 3.

cfengine/cfengine.spec file | annotate | diff | comparison | revisions
cfengine/rc.cfengine file | annotate | diff | comparison | revisions
     1.1 --- a/cfengine/cfengine.spec	Mon Sep 17 19:12:11 2012 +0200
     1.2 +++ b/cfengine/cfengine.spec	Mon Sep 17 19:13:34 2012 +0200
     1.3 @@ -74,10 +74,19 @@
     1.4      %{l_shtool} subst \
     1.5          -e 's;\(LIBS=.*\)-ltokyocabinet;\1`%{l_prefix}/bin/pkg-config --libs-only-l tokyocabinet`;' \
     1.6          -e 's;\(LIBS=.*\)-lcrypto;\1`%{l_prefix}/bin/pkg-config --libs-only-l openssl`;' \
     1.7 +        -e "s;mandir=.\${datarootdir}/man.;;" \
     1.8 +        -e "s;mandir=.\${exec_prefix}/share/man.;;" \
     1.9          configure
    1.10      %{l_shtool} subst \
    1.11          -e 's;\(masterfilesdir = \$(projdatadir)\)/CoreBase;\1/cfengine;' \
    1.12          masterfiles/Makefile.in
    1.13 +    %{l_shtool} subst \
    1.14 +        -e 's;\(string *=>\) "/var/cfengine/masterfiles";\1 translatepath("$(sys.workdir)/masterfiles");' \
    1.15 +        -e 's;"/usr/local/sbin";"%{l_prefix}/bin";' \
    1.16 +        masterfiles/failsafe.cf
    1.17 +    %{l_shtool} subst \
    1.18 +        -e 's;\(/var/cfengine/masterfiles\);%{l_prefix}\1;g' \
    1.19 +        src/bootstrap.c
    1.20  
    1.21  %build
    1.22      #   configure package
    1.23 @@ -103,14 +112,30 @@
    1.24  %install
    1.25      #   install package
    1.26      %{l_shtool} mkdir -f -p -m 755 \
    1.27 -        $RPM_BUILD_ROOT%{l_prefix}/var/cfengine
    1.28 -    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
    1.29 +        $RPM_BUILD_ROOT%{l_prefix}/var/cfengine \
    1.30 +        $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase
    1.31 +    %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
    1.32 +
    1.33 +    #   copy or move files to correct subdirectories
    1.34 +    mv \
    1.35 +        $RPM_BUILD_ROOT%{l_prefix}/share/doc/examples \
    1.36 +        $RPM_BUILD_ROOT%{l_prefix}/share/cfengine
    1.37 +    mv \
    1.38 +        $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/*.cf \
    1.39 +        $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/
    1.40 +    cp \
    1.41 +        $RPM_BUILD_ROOT%{l_prefix}/share/cfengine/corebase/* \
    1.42 +        $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/masterfiles/
    1.43 +    cp -rp \
    1.44 +        $RPM_BUILD_ROOT%{l_prefix}/bin \
    1.45 +        $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/
    1.46  
    1.47      #   strip down installation
    1.48      rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc >/dev/null 2>&1 || true
    1.49      rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/lib* >/dev/null 2>&1 || true
    1.50      rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir >/dev/null 2>&1 || true
    1.51 -    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
    1.52 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    1.53 +    strip $RPM_BUILD_ROOT%{l_prefix}/var/cfengine/bin/* >/dev/null 2>&1 || true
    1.54  
    1.55      #   install run-command script
    1.56      %{l_shtool} mkdir -f -p -m 755 \
    1.57 @@ -127,6 +152,7 @@
    1.58      #   determine installation files
    1.59      %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
    1.60          %{l_files_std} \
    1.61 +        '%config %{l_prefix}/var/cfengine/masterfiles/*' \
    1.62          '%config %{l_prefix}/etc/fsl/fsl.cfengine'
    1.63  
    1.64  %files -f files
    1.65 @@ -138,4 +164,10 @@
    1.66      if [ ! -f $RPM_INSTALL_PREFIX/var/cfengine/ppkeys/localhost.priv ]; then
    1.67          $RPM_INSTALL_PREFIX/bin/cf-key
    1.68      fi
    1.69 +    ( echo "You must choose a policy server (hub) to use and supply the"
    1.70 +      echo "corresponding IP address while bootstrapping CFEngine for it"
    1.71 +      echo "to be useful:"
    1.72 +      echo ""
    1.73 +      echo "    # $RPM_INSTALL_PREFIX/var/cfengine/bin/cf-agent --bootstrap --policy-server <ipddr>"
    1.74 +    ) | %{l_rpmtool} msg -b -t notice
    1.75  
     2.1 --- a/cfengine/rc.cfengine	Mon Sep 17 19:12:11 2012 +0200
     2.2 +++ b/cfengine/rc.cfengine	Mon Sep 17 19:13:34 2012 +0200
     2.3 @@ -5,8 +5,9 @@
     2.4  
     2.5  %config
     2.6      cfengine_enable="$openpkg_rc_def"
     2.7 -    cfengine_cservd_flags=""
     2.8 -    cfengine_cenvd_flags=""
     2.9 +    cfengine_cfserverd_flags=""
    2.10 +    cfengine_cfexecd_flags=""
    2.11 +    cfengine_cfmonitord_flags=""
    2.12      cfengine_log_prolog="true"
    2.13      cfengine_log_epilog="true"
    2.14      cfengine_log_numfiles="10"
    2.15 @@ -14,15 +15,19 @@
    2.16      cfengine_log_complevel="9"
    2.17  
    2.18  %common
    2.19 -    cfengine_cfservd_pidfile="@l_prefix@/var/cfengine/cfservd.pid"
    2.20 -    cfengine_cfenvd_pidfile="@l_prefix@/var/cfengine/cfenvd.pid"
    2.21 +    cfengine_cfserverd_pidfile="@l_prefix@/var/cfengine/cf-serverd.pid"
    2.22 +    cfengine_cfexecd_pidfile="@l_prefix@/var/cfengine/cf-execd.pid"
    2.23 +    cfengine_cfmonitord_pidfile="@l_prefix@/var/cfengine/cf-monitord.pid"
    2.24      cfengine_signal () {
    2.25 -        [ -f $cfengine_cfservd_pidfile ] \
    2.26 -            && kill -$1 `cat $cfengine_cfservd_pidfile`
    2.27 +        [ -f $cfengine_cfserverd_pidfile ] \
    2.28 +            && kill -$1 `cat $cfengine_cfserverd_pidfile`
    2.29          local rc=$?
    2.30 -        [ -f $cfengine_cfenvd_pidfile ] \
    2.31 -            && kill -$1 `cat $cfengine_cfenvd_pidfile` \
    2.32 -            && [ $rc -eq 0 ]
    2.33 +        [ -f $cfengine_cfexecd_pidfile ] \
    2.34 +            && kill -$1 `cat $cfengine_cfexecd_pidfile` \
    2.35 +            || [ $rc -eq 0 ]
    2.36 +        [ -f $cfengine_cfmonitord_pidfile ] \
    2.37 +            && kill -$1 `cat $cfengine_cfmonitord_pidfile` \
    2.38 +            || [ $rc -eq 0 ]
    2.39      }
    2.40  
    2.41  %status -u @l_susr@ -o
    2.42 @@ -37,24 +42,18 @@
    2.43  %start -u @l_susr@
    2.44      rcService cfengine enable yes || exit 0
    2.45      rcService cfengine active yes && exit 0
    2.46 -    ( nohup @l_prefix@/sbin/cfservd \
    2.47 -          --no-fork $cfengine_cfservd_flags \
    2.48 -          </dev/null >/dev/null 2>&1 &
    2.49 -      echo $! >$cfengine_cfservd_pidfile
    2.50 -    ) >/dev/null 2>&1
    2.51 -    ( nohup @l_prefix@/sbin/cfenvd \
    2.52 -          --no-fork $cfengine_cfenvd_flags \
    2.53 -          </dev/null >/dev/null 2>&1 &
    2.54 -      echo $! >$cfengine_cfenvd_pidfile
    2.55 -    ) >/dev/null 2>&1
    2.56 +    @l_prefix@/var/cfengine/bin/cf-serverd $cfengine_cfserverd_flags 
    2.57 +    @l_prefix@/var/cfengine/bin/cf-execd $cfengine_cfexecd_flags 
    2.58 +    @l_prefix@/var/cfengine/bin/cf-monitord $cfengine_cfmonitord_flags 
    2.59  
    2.60  %stop -u @l_susr@
    2.61      rcService cfengine enable yes || exit 0
    2.62      rcService cfengine active no  && exit 0
    2.63      cfengine_signal TERM
    2.64      sleep 2
    2.65 -    rm -f $cfengine_cfservd_pidfile 2>/dev/null || true
    2.66 -    rm -f $cfengine_cfenvd_pidfile  2>/dev/null || true
    2.67 +    rm -f $cfengine_cfserverd_pidfile 2>/dev/null || true
    2.68 +    rm -f $cfengine_cfexecd_pidfile  2>/dev/null || true
    2.69 +    rm -f $cfengine_cfmonitord_pidfile  2>/dev/null || true
    2.70  
    2.71  %restart -u @l_susr@
    2.72      rcService cfengine enable yes || exit 0

mercurial