Make changes of a source rpm and rebuild it

I have the source rpm package of cfengine 3.2.4. Now I want to change the workdir /var/lib/cfengine/work to /var/cfengine, like it’s in version 3.5.2. Finally I want to build it to have an installable rpm package.

I think I have to edit only the spec file, where I found the following lines:

Name: cfengine %define libname libpromises %define libsoname %{libname}1 %define basedir /var/lib/%{name} %define workdir %{basedir}/work

Hi daylight1,

sounds good to me - so just go ahead and try it.

What SLES is this for? I haven’t seen any cfengine RPMs for SLES yet.

Regards,
Jens

Regards,
Jens

I want to rebuild it on SLES 10. Do you know what the steps are? With rpmbuild --rebuild I’m not able to make any changes :stuck_out_tongue:

Hi daylight1,

assuming you have the source RPM “installed”, you’ll find the spec in /usr/src/packages/SPECS - modify it to your needs and use "rpmbuild -ba " to build source & binary file.

Regards,
Jens

Thank you! After additional changes of the spec file, I was able to build it without errors.
The installation of the just created package stores the files under /var/cfengine. Then I tried to bootstrap cfengine but it seems the paths are hard coded (/var/lib/cfengine). I don’t know but can that be?

[FONT=Courier New]# cf-agent -Bs
** CFEngine BOOTSTRAP probe initiated

@@@
@@@ CFEngine

@ @@@ @ CFEngine Core 3.2.4
@ @@@ @
@ @@@ @
@ @
@@@
@ @
@ @
@ @

Copyright (C) CFEngine AS 2008-2012
See Licensing at http://cfengine.com/3rdpartylicenses

→ This host is:
→ Operating System Type is linux
→ Operating System Release is 2.6.16.60-0.103.1-default
→ Architecture = x86_64
→ Internal soft-class is linux
→ No previous policy has been cached on this host
→ Assuming the policy distribution point at: :/var/cfengine/masterfiles
→ Attempting to initiate promised autonomous services…

cf-promises needs to be installed in /var/lib/cfengine/work/bin for pre-validation of full configuration
No public/private key pair found
!! Authentication dialogue with failed
Proposed executable file “$(sys.cf_key)” doesn’t exist
$(sys.cf_key) promises to be executable but isn’t
I: Made in version ‘not specified’ of ‘/var/lib/cfengine/work/inputs/failsafe.cf’ near line 18
R: This autonomous node assumes the role of voluntary client
R: !! Failed to pull policy from policy server
R: !! Did not start the scheduler
Proposed executable file “$(sys.cf_key)” doesn’t exist
$(sys.cf_key) promises to be executable but isn’t
I: Made in version ‘not specified’ of ‘/var/lib/cfengine/work/inputs/failsafe.cf’ near line 18
Proposed executable file “$(sys.cf_key)” doesn’t exist
$(sys.cf_key) promises to be executable but isn’t
I: Made in version ‘not specified’ of ‘/var/lib/cfengine/work/inputs/failsafe.cf’ near line 18
!! Bootstrapping failed, no input file at /var/lib/cfengine/work/inputs/promises.cf after bootstrap[/FONT]

Hi daylight1,

but it seems the paths are hard coded (/var/lib/cfengine). I don’t know but can that be?

anything can be - have you "grep"ed for the directory name within your sources? If it’s not within any variable set by the spec file nor the “configure” defaults, it would have to be somewhere (and somehow, i.e. not necessarily as a single string) in the source code.

My first guess would be some “configure” default, though.

Regards,
Jens

Have you considered creating /var/cfengine as a symbolic link to /var/lib/cfengine? It doesn’t change the workdir, but it makes the files available via the path var/cfengine. Reconfiguring is better, but evidently not as simple as you hoped so maybe a symlink would work instead. It depends why you are trying to change the workdir.

You could add a line in to the spec file that creates the symbolic link and leave everything else alone. Or forget about rebuilding the rpm entirely and manually create the symlink. It seems neater to have the symlink belong to the package though.