LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-07-2023, 10:17 AM   #1
SlackCoder
Member
 
Registered: Nov 2020
Posts: 40

Rep: Reputation: Disabled
Makepkg and symlinks


When creating a slackware package, `makepkg` provides an option (the default) to delete symlinks and add them later via the 'install/doinst.sh' script included in the package.

```
makepkg --help

Usage: makepkg package_name.tgz
(or: package_name.tbz, package_name.tlz, package_name.txz)
[...]
options: -l, --linkadd y|n (moves symlinks into doinst.sh: recommended)
-p, --prepend (prepend rather than append symlinks to an existing

```

What would be the purpose for this?
 
Old 12-07-2023, 10:46 AM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
If I remember rightly, it has something to do with tar not always doing the correct thing when restoring a symlink over a directory, or vice versa, or some such, so the work was shunted into the doinst.sh.

There's that much ugliness and technical-debt in the package system that I just cover my eyes and pretend I can't see it.

Just use -l y and try not to think about it too hard. It works for me.

Last edited by GazL; 12-07-2023 at 10:48 AM.
 
1 members found this post helpful.
Old 12-07-2023, 11:14 AM   #3
e5150
Member
 
Registered: Oct 2005
Location: Sweden
Distribution: Slackware and Alpine
Posts: 132

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by GazL View Post
something to do with tar
That's my recollection as well, had to dig through some changelogs
From slack 8.1:
Code:
Thu Feb 21 22:36:20 PST 2002
pkgtools-8.0.4-i386-1.tgz:  Fixed a bug where only the first slack-desc
  would be found when installing multiple packages without .txt files.
  Added --linkadd and --chown options to makepkg.
  Reported/suggested by David Nordenberg.
  Patches to use tar-1.13 if it's around, and to complain if it isn't.
a/tar-1.13.25-i386-1.tgz:  Upgraded to GNU tar-1.13.25.  We still keep a
  tar-1.13 binary around for the Slackware package utilities to use, because
  the new tar wipes out symbolic links to directories when untarring.  (Try
  making /opt a link to /usr/opt and untarring a KDE package and you'll see
  the effect).  Nevertheless, tar-1.13.25 appears better overall.
Note that tar-1.13 has been retired in -current
Code:
Tue Jul 26 19:27:53 UTC 2022
a/tar-1.34-x86_64-2.txz:  Rebuilt.
  Sergey Poznyakoff added options to GNU tar back in 2013 to make it possible
  to use it in the pkgtools, and with help from gnashley and ruario we
  switched to using the latest version of tar in makepkg over 4 years ago.
  Still, we kept the old tar-1.13 around. It's finally time to let go of this
  old artifact. Farewell tar-1.13, thanks for everything. :-)
 
1 members found this post helpful.
Old 12-07-2023, 01:06 PM   #4
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,543

Rep: Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313
Quote:
Originally Posted by SlackCoder View Post
`makepkg` provides an option (the default) to delete symlinks and add them later via the 'install/doinst.sh' script included in the package.
I asked Patrick about why upgradepkg calls installpkg twice, and I think part of this answer explains why the symlinks are handled by a script rather than contained within the tar archive:

Code:
[..]
imagine symlinks turning into directories and vice-versa
A good example is when the /usr/lib/zoneinfo dir moved to
/usr/share/zoneinfo.  There was a link from /usr/share/zoneinfo to
/usr/lib/zoneinfo, and in an upgrade the locations of the dir and
link swapped.  Pass one (ip), package is extracted through the old
link to the old dir.  Pass two (rp), rm -rf is applied to the old
link.  At this point there's no zoneinfo database.  Pass three (ip), fixes that problem.
 
3 members found this post helpful.
Old 12-08-2023, 01:49 PM   #5
SlackCoder
Member
 
Registered: Nov 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
On Slackware 15.0, its working fine now with pkgtools using the latest tar version. For now it looks like it is around for backwards compatibility.

Code:
#!/bin/bash
set -e

