run-in-tempdir 445 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 15 16 17
mkdir -p $tmpdir/htools
if [ -e htools/test ]; then
  cp -p htools/test $tmpdir/htools/
fi
18

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