On Tue, 24 Nov 2009 14:54:14 +0800 Ray Rashif <schivmeister@gmail.com> wrote:
crap, read it the wrong way:
ln -s $pkgdir/foo foo will evaluate $pkgdir and link there, so eg. $pkgdir/usr is not really /usr. ln -s foo $pkgdir/foo will still refer to the real location so that is fine, right?
Basically, yeah. The first argument is just text and doesn't need to correspond to any actual path on the system. When the link is read, it returns that text and the system interprets it as a path. The second argument is just the output location where the link should be created. So "ln -s $pkgdir/foo foo" creates a link named foo in the local directory. When the sysem reads it, it sees something like "/tmp/build/bar/pkg/foo" and will look for that path regardless of where it finds the link on the system (e.g. in $pkgdir, in /usr). That's why you must never include "$pkgdir" in the first argument. The link should always point to the installed file, e.g. /usr/lib/foo. The second argument is just the output location where the link will be created. You can add "$pkgdir" to create it directly in $pkgdir, but you could created it anywhere else and move it there later (there's no reason to do more work, but you could). Then there are absolute paths vs relative paths, e.g. "ln -s ../bar foo", which says "wherever you are, go up one directory and then open something called bar". If you move that to a different directory, it will point to a different "bar" (which might not even exist). On the other hand, "ln -s /usr/lib/bar foo" says "wherever you are, go to the root directory, then open "usr", then "lib" and finally "bar". You can move that link anywhere on the system and it will still point to the same target. Back in 1973 when Harry Worthi.... Sorry, that's all the time we have for today's discussion. Join us again next week when Xyne bores you with more knowledge gained from playing with FUSE.