Magellan Linux

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

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

revision 1650 by niro, Fri Jan 13 21:05:41 2012 UTC revision 1658 by niro, Sat Jan 14 00:00:53 2012 UTC
# Line 72  mchecksum() Line 72  mchecksum()
72   if [[ -d ${rundir} ]]   if [[ -d ${rundir} ]]
73   then   then
74   pushd ${rundir} &> /dev/null   pushd ${rundir} &> /dev/null
75   ${cmd} -c ${file} &> /dev/null   # be verbose here
76     ${cmd} -c ${file} #&> /dev/null
77   retval="$?"   retval="$?"
78   popd &> /dev/null   popd &> /dev/null
79   else   else
# Line 82  mchecksum() Line 83  mchecksum()
83   return "${retval}"   return "${retval}"
84  }  }
85    
86    mcheckemptydir()
87    {
88     local dir="$1"
89     local retval=1
90    
91     if [[ ! -d ${dir} ]]
92     then
93     echo "mcheckemptydir(): '${dir}' is not a directory!"
94     retval=3
95     else
96     shopt -s nullglob dotglob
97     files=( ${dir}/* )
98     (( ${#files[*]} )) || retval=0
99     shopt -u nullglob dotglob
100     fi
101    
102     return ${retval}
103    }
104    
105  unpack_packages()  unpack_packages()
106  {  {
107   local list="$@"   local list="$@"
# Line 1579  syncmage_tarball() Line 1599  syncmage_tarball()
1599   else   else
1600   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1601   echo -n "checking md5sum... "   echo -n "checking md5sum... "
1602   ( cd ${temp}; md5sum -c ${latest_md5} ) || die "md5 for ${latest_tarball} failed"   mchecksum --rundir "${temp}" --file "${latest_md5}" --method md5 || die "md5 for ${latest_tarball} failed"
1603   fi   fi
1604    
1605   if [[ -d ${MAGEDIR} ]]   if [[ -d ${MAGEDIR} ]]
1606   then   then
1607   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1608   echo "cleaning old mage-tree ${MAGEDIR}..."   echo "cleaning old mage-tree ${MAGEDIR}..."
1609   rm -rf ${MAGEDIR}   # honor mountpoints and empty dirs
1610     if mountpoint -q ${MAGEDIR}
1611     then
1612     if ! mcheckemptydir ${MAGEDIR}
1613     then
1614     find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r
1615     fi
1616     else
1617     rm -rf ${MAGEDIR}
1618     fi
1619   fi   fi
1620    
1621   if need_busybox_support tar   if need_busybox_support tar
# Line 2762  md5sum_packages() Line 2791  md5sum_packages()
2791   then   then
2792   echo -ne "${COLBLUE} *** ${COLDEFAULT}"   echo -ne "${COLBLUE} *** ${COLDEFAULT}"
2793   echo -ne "checking md5sum (${count_current}/${count_total}): "   echo -ne "checking md5sum (${count_current}/${count_total}): "
2794   ( cd ${PKGDIR}; md5sum -c ${md5file}) || die "md5 for ${pkgfile} failed"   mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 || die "md5 for ${pkgfile} failed"
2795   else   else
2796   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2797   echo -e "!! no md5sum file found for ${pkgfile} :("   echo -e "!! no md5sum file found for ${pkgfile} :("

Legend:
Removed from v.1650  
changed lines
  Added in v.1658