LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-07-2020, 07:00 AM   #1
PJBrs
Member
 
Registered: Oct 2006
Distribution: Slackware 14.2 / -current
Posts: 76

Rep: Reputation: 33
Reconstruct package from installed file


I have a couple of packages installed but I lost the packages themselves, and also the specific build scripts. Now I would like to upgrade some of them, but I want to keep an option open to revert back if I run into trouble. Hence my question: How can I reconstruct a package from installed files?

The reason I ask here, is that I expect somebody else to already have run into this issue, and I hope they have a script lying around somewhere. If not, I might have to cook something up by myself...
 
Old 04-07-2020, 08:13 AM   #2
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado, USA
Distribution: Slackware
Posts: 930

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
We need some more specifics. Which packages? Did you use slackbuild scripts? Are they listed in /var/log/packages? Did you install by extracting a 3rd party tar, rpm or deb file?
 
Old 04-07-2020, 08:17 AM   #3
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,461
Blog Entries: 7

Rep: Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561Reputation: 2561
Quote:
Originally Posted by PJBrs View Post
Hence my question: How can I reconstruct a package from installed files?
removepkg --preserve packagename

From the manpage for removepkg:
"--preserve packagename - If specified, the complete package subtree is reconstructed in /var/lib/pkgtools/setup/tmp/preserved_package/packagename."

Once you have the package subtree, you can use makepkg on it to create the package.

Last edited by rkelsen; 04-07-2020 at 08:19 AM.
 
3 members found this post helpful.
Old 04-07-2020, 08:19 AM   #4
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by rkelsen View Post
removepkg --preserve packagename
-copy may be the better option as that just constructs a copy of the package without actually removing the files.
 
3 members found this post helpful.
Old 04-07-2020, 12:15 PM   #5
PJBrs
Member
 
Registered: Oct 2006
Distribution: Slackware 14.2 / -current
Posts: 76

Original Poster
Rep: Reputation: 33
@rkelsen @ehartman

Thanks very much! This really helps. By the way, package ended up here:

Code:
/var/log/setup/tmp/preserved_packages
 
Old 04-07-2020, 12:31 PM   #6
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by PJBrs View Post
By the way, package ended up here:

Code:
/var/log/setup/tmp/preserved_packages
I think that is the location on 14.2 and earlier. On -current and future releases like 15.0, the package database has been moved from /var/log/ to /var/lib/pkgtools/.
 
Old 04-07-2020, 02:16 PM   #7
PJBrs
Member
 
Registered: Oct 2006
Distribution: Slackware 14.2 / -current
Posts: 76

Original Poster
Rep: Reputation: 33
I'm still on 14.2, waiting for 15.0.
 
Old 04-08-2020, 11:06 AM   #8
Xsane
Member
 
Registered: Jan 2014
Posts: 186

Rep: Reputation: 134Reputation: 134
Quote:
Originally Posted by PJBrs View Post
@rkelsen @ehartman

Thanks very much! This really helps. By the way, package ended up here:

Code:
/var/log/setup/tmp/preserved_packages
Note the 'tmp' in the path. It will not survive a reboot. So if you value the
'preserved' packages, then move them out of that directory.

I submitted a patch set allowing the caller to set the copy/preserve target,
but Pat didn't like it I guess. The set also added --preserve to upgradepkg and
implemented a significant speed-up of copy/preserve.
 
Old 04-08-2020, 11:31 AM   #9
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by Xsane View Post
Note the 'tmp' in the path. It will not survive a reboot.
As far as I know /var/log/setup/tmp/ in 14.x is a real directory (probably unlike -current), not a tmpfs one, so will not be affected by a reboot.
The directory is created - but empty - by the pkgtools-14.2 package.
 
Old 04-08-2020, 05:27 PM   #10
Xsane
Member
 
Registered: Jan 2014
Posts: 186

Rep: Reputation: 134Reputation: 134
Quote:
Originally Posted by ehartman View Post
As far as I know /var/log/setup/tmp/ in 14.x is a real directory (probably unlike -current), not a tmpfs one, so will not be affected by a reboot. The directory is created - but empty - by the pkgtools-14.2 package.
14.2 rc.S
Code:
# Clean up some temporary files:
rm -f /var/run/* /var/run/*/* /var/run/*/*/* /etc/nologin \
  /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
  /var/state/saslauthd/saslauthd.pid \
  /tmp/.Xauth* 1> /dev/null 2> /dev/null
  ( cd /var/log/setup/tmp && rm -rf * )
  ( cd /tmp && rm -rf kde-[a-zA-Z]* ksocket-[a-zA-Z]* hsperfdata_[a-zA-Z]* plugtmp* )
 
1 members found this post helpful.
Old 04-08-2020, 08:02 PM   #11
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by Xsane View Post
Code:
# Clean up some temporary files:
rm -f /var/run/* /var/run/*/* /var/run/*/*/* /etc/nologin \
  /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
  /var/state/saslauthd/saslauthd.pid \
  /tmp/.Xauth* 1> /dev/null 2> /dev/null
  ( cd /var/log/setup/tmp && rm -rf * )
  ( cd /tmp && rm -rf kde-[a-zA-Z]* ksocket-[a-zA-Z]* hsperfdata_[a-zA-Z]* plugtmp* )
You're right and I stand corrected!

Never noticed that bit in the rc.S startup script before....

To the OP: so you will have to move your generated packages out of the /var/log/setup/tmp tree before rebooting, as the above code will remove all files AND subdirectories in there at bootup.

Last edited by ehartman; 04-09-2020 at 07:14 AM. Reason: Warning for the OP
 
  


Reply

Tags
package management, packages, slackware 14.2/x86_64



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help - Partition Table disappears! Help me reconstruct using this... destone Linux - Server 1 08-02-2011 03:34 AM
Oops! Erased mbr, no more partition table. Any way to reconstruct? kinematic Linux - General 14 08-16-2010 05:17 PM
Help reconstruct RAID-5 idgamerd Linux - Embedded & Single-board computer 0 05-06-2009 08:31 AM
I accidentally install the grub on the Windows partition, Can I reconstruct??? nadavvin Linux - General 10 10-25-2006 07:30 PM
can I reconstruct partitions according to raid information. FinalFantasy Linux - General 1 07-08-2005 08:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration