--- trunk/mage/usr/lib/mage/mage4.functions.sh 2012/01/13 23:17:40 1653 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2012/01/13 23:20:39 1654 @@ -1605,7 +1605,16 @@ then echo -ne "${COLBLUE} --- ${COLDEFAULT}" echo "cleaning old mage-tree ${MAGEDIR}..." - rm -rf ${MAGEDIR} + # honor mountpoints and empty dirs + if mountpoint -q ${MAGEDIR} + then + if ! mcheckemptydir ${MAGEDIR} + then + find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r + fi + else + rm -rf ${MAGEDIR} + fi fi if need_busybox_support tar