catalyst-auto: construct tempdir with mktemp rather than pid
This way we can sanely use pid namespaces without tempdirs clashing.
This commit is contained in:
parent
9133fc879c
commit
dbacb3edd6
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Copyright 1999-2014 Gentoo Foundation
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# First let's get our own mount namespace to avoid leaking crap.
|
# First let's get our own mount namespace to avoid leaking crap.
|
||||||
if [[ -z ${UNSHARE} ]] ; then
|
if [[ -z ${UNSHARE} ]] ; then
|
||||||
|
@ -8,8 +10,6 @@ if [[ -z ${UNSHARE} ]] ; then
|
||||||
fi
|
fi
|
||||||
unset UNSHARE
|
unset UNSHARE
|
||||||
|
|
||||||
PID=$$
|
|
||||||
|
|
||||||
config_file=
|
config_file=
|
||||||
verbose=0
|
verbose=0
|
||||||
keep_tmpdir=0
|
keep_tmpdir=0
|
||||||
|
@ -118,7 +118,7 @@ fi
|
||||||
|
|
||||||
source ${config_file}
|
source ${config_file}
|
||||||
|
|
||||||
TMPDIR=${TMP_PATH:-/tmp}/catalyst-auto.${PID}
|
TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" catalyst-auto.XXXXXX)
|
||||||
DATESTAMP=$(date +%Y%m%d)
|
DATESTAMP=$(date +%Y%m%d)
|
||||||
|
|
||||||
if [ ${verbose} = 1 ]; then
|
if [ ${verbose} = 1 ]; then
|
||||||
|
@ -126,20 +126,10 @@ if [ ${verbose} = 1 ]; then
|
||||||
echo "DATESTAMP = ${DATESTAMP}"
|
echo "DATESTAMP = ${DATESTAMP}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if tmp directory exists and remove it
|
if ! mkdir -p "${TMPDIR}"/{specs,kconfig,log}; then
|
||||||
if [ -d "${TMPDIR}" ]; then
|
echo "Couldn't create tempdirs!"
|
||||||
if ! rm -rf "${TMPDIR}"; then
|
|
||||||
echo "Couldn't remove stale tmpdir ${TMPDIR}!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
for i in ${TMPDIR} ${TMPDIR}/specs ${TMPDIR}/kconfig ${TMPDIR}/log; do
|
|
||||||
if ! mkdir -p "${i}"; then
|
|
||||||
echo "Couldn't create dir ${i}!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! run_cmd "pre_build" "${TMPDIR}/log/pre_build.log"; then
|
if ! run_cmd "pre_build" "${TMPDIR}/log/pre_build.log"; then
|
||||||
send_email "Catalyst build error - pre_build" "Your pre_build function sucks" "${TMPDIR}/log/pre_build.log"
|
send_email "Catalyst build error - pre_build" "Your pre_build function sucks" "${TMPDIR}/log/pre_build.log"
|
||||||
|
|
Loading…
Reference in a new issue