mkdir -p /tmp/root

rm -fr /tmp/root/*
(cd /tmp/root
  mkdir -p usr/share
  mkdir -p usr/lib/zoneinfo
  ln -s ../lib/zoneinfo usr/share/zoneinfo

  /sbin/makepkg -l n -c n /tmp/package-1-NOARCH-1.txz
)

rm -fr /tmp/root/*
(cd /tmp/root
  mkdir -p usr/lib
  mkdir -p usr/share/zoneinfo
  ln -s ../share/zoneinfo usr/lib/zoneinfo

  mkdir -p usr/share/doc/app
  touch usr/share/doc/app/index.html

  /sbin/makepkg -l n -c n /tmp/package-2-NOARCH-2.txz
)

rm -fr /tmp/root/*
(cd /tmp/root
  mkdir -p usr/doc
  mkdir -p usr/share
  ln -s ../doc usr/share/doc
)

ROOT=/tmp/root installpkg /tmp/package-1-NOARCH-1.txz
ROOT=/tmp/root upgradepkg /tmp/package-2-NOARCH-2.txz

echo ""
echo "should have /tmp/root/usr/lib/zoneinfo"
echo ""
find /tmp/root/usr -type l

echo ""
echo "should have index.html"
echo ""
find /tmp/root/usr/doc/app/index.html

Last edited by SlackCoder; 12-08-2023 at 02:08 PM. Reason: Correct symlink creation in script
 
Old 12-13-2023, 05:10 PM   #6
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,830
Blog Entries: 17

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
I see this is resolved, but in case it is of any interest, here is a more detailed article about building a package the proper way:
https://docs.slackware.com/howtos:sl...ding_a_package
 
Old 12-14-2023, 05:12 AM   #7
SlackCoder
Member
 
Registered: Nov 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by zeebra View Post
I see this is resolved, but in case it is of any interest, here is a more detailed article about building a package the proper way:
https://docs.slackware.com/howtos:sl...ding_a_package
Thanks @zeebra, but there is a correction. The article needs an update. '--libdir=/usr/lib64' should be added to the ./configure commands.
 
Old 12-14-2023, 05:23 AM   #8
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,830
Blog Entries: 17

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
Quote:
Originally Posted by SlackCoder View Post
Thanks @zeebra, but there is a correction. The article needs an update. '--libdir=/usr/lib64' should be added to the ./configure commands.
I see, that's probably a good idea yes. It's quite an old article, but I believe it's a good one for Slackers to be familiar with. I can fix that actually, don't think anyone will mind. There, done..
 
1 members found this post helpful.
Old 12-14-2023, 05:39 AM   #9
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,543

Rep: Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313
Quote:
Originally Posted by zeebra View Post
I see, that's probably a good idea yes. It's quite an old article, but I believe it's a good one for Slackers to be familiar with. I can fix that actually, don't think anyone will mind. There, done..
I've added a note.
 
1 members found this post helpful.
Old 12-14-2023, 05:48 AM   #10
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,830
Blog Entries: 17

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
Quote:
Originally Posted by drmozes View Post
I've added a note.
Yes, good idea too. I sometimes forget people still use 32 bit systems.

Not sure what the normal practice is, but I normally prefix with /usr/local personally.

Last edited by zeebra; 12-14-2023 at 05:49 AM.
 
  


Reply



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
[SOLVED] Removing then recreating symlinks with makepkg Mechanikx Slackware 11 03-24-2019 10:55 PM
makepkg produces incorrect symlinks hba Slackware 6 11-14-2015 09:04 AM
[SOLVED] Bug in makepkg and symlinks with blanks in filename? DarkVision Slackware 52 10-01-2015 10:57 PM
makepkg - 10.2 and/or 11.0 TL_CLD Slackware 2 10-10-2006 02:49 PM
Makepkg and slack-desc mirto Slackware 7 10-15-2005 03:17 PM

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

All times are GMT -5. The time now is 11:03 PM.

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