Slackware This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
03-22-2014, 09:02 PM
|
#1
|
LQ Newbie
Registered: Sep 2011
Posts: 2
Rep: 
|
How to extract a package from installed system?
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.
Thanks.
|
|
|
03-22-2014, 11:10 PM
|
#2
|
LQ 5k Club
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,551
|
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.
|
|
|
03-23-2014, 02:03 AM
|
#3
|
Senior Member
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559
|
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!
|
|
8 members found this post helpful.
|
03-23-2014, 02:12 AM
|
#4
|
Senior Member
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559
|
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
|
|
|
03-23-2014, 03:24 AM
|
#5
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,331
Rep: 
|
What's done by doinst.sh is recorded in /var/log/scripts.
Last edited by Didier Spaier; 03-23-2014 at 04:07 AM.
|
|
4 members found this post helpful.
|
03-23-2014, 06:33 AM
|
#6
|
Senior Member
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559
|
Quote:
Originally Posted by Didier Spaier
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).
|
|
1 members found this post helpful.
|
03-23-2014, 07:06 AM
|
#7
|
LQ Newbie
Registered: Sep 2011
Posts: 2
Original Poster
Rep: 
|
I noticed that "slack-desc" is not recovered by
Code:
# 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.
Thanks!
|
|
|
03-23-2014, 07:51 AM
|
#8
|
Member
Registered: Jun 2012
Distribution: Slackware
Posts: 441
|
Quote:
Originally Posted by jinvii
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.
|
It is logged in:
Code:
/var/log/packages/example-1.0-x86_64-1
You can extract it with:
Code:
grep '^example: ' /var/log/packages/example-1.0-x86_64-1 > ~/path/slack.desc
Don't forget the colon right after the program name when grepping.
Last edited by Philip Lacroix; 03-23-2014 at 05:49 PM.
Reason: better pattern for grep (thanks to ruario)
|
|
2 members found this post helpful.
|
03-23-2014, 08:08 AM
|
#9
|
LQ Newbie
Registered: Mar 2014
Distribution: Slackware!
Posts: 13
Rep:
|
Quote:
Originally Posted by allend
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.
|
Yes you can. It's in /var/log/scripts/.
|
|
|
03-23-2014, 09:06 AM
|
#10
|
LQ 5k Club
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,551
|
Quote:
Yes you can. It's in /var/log/scripts/.
|
Yes, as also pointed out by Didier Spaier. My bad. I had forgotten that.
As pointed out by ruario, there is still the problem of any new config files.
|
|
|
03-23-2014, 09:22 AM
|
#11
|
Member
Registered: Jun 2012
Distribution: Slackware
Posts: 441
|
Quote:
Originally Posted by ruario
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.
|
|
|
03-23-2014, 04:04 PM
|
#12
|
Senior Member
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559
|
Quote:
Originally Posted by Philip Lacroix
You can extract it with:
Code:
grep "example:" /var/log/packages/example-1.0-x86_64-1 > ~/path/slack.desc
Don't forget the colon right after the program name when grepping.
|
Thanks, I new I had forgotten something!
P.S. I have updated my original reply and added a better match: '^example: '
|
|
|
03-23-2014, 06:01 PM
|
#13
|
Member
Registered: Jun 2012
Distribution: Slackware
Posts: 441
|
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.
|
|
|
All times are GMT -5. The time now is 09:18 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.
|
Latest Threads
LQ News
|
|