Skip to content

Commit

Permalink
Fix symbolic link handling in the 'links' package section.
Browse files Browse the repository at this point in the history
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 eea5db9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/onlpm.py
Expand Up @@ -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)

#
Expand Down

0 comments on commit eea5db9

Please sign in to comment.