Small fix.
This commit is contained in:
parent
04b711ec1d
commit
09ef38e277
6
build.sh
6
build.sh
@ -79,10 +79,12 @@ fi
|
|||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
# Mutex
|
# Mutex
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
readonly SIGNATURE="$(date +"%s")-$$"
|
||||||
readonly LOCK_FILE="${BASE_DIR}/build/lockfile.${MY_CPU}"
|
readonly LOCK_FILE="${BASE_DIR}/build/lockfile.${MY_CPU}"
|
||||||
readonly TEMP_FILE="$(mktemp /tmp/lockfile_XXXXX)"
|
readonly TEMP_FILE="$(mktemp /tmp/lockfile_XXXXX)"
|
||||||
echo "$$" > "${TEMP_FILE}" && mv -n "${TEMP_FILE}" "${LOCK_FILE}"
|
printf "%s" "${SIGNATURE}" > "${TEMP_FILE}"
|
||||||
if [ "$(cat "${LOCK_FILE}")" != "$$" ] ; then
|
mv -n "${TEMP_FILE}" "${LOCK_FILE}"; rm -f "${TEMP_FILE}"
|
||||||
|
if [ "$(sed '/^$/d' "${LOCK_FILE}" | head -n1)" != "${SIGNATURE}" ] ; then
|
||||||
echo 'Error: Build process is already in progress !!!'
|
echo 'Error: Build process is already in progress !!!'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user