HBASE-20134 dev-support scripts should use mktemp instead of hard-coding /tmp.
Signed-off-by: Mike Drob <mdrob@apache.org>
This commit is contained in:
parent
b7fb2df154
commit
ff7f5ecb0f
|
@ -21,7 +21,7 @@ function usage {
|
||||||
echo "Usage: ${0} [options] /path/to/component/checkout"
|
echo "Usage: ${0} [options] /path/to/component/checkout"
|
||||||
echo ""
|
echo ""
|
||||||
echo " --intermediate-file-dir /path/to/use Path for writing listings and diffs. must exist."
|
echo " --intermediate-file-dir /path/to/use Path for writing listings and diffs. must exist."
|
||||||
echo " defaults to making a directory in /tmp."
|
echo " defaults to making a directory via mktemp."
|
||||||
echo " --unpack-temp-dir /path/to/use Path for unpacking tarball. default to"
|
echo " --unpack-temp-dir /path/to/use Path for unpacking tarball. default to"
|
||||||
echo " 'unpacked_src_tarball' in intermediate directory."
|
echo " 'unpacked_src_tarball' in intermediate directory."
|
||||||
echo " --maven-m2-initial /path/to/use Path for maven artifacts while building in"
|
echo " --maven-m2-initial /path/to/use Path for maven artifacts while building in"
|
||||||
|
@ -67,11 +67,10 @@ fi
|
||||||
component_dir="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
component_dir="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
||||||
|
|
||||||
if [ -z "${working_dir}" ]; then
|
if [ -z "${working_dir}" ]; then
|
||||||
working_dir=/tmp
|
if ! working_dir="$(mktemp -d -t hbase-srctarball-test)" ; then
|
||||||
while [[ -e ${working_dir} ]]; do
|
echo "Failed to create temporary working directory. Please specify via --unpack-temp-dir"
|
||||||
working_dir=/tmp/hbase-srctarball-test-${RANDOM}.${RANDOM}
|
exit 1
|
||||||
done
|
fi
|
||||||
mkdir "${working_dir}"
|
|
||||||
else
|
else
|
||||||
# absolutes please
|
# absolutes please
|
||||||
working_dir="$(cd "$(dirname "${working_dir}")"; pwd)/$(basename "${working_dir}")"
|
working_dir="$(cd "$(dirname "${working_dir}")"; pwd)/$(basename "${working_dir}")"
|
||||||
|
|
|
@ -40,7 +40,7 @@ function usage {
|
||||||
echo ""
|
echo ""
|
||||||
echo " --working-dir /path/to/use Path for writing logs and a local checkout of hbase-site repo."
|
echo " --working-dir /path/to/use Path for writing logs and a local checkout of hbase-site repo."
|
||||||
echo " if given must exist."
|
echo " if given must exist."
|
||||||
echo " defaults to making a directory in /tmp."
|
echo " defaults to making a directory via mktemp."
|
||||||
echo " --local-repo /path/for/maven/.m2 Path for putting local maven repo."
|
echo " --local-repo /path/for/maven/.m2 Path for putting local maven repo."
|
||||||
echo " if given must exist."
|
echo " if given must exist."
|
||||||
echo " defaults to making a clean directory in --working-dir."
|
echo " defaults to making a clean directory in --working-dir."
|
||||||
|
@ -77,12 +77,11 @@ fi
|
||||||
component_dir="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
component_dir="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
||||||
|
|
||||||
if [ -z "${working_dir}" ]; then
|
if [ -z "${working_dir}" ]; then
|
||||||
echo "[DEBUG] defaulting to creating a directory in /tmp"
|
echo "[DEBUG] defaulting to creating a directory via mktemp"
|
||||||
working_dir=/tmp
|
if ! working_dir="$(mktemp -d -t hbase-generate-website)" ; then
|
||||||
while [[ -e ${working_dir} ]]; do
|
echo "Failed to create temporary working directory. Please specify via --working-dir"
|
||||||
working_dir=/tmp/hbase-generate-website-${RANDOM}.${RANDOM}
|
exit 1
|
||||||
done
|
fi
|
||||||
mkdir "${working_dir}"
|
|
||||||
else
|
else
|
||||||
# absolutes please
|
# absolutes please
|
||||||
working_dir="$(cd "$(dirname "${working_dir}")"; pwd)/$(basename "${working_dir}")"
|
working_dir="$(cd "$(dirname "${working_dir}")"; pwd)/$(basename "${working_dir}")"
|
||||||
|
|
Loading…
Reference in New Issue