LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 11-09-2015, 11:42 PM   #1
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Lightbulb Tip for scripting installs and package management


Just a little tip I learned recently that paid off after reading other distributions build scripts to start creating my own.

When and if you need to create a symlink for a package, such as using pkgtools which will be used for example here:

Create the symlink as such:

If the same directory:
Code:
( cd $tmp/path/to
  ln -s /lib/library.so library.so.1
)
If between different directories:
Code:
ln -s /lib/library.so $tmp/usr/lib/library.so
Some packagers like pkgtools, for example, take all symlinks and rework them in post install if they exist. Even if the /path/to points to a real location on the drive, don't worry, the packager will pick this up and restore the symlink as intended, and if it doesn't, you still have an active symlink waiting for the actual package, when installed.

And make sure the directory is created within the package as well, or it may have issues.

Happy building.

Last edited by ReaperX7; 11-10-2015 at 01:49 AM.
 
Old 11-10-2015, 10:23 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 3,137

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
must admit could never understand why pkgtools did that, it just removes the links then restores them, seems pountless, using make install DESTDIR=/path/to/pkg which is what slackbuild scripts ( for instance ) do the links will be correct in the first place, or am I missing something?
 
Old 11-14-2015, 04:33 AM   #3
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Pkgtools isn't perfect but it has problems due to tar. Tar will destroy a symlink outright and replace it with a real directory or a bad symlink back to the temp install. Which is why tar-1.13 is used, and why a doinst.sh script is used to restore all symlinks post installation.

I'm still working out the bugs in my build scripts though.
 
Old 11-14-2015, 06:11 AM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 3,137

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
So thats why they use the doinstall script, should have realized as I had a similar problem with my package manager overwriting symlinks to folder, I had to do some jiggling with the temp package before taring it up.
 
Old 11-18-2015, 07:16 PM   #5
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,554

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Yeah, and it's still far from perfect, but it works well enough to keep the noise levels of complaints to a minimum.

I was curious if libarchive's bsdtar was symlink friendly as packagers like pacman and pkgutils seem to want to use it.

Yeah makepkg is doing this with doinst.sh:

Collect all symlinks to a file
destroy all symlinks in package
install package
recreate symlinks post-install

It's crude but effective in keeping sanity in the tree.

Last edited by ReaperX7; 11-18-2015 at 07:18 PM.
 
Old 11-19-2015, 09:11 AM   #6
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Rep: Reputation: 55
I'm using a "package manager" (just a tool to keep track of versions and installed files) that is basically a stripped version of Slackware's pkgtool (which is exactly what you guys are discussing), and also Arch's PKGBUILD script. I have not been very careful with symlinks, but so far I haven't had much trouble. I guess I should look into doinst.sh script to see how that's done before I get into too much trouble.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
I broke my package manager / broken package blocks installs [Debian Wheezy] arthoc Linux - Software 4 06-20-2014 03:57 AM
[SOLVED] a package installs to / sycamorex Slackware 3 03-16-2010 03:31 PM
Need help with package installs Bodrey Linux - Newbie 3 12-19-2009 10:47 PM
LXer: Simple Package management with Synaptic Package Manager LXer Syndicated Linux News 0 12-05-2006 06:33 PM
package installs... mathfeel Fedora 4 12-01-2003 05:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:20 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