Make use of TMPDIR when using mktemp(1). Minor fixes and changes at automatic generated mountpoint removal.

This commit is contained in:
Slawomir Wojciech Wojtczak (vermaden) 2012-10-31 13:42:29 +01:00
parent 4025f07c3f
commit 15c57f01bc
1 changed files with 3 additions and 3 deletions

6
beadm
View File

@ -426,7 +426,7 @@ case ${1} in
# do not change root (/) mounted boot environment mountpoint
if [ "${ROOTFS}" != "${POOL}/ROOT/${2}" ]
then
TMPMNT=$( mktemp -d /tmp/BE-${2}.XXXXXX )
TMPMNT=$( mktemp -d -t BE-${2} )
if ! mkdir -p ${TMPMNT} 2> /dev/null
then
echo "ERROR: Cannot create '${TMPMNT}' directory"
@ -642,7 +642,7 @@ EOF
(mount) # ------------------------------------------------------------
if [ ${#} -eq 2 ]
then
TARGET=$( mktemp -d /tmp/BE-${2}.XXXXXX )
TARGET=$( mktemp -d -t BE-${2} )
elif [ ${#} -eq 3 ]
then
TARGET=${3}
@ -736,7 +736,7 @@ EOF
done
echo "Unmounted successfully"
# only delete the temporary mountpoint directory
if echo "${MOUNTPOINT}" | grep -q "/tmp/BE-${2}." 1> /dev/null 2> /dev/null
if echo "${MOUNTPOINT}" | grep -q -E "/BE-${2}\.[a-zA-Z0-9]{8}" 1> /dev/null 2> /dev/null
then
# delete only when it is an empty directory
if [ $( find ${MOUNTPOINT} | head | wc -l | bc ) -eq 1 ]