1
0
Fork 0
forked from mirrors/openup

Make sure we are not running several instances.

idea from otto@openbsd
This commit is contained in:
Antoine Jacoutot 2014-05-28 10:44:35 +02:00
commit b3e6f5f7e0

11
openup
View file

@ -95,10 +95,11 @@ _TMPDIR=$(mktemp -dp ${_TMP} .openup-XXXXXXXXXX) || exit 1
_TMPKEY="${_TMPDIR}/key"
_TMPSPLITCERT="${_TMPDIR}/cert"
_TMPVUXML="${_TMPDIR}/vuxml"
_PID="/var/run/${0##*/}.pid"
export PKG_PATH=${PKG_PATH_UPDATE}:${PKG_PATH_MAIN}
trap "rm -rf ${_TMPDIR}" 1 2 3 13 15
trap "rm -rf ${_TMPDIR} ${_PID}" 1 2 3 13 15
pr_bigarrow() {
if [ -z "${checkmode}" ]; then
@ -303,6 +304,13 @@ if [ "${checkmode}" ]; then
fi
fi
if [ -f ${_PID} ]; then
pr_error "openup is already running ($(cat ${_PID})):"
pr_error "${_PID}"
exit 1
fi
echo $$ >${_PID}
check_openupd
if [ -n "${exclude_kernel}" ]; then
@ -330,3 +338,4 @@ fi
do_i_need_to_reboot
rm -rf ${_TMPDIR}
rm ${_PID}