[SOLVED] How to extract a package from installed system?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, just out of curiosity, consider the following situation:
If you just generate a slackware package using SlackBuilds or whatsoever, let's call it xxxx.tgz. Then you install it with "installpkg xxxx.tgz", and then remove all the source files and this package.
Now, my question is, as this package is installed in our system and we also has its log in "/var/log/packages/xxxx", is there a way/tool to directly extract this package from our system on which we installed this package of course. That means we generate this xxxx.tgz using the installed binaries and information.
You can recover the slack-desc file and the binaries that are installed, but you cannot recover the doinst.sh script that may be necessary to properly install the package.
So reverse engineering a package from the installed version will not work for all packages.
For many simple packages the following would work (adjust the package name as needed):
Code:
$ su -
# removepkg -copy example-1.0-x86_64-1
# cd /var/log/setup/tmp/preserved_packages/example-1.0-x86_64-1
# mkdir -p install
# grep '^example: ' /var/log/packages/example-1.0-x86_64-1 > install/slack-desc
# makepkg -l n -c n /tmp/example-1.0-x86_64-1.tgz
However for packages where config files are moved into place by doinst.sh, those original, pristine versions of the config files (.new versions) will likely not be found and you will therefore not have a complete package.
Last edited by ruario; 03-23-2014 at 04:02 PM.
Reason: Added in slack-desc, thanks to Philip Lacroix for the reminder!
If you are willing to handle a little bit of manual work you could copy the config files into their relevant locations under /var/log/setup/tmp/preserved_packages/example-1.0-x86_64-1, add back the .new extension and undoing any tweaks you made, before the makepkg step.
Inspecting the contents of doinst.sh should give you an idea of which files are affected.
Last edited by ruario; 03-23-2014 at 02:34 AM.
Reason: s/Expecting/Inspecting
What's done by doinst.sh is recorded in /var/log/scripts.
Indeed and that is copied back into /var/log/setup/tmp/preserved_packages/example-1.0-x86_64-1/install/doinst.sh for you by removepkg -copy (or -preserve).
I noticed that "slack-desc" is not recovered by
# removepkg -copy example-1.0-x86_64-1
And according to allend, it is logged somewhere, where does it logged? I cannot find it manually.
You can recover the slack-desc file and the binaries that are installed, but you cannot recover the doinst.sh script that may be necessary to properly install the package.
Inspecting the contents of doinst.sh should give you an idea of which files are affected.
Yeah, and the relevant file in /var/log/packages/ also includes a list of the files that were added to the package during its generation, with all *.new stuff in the original location.
Last edited by Philip Lacroix; 03-23-2014 at 09:27 AM.
Thanks ruario, I updated my post #8 as well. Of course in #11 it wasn't my intention to correct you: if it could be read this way, then it's my fault (i.e. my poor English).
Last edited by Philip Lacroix; 03-26-2014 at 03:54 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.