There are two machines, identical version/arch of SLES.
On machine #A there is a "foo" software installed that we can see using rpm -qa
.
On machine #B the "foo" software needs to be installed.
The foo.rpm
isn't available from any source, from the internet, etc.
Question
Since the package foo.rpm
was installed on machine #A, can we build a foo.rpm
file on it from the already installed files?
There are pre/post scripts in the rpm's, too, I think. So then the foo.rpm
(with dependencies?) can be installed.
Best Answer
It's possible but highly difficult to do this so that it's done correctly. If you're desperate you can create a new RPM
.spec
file and construct a "fake" source RPM (SRPM) file which you can then use to construct a resulting RPM file usingrpmbuild --rebuild
.I would continue searching for the actual RPM instead. You don't state which in your question but it's been my experience that you can find anything on the internet if you know how to search for it. I've found ancient versions of RPMs for Red Hat distros that haven't been in use for 10+ years so I'd find it hard to believe that there is no remnant of this RPM anywhere.
Also you can often times go back to the source of the application that's contained within the RPM and use that to reconstruct the RPM too. Often times the source apps will include a necessary
.spec
file which is used to rebuild the RPM.Lastly you could get the source and the
.spec
file from a build service such as Koji for Red Hat based distros. SuSE maintains similar build services as well so you can search through these to get old build artifacts.Taking the binaries as are
You can use this method to lift the actual executables from one system and tar them up for deployment on another system.
machine A
machine B
SLES's version of RPM
According to one of the posts in this thread: Re: How to create RPM fron installed packages
rpm
on SLES is purported to have the switch--repackage
. This doesn't exist on the Red Hat version (in Fedora or CentOS). But according to the post you can use it like so:After that completes you'll find your RPM accessible here:
Using rpmerizor
Rpmerizor is a 3rd party tool/script that you can install which will re-package source files into a corresponding RPM. The usage of this script is accessible here, titled: rpmerizor's man page.
excerpt
Using rpmrebuild
Not to be confused with the build tool
rpmbuild
,rpmrebuild
is another 3rd party script you can use to do a re-packaging of an already installed RPM.excerpt
Example
Say we want to repackage openssh-server.
Now package it:
References