[Bps-public-commit] r10482 - bpsbuilder/Shipwright/lib/Shipwright

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 24 16:15:45 EST 2008


Author: sunnavy
Date: Thu Jan 24 16:15:45 2008
New Revision: 10482

Modified:
   bpsbuilder/Shipwright/lib/Shipwright/Backend.pm

Log:
automatically find the right perl intepreter in case we relocate, since the shebang line is still the old path

Modified: bpsbuilder/Shipwright/lib/Shipwright/Backend.pm
==============================================================================
--- bpsbuilder/Shipwright/lib/Shipwright/Backend.pm	(original)
+++ bpsbuilder/Shipwright/lib/Shipwright/Backend.pm	Thu Jan 24 16:15:45 2008
@@ -45,10 +45,18 @@
     BASE_DIR=` (cd "$BASE_DIR"; pwd) `
     FILENAME=`basename "$BASE"`
     WRAPPED_DIR=`basename "$BASE_DIR"`
-    PERL5LIB=${BASE_DIR}/../lib/perl5/site_perl:${BASE_DIR}/../lib/perl5:${PERL5LIB}\
+    ISPERL=`head -n 1 ${BASE_DIR}/../${WRAPPED_DIR}-wrapped/${FILENAME} | grep '\bperl\b'`
+    if [ "$ISPERL" ]; then
+        PERL5LIB=${BASE_DIR}/../lib/perl5/site_perl:${BASE_DIR}/../lib/perl5:${PERL5LIB}\
+        LD_LIBRARY_PATH=${BASE_DIR}/../lib:${LD_LIBRARY_PATH}\
+        DYLD_LIBRARY_PATH=${BASE_DIR}/../lib:${DYLD_LIBRARY_PATH}\
+        exec ${BASE_DIR}/../${WRAPPED_DIR}-wrapped/perl ${BASE_DIR}/../${WRAPPED_DIR}-wrapped/${FILENAME}  "$@"
+    else
+        PERL5LIB=${BASE_DIR}/../lib/perl5/site_perl:${BASE_DIR}/../lib/perl5:${PERL5LIB}\
         LD_LIBRARY_PATH=${BASE_DIR}/../lib:${LD_LIBRARY_PATH}\
         DYLD_LIBRARY_PATH=${BASE_DIR}/../lib:${DYLD_LIBRARY_PATH}\
         exec ${BASE_DIR}/../${WRAPPED_DIR}-wrapped/${FILENAME}  "$@"
+    fi
 else
     exec $LINK "$@"
 fi



More information about the Bps-public-commit mailing list