Commit de38521e authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Tim Gardner

UBUNTU: [Debian] postinst -- improve relative symlink detection with missing files

When the symlinks are made we attempt to use relative links if that
would work.  However this relies on the file we are making the link to to
actually exist.  When it does not we fall back to absolute.  This impacts
the initrd links which are made before we make the initrd itself.

When the caller has asked us to use a specific handle file and that file
does not yet exist, see if there are any other files we can use in that
directory.  In the common case this will be a version specific file and
highly unique.

BugLink: http://bugs.launchpad.net/bugs/1248053Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
parent 8995f9e9
...@@ -217,6 +217,21 @@ sub test_relative { ...@@ -217,6 +217,21 @@ sub test_relative {
die "Internal Error: No such dir $params{'New Dir'} " die "Internal Error: No such dir $params{'New Dir'} "
unless -d $params{'New Dir'}; unless -d $params{'New Dir'};
# If the caller specified a test file, and it does not exist try and find
# another file to use in its stead. As we are installing kernels we can
# use any versioned file from this kernel which should be in the same place.
if (defined $params{'Test File'} and
! -f $params{'Old Dir'} . '/' . $params{'Test File'}) {
my @possible = glob($params{'Old Dir'} . "/*$version*");
if ($#possible >= 0) {
$params{'Test File'} = `basename "$possible[0]"`;
chomp($params{'Test File'});
warn "Test relative: selected $params{'Test File'}"
if $DEBUG;
}
}
warn "Test relative: testing $params{'Old Dir'} -> $params{'New Dir'}" warn "Test relative: testing $params{'Old Dir'} -> $params{'New Dir'}"
if $DEBUG; if $DEBUG;
chomp($cwd = `pwd`); chomp($cwd = `pwd`);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment