diff --git a/src/bin/sage-rebase.sh b/src/bin/sage-rebase.sh index 46f0affb987..ba17749b964 100755 --- a/src/bin/sage-rebase.sh +++ b/src/bin/sage-rebase.sh @@ -9,8 +9,17 @@ # Note that subsequent calls to 'rebaseall' will not update the Sage dlls. # # Invoke this script from a shell after going to the SAGE_LOCAL directory. +SAGE_LOCAL=${1%/} + +if [ -z "$SAGE_LOCAL" ]; then + # Assume we are in $SAGE_LOCAL by default (the old behavior of this script) + SAGE_LOCAL=. +fi + +FINDFLAGS="-type f ( -name *.dll -o -name *.so -o -name *.fas ) -print" +FINDFLAGS="$FINDFLAGS -o -path "$SAGE_LOCAL"/var/tmp -prune" echo "Getting list of dlls. This may take a while..." -/bin/find . -name "*.dll" -o -name "*.so" -o -name "*.fas" > /tmp/sage-dlls.lst +/bin/find "$SAGE_LOCAL" $FINDFLAGS > /tmp/sage-dlls.lst echo "Now rebasing..." /bin/rebase -O -T /tmp/sage-dlls.lst diff --git a/src/bin/sage-rebaseall.sh b/src/bin/sage-rebaseall.sh index f43d73f39e5..6db661c00d4 100755 --- a/src/bin/sage-rebaseall.sh +++ b/src/bin/sage-rebaseall.sh @@ -16,7 +16,17 @@ # Note that you need write access to the system-wide rebase database # (which usually means admin rights). +SAGE_LOCAL=${1%/} + +if [ -z "$SAGE_LOCAL" ]; then + # Assume we are in $SAGE_LOCAL by default (the old behavior of this script) + SAGE_LOCAL=. +fi + +FINDFLAGS="-type f ( -name *.dll -o -name *.so -o -name *.fas ) -print" +FINDFLAGS="$FINDFLAGS -o -path "$SAGE_LOCAL"/var/tmp -prune" + echo "Getting list of dlls. This may take a while..." -/bin/find . -name "*.dll" -o -name "*.so" -o -name "*.fas" > /tmp/sage-dlls.lst +/bin/find "$SAGE_LOCAL" $FINDFLAGS > /tmp/sage-dlls.lst echo "Now rebasing..." /bin/rebaseall -s dll -s exe -s so -s fas -T /tmp/sage-dlls.lst