Opened 17 years ago

Closed 17 years ago

#2390 closed enhancement (fixed)

Create Linux-PAM symlinks using 'readlink'

Reported by: Randy McMurchy Owned by: Randy McMurchy
Priority: normal Milestone: 6.3
Component: BOOK Version: SVN
Severity: normal Keywords:
Cc:

Description

As Dan pointed out, we could make the Linux-PAM instructions better by replacing the hard-coded symlink commands with different ones using 'readlink'.

Dan, I can knock this out right now, but I'll wait to hear from you as you may already be working/thinking about this.

Let me know.

Attachments (1)

pam-symlinks.patch (2.2 KB ) - added by dnicholson@… 17 years ago.
Use readlink to recreate the pam symlinks

Download all attachments as: .zip

Change History (13)

comment:1 by Randy McMurchy, 17 years ago

I forgot to mention that I agree using 'libdir=/lib' is better than what we have now.

comment:2 by dnicholson@…, 17 years ago

I happened to write a preliminary patch this morning (attached), but you can go for it if you want. The basic addition is this:

for lib in libpam{,c,_misc}.so; do
    link=$(readlink /usr/lib/$lib) &&
    ln -svf ../../lib/$link /usr/lib/$lib
done

The only problem is that you can't repeat the command because it will just keep adding "../../lib/" to the beginning of the existing symlink.

I also changed the mv command so that it moves *.so.* instead of *.so.0* since I wanted to eliminate all notion of the DSO name. However, it would be better to just use --libdir=/lib as you say.

by dnicholson@…, 17 years ago

Attachment: pam-symlinks.patch added

Use readlink to recreate the pam symlinks

comment:3 by Randy McMurchy, 17 years ago

Because your patch is geared to the libraries being installed in /usr/lib and we both agree that we should use --libdir=/lib, the patch will need to be reworked.

It doesn't matter who does it.

If you will, assign either you or me to the ticket, that way I'll know what to do.

Thanks for the input, Dan.

comment:4 by dnicholson@…, 17 years ago

Owner: changed from blfs-book@… to Randy McMurchy

Go for it. I think you've already thought through the --libdir changes.

comment:5 by Randy McMurchy, 17 years ago

Status: newassigned

comment:6 by Randy McMurchy, 17 years ago

Modified the commands to use readlink and eliminate the hard-coding

Also modified the configure command to use --libdir=/lib

Just now noticed Dan's comment about repeating the command things break. Looking into that now.

comment:7 by Randy McMurchy, 17 years ago

okay, this one is easy since we are using --libdir=/lib now.

Just add an

if [ -L /lib/libpam.so ]; then ...; fi

in there and it will only perform the ln actions if the file exists (which it won't after the first time you do it)

comment:8 by dnicholson@…, 17 years ago

That would seem to work. Another option is to throw a basename in with the readlink so you strip away any leading directory stuff.

link=$(basename `readlink /lib/$lib`)

comment:9 by Randy McMurchy, 17 years ago

No, that wouldn't work. The first time you run the command the file will be moved to /usr/lib which breaks the command completely.

I'm just about to commit. But I'll wait for your comment.

comment:10 by Randy McMurchy, 17 years ago

However, the basename method will be needed in the Heimdal instructions that I modified. Thanks for the suggestion, Dan.

comment:11 by dnicholson@…, 17 years ago

Right, go ahead.

comment:12 by Randy McMurchy, 17 years ago

Resolution: fixed
Status: assignedclosed

Added the check so there is no breakage if the symlink creation commands are run more than once.

Note: See TracTickets for help on using tickets.