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

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