Magellan Linux

Diff of /branches/mage-next/src/mage4.functions.sh

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

revision 1952 by niro, Fri Oct 12 12:59:32 2012 UTC revision 2156 by niro, Wed Aug 14 07:25:43 2013 UTC
# Line 102  mcheckemptydir() Line 102  mcheckemptydir()
102   return ${retval}   return ${retval}
103  }  }
104    
105    unpack_package()
106    {
107     local magefile="$1"
108     local pkg
109     local pkgtype
110     local tar_opts
111    
112     pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}"
113     pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})"
114    
115     xtitle "[ Unpacking ${pkg} ]"
116    
117     # abort on virtual pkg
118     if [[ ${pkgtype} = virtual ]]
119     then
120     echo -ne " ${COLBLUE}---${COLDEFAULT}"
121     echo " !unpack virtual ${pkg/.${PKGSUFFIX}/} ... "
122     continue
123     fi
124    
125     # abort on sources pkg
126     if [[ ${pkgtype} = sources ]]
127     then
128     echo -ne " ${COLBLUE}---${COLDEFAULT}"
129     echo " !unpack sources ${pkg/.${PKGSUFFIX}/} ... "
130     continue
131     fi
132    
133     # busybox?
134     if need_busybox_support tar
135     then
136     tar_opts="xjf"
137     else
138     tar_opts="xjmf"
139     fi
140    
141     echo -e " ${COLBLUE}***${COLDEFAULT} unpacking ${pkg} ... "
142     tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}"
143    }
144    
145  unpack_packages()  unpack_packages()
146  {  {
147   local list="$@"   local list="$@"
148   local magefile   local magefile
  local pkg  
  local pkgtype  
149   local count_current   local count_current
150   local count_total   local count_total
151   local tar_opts   local tar_opts
# Line 120  unpack_packages() Line 158  unpack_packages()
158    
159   for magefile in ${list}   for magefile in ${list}
160   do   do
161   pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}"   unpack_package "${magefile}"
  pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})"  
   
162   (( count_current++ ))   (( count_current++ ))
  xtitle "[ (${count_current}/${count_total}) Unpacking ${pkg} ]"  
   
  # abort on virtual pkg  
  if [[ ${pkgtype} = virtual ]]  
  then  
  echo -ne " ${COLBLUE}---${COLDEFAULT}"  
  echo " !unpack virtual (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... "  
  continue  
  fi  
   
  # abort on sources pkg  
  if [[ ${pkgtype} = sources ]]  
  then  
  echo -ne " ${COLBLUE}---${COLDEFAULT}"  
  echo " !unpack sources (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... "  
  continue  
  fi  
   
  # busybox?  
  if need_busybox_support tar  
  then  
  tar_opts="xjf"  
  else  
  tar_opts="xjmf"  
  fi  
   
  echo -e " ${COLBLUE}***${COLDEFAULT} unpacking (${count_current}/${count_total}): ${pkg} ... "  
  tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}"  
163   done   done
164    
165   # add a crlf for a better view   # add a crlf for a better view
# Line 1605  syncmage_tarball() Line 1613  syncmage_tarball()
1613   then   then
1614   if ! mcheckemptydir ${MAGEDIR}   if ! mcheckemptydir ${MAGEDIR}
1615   then   then
1616   find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r   find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xargs --no-run-if-empty rm -r
1617   fi   fi
1618   else   else
1619   rm -rf ${MAGEDIR}   rm -rf ${MAGEDIR}
# Line 1887  count_protected_files() Line 1895  count_protected_files()
1895   count="$(echo ${oldprotected} | sed 's:.*\/._cfg\(.*\)_.*:\1:')"   count="$(echo ${oldprotected} | sed 's:.*\/._cfg\(.*\)_.*:\1:')"
1896   done   done
1897    
1898   # dirty hack to convert 0001 -> 1; 0120 -> 120 etc   # convert 0001 -> 1; 0120 -> 120 etc
1899   x="${#count}"   # use bash internal base functions to this task
1900     x="$((10#${count}))"
1901   for (( i=0; i<x; i++ ))   for (( i=0; i<x; i++ ))
1902   do   do
1903   if [[ ${count:${i}:1} != 0 ]]   if [[ ${count:${i}:1} != 0 ]]
# Line 2688  mage_install() Line 2697  mage_install()
2697   if [[ ${PKGTYPE} != virtual ]] && \   if [[ ${PKGTYPE} != virtual ]] && \
2698   [[ ${PKGTYPE} != sources ]]   [[ ${PKGTYPE} != sources ]]
2699   then   then
2700     unpack_package "${magefile}"
2701   echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... "   echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... "
2702   build_doinstall ${PKGNAME}   build_doinstall ${PKGNAME}
2703   fi   fi
# Line 3119  pkgsearch() Line 3129  pkgsearch()
3129   "") continue;;   "") continue;;
3130   esac   esac
3131    
3132   deps="${deps} $(basename ${dep%-*})"   if [[ -z ${deps} ]]
3133     then
3134     deps="$(basename ${dep%-*})"
3135     else
3136     deps="${deps} $(basename ${dep%-*})"
3137     fi
3138   done << EOF   done << EOF
3139  ${depsfull}  ${depsfull}
3140  EOF  EOF
# Line 3130  EOF Line 3145  EOF
3145   "") continue;;   "") continue;;
3146   esac   esac
3147    
3148   sdeps="${sdeps} $(basename ${dep%-*})"   if [[ -z ${sdeps} ]]
3149     then
3150     sdeps="$(basename ${dep%-*})"
3151     else
3152     sdeps="${sdeps} $(basename ${dep%-*})"
3153     fi
3154   done << EOF   done << EOF
3155  ${sdepsfull}  ${sdepsfull}
3156  EOF  EOF
# Line 3144  EOF Line 3164  EOF
3164   then   then
3165   echo "      License:  ${license}"   echo "      License:  ${license}"
3166   fi   fi
3167   echo "      Depends: ${deps}"   echo "      Depends:  ${deps}"
3168   echo "      SDepends: ${sdeps}"   echo "      SDepends: ${sdeps}"
3169   echo   echo
3170    

Legend:
Removed from v.1952  
changed lines
  Added in v.2156