[Bps-public-commit] r10412 - bpsbuilder/BPB/lib/BPB

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jan 21 11:22:35 EST 2008


Author: sunnavy
Date: Mon Jan 21 11:22:35 2008
New Revision: 10412

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

Log:
updated wrapper, now we can link stuff in bin to somewhere

Modified: bpsbuilder/BPB/lib/BPB/Backend.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend.pm	Mon Jan 21 11:22:35 2008
@@ -31,16 +31,27 @@
 
 our $WRAPPER = <<'EOF'
 #!/bin/sh
-BASE=$0
-BASE_DIR=`dirname "$BASE"`
-BASE_DIR=` (cd "$BASE_DIR"; pwd) `
-FILENAME=`basename "$BASE"`
-WRAPPED_DIR=`basename "$BASE_DIR"`
-ARCHNAME=`perl -MConfig -e 'print $Config{archname}'`
-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}  "$@"
+if [ -z `which readlink` ]; then  
+    # if we don't have readlink, we're on some pitiful platform like solaris
+    test -h $0 && LINK=`ls -l $0 | awk -F\>  '{print $NF}'`
+else
+    LINK=`readlink $0`
+fi
+
+if [ $LINK = '../etc/bpb-script-wrapper' ]; then
+    BASE=$0
+    BASE_DIR=`dirname "$BASE"`
+    BASE_DIR=` (cd "$BASE_DIR"; pwd) `
+    FILENAME=`basename "$BASE"`
+    WRAPPED_DIR=`basename "$BASE_DIR"`
+    ARCHNAME=`perl -MConfig -e 'print $Config{archname}'`
+    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}  "$@"
+else
+    exec $LINK "$@"
+fi
 EOF
   ;
 



More information about the Bps-public-commit mailing list