chiark / gitweb /
nailing-cargo: Record $base_path from linking goose-hunting
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 17:41:01 +0000 (18:41 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 17:41:01 +0000 (18:41 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
nailing-cargo

index 806f7bde40e6ba4f6d360d256d17fb70c8a2a85c..22d5dd5cea87233c3f7d6848606bccd3e7f99bad 100755 (executable)
@@ -39,6 +39,7 @@ use Types::Serialiser;
 use File::Glob qw(bsd_glob GLOB_ERR GLOB_BRACE GLOB_NOMAGIC);
 use Cwd qw(realpath);
 
+our $base_path;
 our %archmap = (
     RPI => 'arm-unknown-linux-gnueabihf',
 );
@@ -46,6 +47,7 @@ our %archmap = (
 BEGIN {
   $self = $0;  $self =~ s{^.*/(?=.)}{};
   my $deref = $0;
+  our $base_path;
   while ($deref =~ m{^/}) {
     my $link = readlink $deref;
     if (!defined $link) {
@@ -53,6 +55,7 @@ BEGIN {
        or die "$self: checking our script location $deref: $!\n";
       $deref =~ s{/[^/]+$}{}
        or die "$self: unexpected script path: $deref\n";
+      $base_path = $deref;
       unshift @INC, $deref."/TOML-Tiny/lib";
       last;
     }