Magellan Linux

Diff of /trunk/mage/usr/lib/mage/mage4.functions.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1652 by niro, Fri Jan 13 23:16:36 2012 UTC revision 1654 by niro, Fri Jan 13 23:20:39 2012 UTC
# Line 82  mchecksum() Line 82  mchecksum()
82   return "${retval}"   return "${retval}"
83  }  }
84    
85    mcheckemptydir()
86    {
87     local dir="$1"
88     local retval=1
89    
90     if [[ ! -d ${dir} ]]
91     then
92     echo "mcheckemptydir(): '${dir}' is not a directory!"
93     retval=3
94     else
95     shopt -s nullglob dotglob
96     files=( ${dir}/* )
97     (( ${#files[*]} )) || retval=0
98     shopt -u nullglob dotglob
99     fi
100    
101     return ${retval}
102    }
103    
104  unpack_packages()  unpack_packages()
105  {  {
106   local list="$@"   local list="$@"
# Line 1586  syncmage_tarball() Line 1605  syncmage_tarball()
1605   then   then
1606   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1607   echo "cleaning old mage-tree ${MAGEDIR}..."   echo "cleaning old mage-tree ${MAGEDIR}..."
1608   rm -rf ${MAGEDIR}   # honor mountpoints and empty dirs
1609     if mountpoint -q ${MAGEDIR}
1610     then
1611     if ! mcheckemptydir ${MAGEDIR}
1612     then
1613     find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r
1614     fi
1615     else
1616     rm -rf ${MAGEDIR}
1617     fi
1618   fi   fi
1619    
1620   if need_busybox_support tar   if need_busybox_support tar

Legend:
Removed from v.1652  
changed lines
  Added in v.1654