Skip to content
Snippets Groups Projects
Commit a38cf361 authored by Avi Kivity's avatar Avi Kivity
Browse files

mkbootfs: hack around absolute symbolic links in source

Absolute symbolic links refer to the host directory structure, while we
want them to refer to the external/ tree.  Since we have several trees,
we can't just rebase them, so walk down the tree trying to find a match.

Fragile and ugly, but seems to work.
parent fff7241a
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,22 @@ def expand(items):
else:
yield (name, hostname)
def unsymlink(f):
try:
link = os.readlink(f)
if link.startswith('/'):
# try to find a match
base = os.path.dirname(f)
while not os.path.exists(base + link):
base = os.path.dirname(base)
else:
base = os.path.dirname(f) + '/'
return unsymlink(base + link)
except Exception:
return f
files = list(expand(files.items()))
files = [(x, unsymlink(y)) for (x, y) in files]
pos = (len(files) + 1) * metadata_size
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment