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 Code:
ln -s /lib/library.so $tmp/usr/lib/library.so And make sure the directory is created within the package as well, or it may have issues. Happy building. |
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?
|
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. |
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.
|
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. |
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.
|
All times are GMT -5. The time now is 10:19 PM. |