Make use of TMPDIR when using mktemp(1). Minor fixes and changes at automatic generated mountpoint removal.
This commit is contained in:
parent
4025f07c3f
commit
15c57f01bc
6
beadm
6
beadm
|
|
@ -426,7 +426,7 @@ case ${1} in
|
||||||
# do not change root (/) mounted boot environment mountpoint
|
# do not change root (/) mounted boot environment mountpoint
|
||||||
if [ "${ROOTFS}" != "${POOL}/ROOT/${2}" ]
|
if [ "${ROOTFS}" != "${POOL}/ROOT/${2}" ]
|
||||||
then
|
then
|
||||||
TMPMNT=$( mktemp -d /tmp/BE-${2}.XXXXXX )
|
TMPMNT=$( mktemp -d -t BE-${2} )
|
||||||
if ! mkdir -p ${TMPMNT} 2> /dev/null
|
if ! mkdir -p ${TMPMNT} 2> /dev/null
|
||||||
then
|
then
|
||||||
echo "ERROR: Cannot create '${TMPMNT}' directory"
|
echo "ERROR: Cannot create '${TMPMNT}' directory"
|
||||||
|
|
@ -642,7 +642,7 @@ EOF
|
||||||
(mount) # ------------------------------------------------------------
|
(mount) # ------------------------------------------------------------
|
||||||
if [ ${#} -eq 2 ]
|
if [ ${#} -eq 2 ]
|
||||||
then
|
then
|
||||||
TARGET=$( mktemp -d /tmp/BE-${2}.XXXXXX )
|
TARGET=$( mktemp -d -t BE-${2} )
|
||||||
elif [ ${#} -eq 3 ]
|
elif [ ${#} -eq 3 ]
|
||||||
then
|
then
|
||||||
TARGET=${3}
|
TARGET=${3}
|
||||||
|
|
@ -736,7 +736,7 @@ EOF
|
||||||
done
|
done
|
||||||
echo "Unmounted successfully"
|
echo "Unmounted successfully"
|
||||||
# only delete the temporary mountpoint directory
|
# 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
|
then
|
||||||
# delete only when it is an empty directory
|
# delete only when it is an empty directory
|
||||||
if [ $( find ${MOUNTPOINT} | head | wc -l | bc ) -eq 1 ]
|
if [ $( find ${MOUNTPOINT} | head | wc -l | bc ) -eq 1 ]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue