run-in-tempdir 523 Bytes
Newer Older
1 2
#!/bin/bash

3 4 5
# Helper for running things in a temporary directory; used for docs
# building, unittests, etc.

6 7 8 9 10
set -e

tmpdir=$(mktemp -d -t gntbuild.XXXXXXXX)
trap "rm -rf $tmpdir" EXIT

11
cp -r autotools daemons scripts lib tools test $tmpdir
12
mv $tmpdir/lib $tmpdir/ganeti
13
ln -T -s $tmpdir/ganeti $tmpdir/lib
14
mkdir -p $tmpdir/htools
15 16 17 18 19
for htest in htools test offline-test.sh cli-tests-defs.sh; do
  if [ -e htools/$htest ]; then
    cp -p htools/$htest $tmpdir/htools/
  fi
done
20

Iustin Pop's avatar
Iustin Pop committed
21
cd $tmpdir && GANETI_TEMP_DIR="$tmpdir" "$@"