Magellan Linux

Diff of /branches/mage-next/src/mage.in

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

trunk/mage/usr/lib/mage/mage4.sh revision 236 by niro, Sat Sep 10 13:35:31 2005 UTC branches/mage-next/src/mage.in revision 2620 by niro, Tue Mar 4 15:42:54 2014 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/bash
2  # Magellan Linux Installer (mage.sh)  # Magellan Linux Installer (mage.sh)
3  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.5 2005-09-10 13:35:31 niro Exp $  # $Id$
4    
5  # default die function  # set default variables
6  die()  : ${MAGERC="@@SYSCONFDIR@@/mage.rc"}
7  {  : ${MLIBDIR="@@MAGELIBDIR@@"}
8   echo -e ${COLRED}"$@"${COLDEFAULT}  
9   exit 1  # first of all include common functions
10  }  source ${MLIBDIR}/common.functions.sh
11    source @@SYSCONFDIR@@/mage.rc.global
12  # include all needed files  source ${MAGERC}
13  [ -f /etc/mage.rc.global ] &&  \  source ${MLIBDIR}/mage4.functions.sh
  source /etc/mage.rc.global || \  
  die "/etc/mage.rc.global missing"  
   
 [ -f /etc/mage.rc ] && source /etc/mage.rc || \  
  die "Your /etc/mage.rc is missing. Aborting."  
   
 [ -f ${MLIBDIR}/mage4.functions.sh ] && \  
  source ${MLIBDIR}/mage4.functions.sh || \  
  die "mage functions missing"  
   
 # for tests only  
 #source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global  
 #source /etc/mage.rc  
 #source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh  
 #MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage  
   
 ## only for tests -> normally in /etc/rc.d/init.d/functions  
 COLRED="\033[1;6m\033[31m"  
 COLGREEN="\033[1;6m\033[32m"  
 COLYELLOW="\033[1;6m\033[33m"  
 COLBLUE="\033[1;6m\033[34m"  
 COLMAGENTA="\033[1;6m\033[35m"  
 COLWHITE="\033[1;6m\033[37m"  
 COLGRAY="\033[0;6m\033[37m"  
 COLDEFAULT="\033[0m"  
   
 if [[ ${NOCOLORS} = true ]]  
 then  
  COLRED=""  
  COLGREEN=""  
  COLYELLOW=""  
  COLBLUE=""  
  COLMAGENTA=""  
  COLWHITE=""  
  COLGRAY=""  
  COLDEFAULT=""  
 fi  
14    
15  # export default path  # export default path
16  export PATH="${PATH}:${MLIBDIR}"  export PATH="${PATH}:${MLIBDIR}"
# Line 58  export LC_ALL=C Line 21  export LC_ALL=C
21  # sanity checks  # sanity checks
22  [ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE}  [ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE}
23    
24  if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]]  if [ ! -e ${VIRTUALDB_DEFAULTS} ] &&
25     [[ $1 != update ]] &&
26     [[ $1 != update-rsync ]] &&
27     [[ $1 != update-tarball ]]
28  then  then
29   echo   echo
30   echo "Please choose an profile from the mage tree."   echo "Please choose an profile from the mage tree."
31   echo "ln -snf ${MAGEDIR}/profiles/profilename /etc/mage-profile"   echo "ln -snf ${MAGEDIR}/profiles/profilename @@SYSCONFDIR@@/mage-profile"
32   exit 1   exit 1
33  fi  fi
34    
35  # default messages  # default messages
36  showversion() {  print_usage()
37   local MAGEVERSION="$(< ${MLIBDIR}/version)"  {
38     #showversion
39   echo -en "Magellan Package Manager v${MAGEVERSION} "   #echo
  echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"  
 }  
   
 print_usage(){  
  showversion  
  echo  
40   echo "Usage: $(basename $0) [option] pkgname ..."   echo "Usage: $(basename $0) [option] pkgname ..."
41   echo "Options:"   echo "Options:"
42   echo "     pretend        - pretends dependencies of a package"   echo "    pretend         - pretends dependencies of a package"
43   echo "     srcpretend     - pretends dependencies of a package (build from source)"   echo "    srcpretend      - pretends dependencies of a package (build from source)"
44   echo "     install        - installs a package"   echo "    install         - installs a package"
45   echo "     srcinstall     - installs a package from source"   echo "    srcinstall      - installs a package from source"
46   echo "     uninstall      - removes a package"   echo "    uninstall       - removes a package"
47   echo "     update         - updates mage-tree"   echo "    update          - updates the mage-tree via default sync method"
48   echo "     uppretend      - pretend dependencies for a system upgrade"   echo "    update-rsync    - updates the mage-tree via rsync"
49   echo "     upgrade        - runs a complete system upgrade"   echo "    update-tarball  - updates the mage-tree via a tarball"
50   echo "     srcuppretend   - pretend dependencies for a system upgrade from source"   echo "    uppretend       - pretend dependencies for a system upgrade"
51   echo "     srcupgrade     - runs a complete system upgrade from source"   echo "    upgrade         - runs a complete system upgrade"
52   echo "     search         - searches mage-tree for a package"   echo "    srcuppretend    - pretend dependencies for a system upgrade from source"
53   echo "     clean          - removes *all* downloaded packages"   echo "    srcupgrade      - runs a complete system upgrade from source"
54   echo "     unpack         - unpacks *all* needed package for 'foo'"   echo "    pretend-build-prerequisites - prints build prerequisites"
55   echo "     download       - downloads *all* needed packages for 'foo'"   echo "    install-build-prerequisites - install build prerequisites"
56   echo "     version        - prints version info"   echo "    run-preinstall  - runs preinstall part of an installed package"
57     echo "    run-postinstall - runs postinstall part of an installed package"
58     echo "    search          - searches mage-tree for a package"
59     echo "    clean           - removes *all* downloaded packages"
60     echo "    unpack          - unpacks *all* needed package for 'foo'"
61     echo "    download        - downloads *all* needed packages for 'foo'"
62     echo "    print-features  - prints all enabled mage-features"
63     echo "    version         - prints version info"
64     echo "    regen-mage-tree - regenerates the whole mage database (for devs only)"
65   echo   echo
66   echo "Other options:"   echo "Other options:"
67  # echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE"  # echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE"
68  # echo "Builds a Package with its dependencies, but won't install anything."  # echo "Builds a Package with its dependencies, but won't install anything."
69  # echo  # echo
70   echo "USE_UNSTABLE=true $(basename $0) [src]install PACKAGE"   echo "MAGE_DISTRIBUTION=unstable $(basename $0) [src]install PACKAGE"
71   echo "Overrides stable packages; you can install packages that are marked unstable."   echo "Overrides stable packages; you can install packages that are marked unstable."
72   echo   echo
73   echo "USE_TESTING=true $(basename $0) [src]install PACKAGE"   echo "MAGE_DISTRIBUTION=testing $(basename $0) [src]install PACKAGE"
74   echo "Overrides stable packages; you can install packages that are marked testing."   echo "Overrides stable packages; you can install packages that are marked testing."
75   echo   echo
76   echo "NOCOLORS=true $(basename $0) [src]install PACKAGE"   echo "NOCOLORS=true $(basename $0) [src]install PACKAGE"
# Line 114  print_usage(){ Line 82  print_usage(){
82  showversion  showversion
83  echo  echo
84    
 # before anything run mage_setup  
 mage_setup || die "error in mage_setup()"  
   
85  # install method  # install method
86  METHOD="$1"  METHOD="$1"
87    
88  # initial unversionized packagename, gets overridden later  # initial unversionized packagename, gets overridden later on
89  MAGENAME="$2"  MAGENAME="$2"
90    
91  if [[ ${METHOD} != upgrade ]] && \  if [[ ${METHOD} != upgrade ]] &&
92   [[ ${METHOD} != srcupgrade ]] && \   [[ ${METHOD} != srcupgrade ]] &&
93   [[ ${METHOD} != uppretend ]] && \   [[ ${METHOD} != uppretend ]] &&
94   [[ ${METHOD} != srcuppretend ]] && \   [[ ${METHOD} != srcuppretend ]] &&
95   [[ ${METHOD} != update ]] && \   [[ ${METHOD} != update ]] &&
96   [[ ${METHOD} != clean ]] && \   [[ ${METHOD} != update-rsync ]] &&
97   [[ ${METHOD} != version ]] && \   [[ ${METHOD} != update-tarball ]] &&
98   [[ ${METHOD} != search ]] && \   [[ ${METHOD} != clean ]] &&
99   [[ ${METHOD} != regen-mage-tree ]]   [[ ${METHOD} != version ]] &&
100     [[ ${METHOD} != search ]] &&
101     [[ ${METHOD} != regen-mage-tree ]] &&
102     [[ ${METHOD} != print-features ]]
103  then  then
104   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1
105  fi  fi
106    
107    # set PKGDIR and BUILDDIR to MROOT
108    if [[ -n ${MROOT} ]]
109    then
110     PKGDIR=${MROOT}/${PKGDIR}
111     BUILDDIR=${MROOT}/${BUILDDIR}
112    fi
113    
114    # before anything run mage_setup
115    mage_setup || die "error in mage_setup()"
116    
117    # load supported mage features
118    load_mage_features
119    
120    # query debug mode
121    if mqueryfeature "debug"
122    then
123     depwalker_debug="--debug"
124    else
125     depwalker_debug=""
126    fi
127    
128  case ${METHOD} in  case ${METHOD} in
129   download)   download)
130     have_root_privileges || die "You must be root to run this operation."
131    
132   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
133   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
134    
# Line 146  case ${METHOD} in Line 136  case ${METHOD} in
136   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
137    
138   # source the highest magefile of this pkg   # source the highest magefile of this pkg
139   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
140    
141     # package is masked
142     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
143    
144   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
145   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 155  case ${METHOD} in Line 148  case ${METHOD} in
148   PBUILD="$(pkgname2pbuild ${PKGNAME})"   PBUILD="$(pkgname2pbuild ${PKGNAME})"
149    
150   # get all dependencies of this package   # get all dependencies of this package
151   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker \
152   --method install \   --method install \
153   --pcat ${PCAT} \   --pcat ${PCAT} \
154   --pname ${PNAME} \   --pname ${PNAME} \
155   --pver ${PVER} \   --pver ${PVER} \
156   --pbuild ${PBUILD})"   --pbuild ${PBUILD} \
157     ${depwalker_debug})"
158   fetch_packages ${ALLDEPS} || die "fetching packages"   fetch_packages ${ALLDEPS} || die "fetching packages"
159   md5sum_packages ${ALLDEPS} || die "md5 sum packages"   md5sum_packages ${ALLDEPS} || die "md5 sum packages"
160   ;;   ;;
161    
162   srcdownload)   srcdownload)
163     have_root_privileges || die "You must be root to run this operation."
164    
165   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
166   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
167    
# Line 173  case ${METHOD} in Line 169  case ${METHOD} in
169   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
170    
171   # source the highest magefile of this pkg   # source the highest magefile of this pkg
172   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
173    
174     # package is masked
175     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
176    
177   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
178   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 182  case ${METHOD} in Line 181  case ${METHOD} in
181   PBUILD="$(pkgname2pbuild ${PKGNAME})"   PBUILD="$(pkgname2pbuild ${PKGNAME})"
182    
183   # get all dependencies of this package   # get all dependencies of this package
184   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker \
185   --method srcinstall \   --method srcinstall \
186   --pcat ${PCAT} \   --pcat ${PCAT} \
187   --pname ${PNAME} \   --pname ${PNAME} \
188   --pver ${PVER} \   --pver ${PVER} \
189   --pbuild ${PBUILD})"   --pbuild ${PBUILD} \
190     ${depwalker_debug})"
191   fetch_packages ${ALLDEPS} || die "fetching packages"   fetch_packages ${ALLDEPS} || die "fetching packages"
192   ;;   ;;
193    
194   pretend|srcpretend)   pretend|srcpretend|pretend-build-prerequisites)
195   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
196   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
197    
# Line 199  case ${METHOD} in Line 199  case ${METHOD} in
199   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
200    
201   # source the highest magefile of this pkg   # source the highest magefile of this pkg
202   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
203    
204     # package is masked
205     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
206    
207   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
208   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 216  case ${METHOD} in Line 219  case ${METHOD} in
219   exit 3   exit 3
220   fi   fi
221   # get all dependencies of this package   # get all dependencies of this package
222   ${MLIBDIR}/depwalker.sh \   ${MLIBDIR}/depwalker \
223   --method ${METHOD} \   --method ${METHOD} \
224   --pcat ${PCAT} \   --pcat ${PCAT} \
225   --pname ${PNAME} \   --pname ${PNAME} \
226   --pver ${PVER} \   --pver ${PVER} \
227   --pbuild ${PBUILD}   --pbuild ${PBUILD} \
228     ${depwalker_debug}
229   ;;   ;;
230    
231   install)   install|install-build-prerequisites)
232     have_root_privileges || die "You must be root to run this operation."
233    
234   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
235   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
236    
# Line 232  case ${METHOD} in Line 238  case ${METHOD} in
238   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
239    
240   # source the highest magefile of this pkg   # source the highest magefile of this pkg
241   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
242    
243     # package is masked
244     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
245    
246   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
247   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 243  case ${METHOD} in Line 252  case ${METHOD} in
252   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}
253   then   then
254   echo -en "Package "   echo -en "Package "
255   echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"   echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
256   echo -e  " already installed."   echo -e  " already installed."
257   exit 3   exit 3
258   fi   fi
259    
260   # get all dependencies of this package   # get all dependencies of this package
261   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker \
262   --method ${METHOD} \   --method ${METHOD} \
263   --pcat ${PCAT} \   --pcat ${PCAT} \
264   --pname ${PNAME} \   --pname ${PNAME} \
265   --pver ${PVER} \   --pver ${PVER} \
266   --pbuild ${PBUILD})"   --pbuild ${PBUILD} \
267     ${depwalker_debug})"
268    
269   # first fetch all packages   # first fetch all packages
270   fetch_packages ${ALLDEPS} || die "fetching packages"   fetch_packages ${ALLDEPS} || die "fetching packages"
271   md5sum_packages ${ALLDEPS} || die "md5 sum packages"   md5sum_packages ${ALLDEPS} || die "md5 sum packages"
  unpack_packages ${ALLDEPS} || die "unpacking packages"  
272   install_packages ${ALLDEPS} || die "installing packages"   install_packages ${ALLDEPS} || die "installing packages"
273   ;;   ;;
274    
275   srcinstall)   srcinstall)
276     have_root_privileges || die "You must be root to run this operation."
277    
278   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
279   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
280    
# Line 271  case ${METHOD} in Line 282  case ${METHOD} in
282   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
283    
284   # source the highest magefile of this pkg   # source the highest magefile of this pkg
285   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
286    
287     # package is masked
288     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
289    
290   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
291   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 282  case ${METHOD} in Line 296  case ${METHOD} in
296   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}
297   then   then
298   echo -en "Package "   echo -en "Package "
299   echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"   echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
300   echo -e  " already installed."   echo -e  " already installed."
301   exit 3   exit 3
302   fi   fi
303    
304   # get all dependencies of this package   # get all dependencies of this package
305   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker \
306   --method ${METHOD} \   --method ${METHOD} \
307   --pcat ${PCAT} \   --pcat ${PCAT} \
308   --pname ${PNAME} \   --pname ${PNAME} \
309   --pver ${PVER} \   --pver ${PVER} \
310   --pbuild ${PBUILD})"   --pbuild ${PBUILD} \
311     ${depwalker_debug})"
312    
313   install_packages --src-install ${ALLDEPS} || die "src-installing packages"   install_packages --src-install ${ALLDEPS} || die "src-installing packages"
314   ;;   ;;
315    
316   uninstall)   uninstall)
317   ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})"   have_root_privileges || die "You must be root to run this operation."
318   if [ -z "${ALLDEPS}" ]  
319   then   ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})"
320   die "No package installed named '${MAGENAME}'."   if [ -z "${ALLDEPS}" ]
321   fi   then
322   uninstall_packages ${ALLDEPS}   die "No package installed named '${MAGENAME}'."
323     fi
324     uninstall_packages ${ALLDEPS}
325     ;;
326    
327     run-preinstall|run-postinstall)
328     have_root_privileges || die "You must be root to run this operation."
329    
330     ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})"
331     if [ -z "${ALLDEPS}" ]
332     then
333     die "No package installed named '${MAGENAME}'."
334     fi
335     rerun_pkgfunctions --method "${METHOD//run-}" ${ALLDEPS}
336   ;;   ;;
337    
338   uppretend|srcuppretend)   uppretend|srcuppretend)
339   ${MLIBDIR}/depwalker.sh \   ${MLIBDIR}/depwalker \
340     --method ${METHOD} \
341     --pcat ${METHOD} \
342     --pname ${METHOD} \
343     --pver ${METHOD} \
344     --pbuild ${METHOD} \
345     ${depwalker_debug}
346     ;;
347    
348     upgrade)
349     have_root_privileges || die "You must be root to run this operation."
350    
351     # get all dependencies of *all* installed packages
352     # fake pcat,pname,pver,pbuild ...
353     ALLDEPS="$(${MLIBDIR}/depwalker \
354   --method ${METHOD} \   --method ${METHOD} \
355   --pcat ${METHOD} \   --pcat ${METHOD} \
356   --pname ${METHOD} \   --pname ${METHOD} \
357   --pver ${METHOD} \   --pver ${METHOD} \
358   --pbuild ${METHOD}   --pbuild ${METHOD} \
359     ${depwalker_debug})"
360    
361     # first fetch all packages
362     fetch_packages ${ALLDEPS} || die "fetching packages"
363     md5sum_packages ${ALLDEPS} || die "md5 sum packages"
364     install_packages ${ALLDEPS} || die "installing packages"
365   ;;   ;;
366    
367   upgrade|srcupgrade)   srcupgrade)
368     have_root_privileges || die "You must be root to run this operation."
369    
370   # get all dependencies of *all* installed packages   # get all dependencies of *all* installed packages
371   # fake pcat,pname,pver,pbuild ...   # fake pcat,pname,pver,pbuild ...
372   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker \
373   --method ${METHOD} \   --method ${METHOD} \
374   --pcat ${METHOD} \   --pcat ${METHOD} \
375   --pname ${METHOD} \   --pname ${METHOD} \
376   --pver ${METHOD} \   --pver ${METHOD} \
377   --pbuild ${METHOD})"   --pbuild ${METHOD} \
378     ${depwalker_debug})"
379    
380   echo "DEBUG: ${ALLDEPS}"   install_packages --src-install ${ALLDEPS} || die "src-installing packages"
381   ;;   ;;
382    
383   search)   search)
# Line 334  case ${METHOD} in Line 385  case ${METHOD} in
385   ;;   ;;
386    
387   unpack)   unpack)
388     have_root_privileges || die "You must be root to run this operation."
389    
390   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
391   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
392    
# Line 341  case ${METHOD} in Line 394  case ${METHOD} in
394   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
395    
396   # source the highest magefile of this pkg   # source the highest magefile of this pkg
397   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
398    
399     # package is masked
400     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
401    
402   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
403   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 350  case ${METHOD} in Line 406  case ${METHOD} in
406   PBUILD="$(pkgname2pbuild ${PKGNAME})"   PBUILD="$(pkgname2pbuild ${PKGNAME})"
407    
408   # get all dependencies of this package   # get all dependencies of this package
409   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker \
410   --method install \   --method install \
411   --pcat ${PCAT} \   --pcat ${PCAT} \
412   --pname ${PNAME} \   --pname ${PNAME} \
413   --pver ${PVER} \   --pver ${PVER} \
414   --pbuild ${PBUILD})"   --pbuild ${PBUILD} \
415     ${depwalker_debug})"
416    
417   fetch_packages ${ALLDEPS} || die "fetching packages"   fetch_packages ${ALLDEPS} || die "fetching packages"
418   md5sum_packages ${ALLDEPS} || die "md5 sum packages"   md5sum_packages ${ALLDEPS} || die "md5 sum packages"
419   unpack_packages ${ALLDEPS} || die "unpacking packages"   unpack_packages ${ALLDEPS} || die "unpacking packages"
420   ;;   ;;
421    
422   update)   update)
423     have_root_privileges || die "You must be root to run this operation."
424     # default to tarball
425     [[ -z ${MAGE_UPDATE_METHOD} ]] && MAGE_UPDATE_METHOD="tarball"
426     case ${MAGE_UPDATE_METHOD} in
427     rsync) syncmage ;;
428     tarball) syncmage_tarball ;;
429     *) die "Unknown MAGE_UPDATE_METHOD defined." ;;
430     esac
431     ;;
432    
433     update-rsync)
434     have_root_privileges || die "You must be root to run this operation."
435   syncmage   syncmage
436   ;;   ;;
437    
438     update-tarball)
439     have_root_privileges || die "You must be root to run this operation."
440     syncmage_tarball
441     ;;
442    
443   clean)   clean)
444     have_root_privileges || die "You must be root to run this operation."
445   cleanpkg   cleanpkg
446   ;;   ;;
447    
448   version)   version)
449   showversion   # showversion
450     exit 0
451   ;;   ;;
452    
453   regen-mage-tree)   regen-mage-tree)
454     have_root_privileges || die "You must be root to run this operation."
455    
456   if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ]   if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ]
457   then   then
458   echo "SMAGESCRIPTSDIR not found. Check your mage.rc or check out smage repos."   echo "SMAGESCRIPTSDIR not found. Check your mage.rc or check out smage repos."
# Line 385  case ${METHOD} in Line 464  case ${METHOD} in
464   done   done
465   ;;   ;;
466    
467     print-features)
468     mprintfeatures
469     ;;
470    
471   *)   *)
472   print_usage   print_usage
473   ;;   ;;

Legend:
Removed from v.236  
changed lines
  Added in v.2620