You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build-functions.sh 595B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # Provides functions that are used in multiple scripts in the build process
  3. function safe_mktemp {
  4. if [ -x "`which mktemp`" ] ; then
  5. TMPDIR=`mktemp -d`
  6. else
  7. if [ -d "$TMP" ] ; then
  8. # We're running under Windows then use the global TMP location
  9. TMPDIR="$TMP/$1-`date +%s`-$$-$RANDOM"
  10. else
  11. TMPDIR="`pwd`/build/temp/$1-$$-$RANDOM"
  12. fi
  13. # this is fragile
  14. if [ -d "$TMPDIR" ] ; then
  15. echo "no suitable temp folder found"
  16. exit 2
  17. fi
  18. mkdir -p "$TMPDIR"
  19. if [ ! -d "$TMPDIR" ] ; then
  20. echo "no suitable temp folder found"
  21. exit 2
  22. fi
  23. fi
  24. echo $TMPDIR
  25. }