Permalink
Browse files

Fix symbolic link handling in the 'links' package section.

The 'links' section specifies symbolic links which should be added to the package in key : value format.

The key is the source of the link. It must be exist in the filesystem already (as part of the 'files' section)
and be relative to the root of the filesystem.

The value is the name of the link, and can be relative or absolute to the final filesystem.

For example, given that a package produces the real binary "/usr/bin/foobar" and you want /usr/bin/foobar-link -> /usr/bin/foobar
it will be specified as follows:

    links:
        /usr/bin/foobar : /usr/bin/foobar-link
  • Loading branch information...
jnealtowns committed Aug 8, 2018
1 parent 73755f1 commit eea5db9aefac9d276f7c7f3b396cff4bb2f7d179
Showing with 7 additions and 2 deletions.
  1. +7 −2 tools/onlpm.py
View
@@ -362,9 +362,14 @@ def build(self, dir_=None):
if os.path.exists(src):
OnlPackage.copyf(src, dst, root)
for (link,src) in self.pkg.get('links', {}).iteritems():
for (link, src) in self.pkg.get('links', {}).iteritems():
logger.info("Linking %s -> %s..." % (link, src))
link = os.path.join(root, link)
# The source must be relative to the existing root directory.
if link.startswith('/'):
link = "%s%s" % (root, link)
else:
link = "%s/%s" % (root, link)
# The link must be relative or absolute to the final filesystem.
os.symlink(src, link)
#

0 comments on commit eea5db9

Please sign in to comment.