Magellan Linux

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

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

revision 1289 by niro, Thu May 12 21:29:31 2011 UTC revision 1547 by niro, Tue Dec 27 09:58:03 2011 UTC
# Line 2  Line 2 
2  # Magellan Linux Installer Functions (mage.functions.sh)  # Magellan Linux Installer Functions (mage.functions.sh)
3  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.38 2008-10-05 10:32:24 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.38 2008-10-05 10:32:24 niro Exp $
4    
5    COLRED="\033[1;6m\033[31m"
6    COLGREEN="\033[1;6m\033[32m"
7    COLYELLOW="\033[1;6m\033[33m"
8    COLBLUE="\033[1;6m\033[34m"
9    COLMAGENTA="\033[1;6m\033[35m"
10    COLWHITE="\033[1;6m\033[37m"
11    COLGRAY="\033[0;6m\033[37m"
12    COLBOLD="\033[1m"
13    COLDEFAULT="\033[0m"
14    
15    if [[ ${NOCOLORS} = true ]]
16    then
17     COLRED=""
18     COLGREEN=""
19     COLYELLOW=""
20     COLBLUE=""
21     COLMAGENTA=""
22     COLWHITE=""
23     COLGRAY=""
24     COLBOLD=""
25     COLDEFAULT=""
26    fi
27    
28  mage_setup()  mage_setup()
29  {  {
30   [ ! -d ${MROOT}${INSTALLDB} ] && \   [ ! -d ${MROOT}${INSTALLDB} ] && \
# Line 1365  syncmage() Line 1388  syncmage()
1388   done   done
1389    
1390   # clean up backup files (foo~)   # clean up backup files (foo~)
1391   find ${MAGEDIR} -name *~ -exec rm '{}' ';'   find ${MAGEDIR} -name \*~ -exec rm '{}' ';'
1392    
1393   # check if a newer mage version is available   # check if a newer mage version is available
1394   is_newer_mage_version_available   is_newer_mage_version_available
# Line 1379  syncmage_tarball() Line 1402  syncmage_tarball()
1402   local mirr mymirr   local mirr mymirr
1403   local opt   local opt
1404   local tar_opts   local tar_opts
1405     local wget_opts
1406    
1407   # try to get the md5 marked as latest on the server   # try to get the md5 marked as latest on the server
1408   latest_md5="mage-latest.md5"   latest_md5="mage-latest.md5"
# Line 1386  syncmage_tarball() Line 1410  syncmage_tarball()
1410   # try to get the tarball marked as latest on the server   # try to get the tarball marked as latest on the server
1411   latest_tarball="mage-latest.tar.bz2"   latest_tarball="mage-latest.tar.bz2"
1412    
1413     # filter wget command if busybox was found
1414     wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
1415    
1416   for mirr in ${MIRRORS}   for mirr in ${MIRRORS}
1417   do   do
1418   # path without distribution   # path without distribution
# Line 1395  syncmage_tarball() Line 1422  syncmage_tarball()
1422   echo "fetching latest md5 from ${mymirr} ..."   echo "fetching latest md5 from ${mymirr} ..."
1423   [[ ${VERBOSE} = off ]] && opt="--quiet"   [[ ${VERBOSE} = off ]] && opt="--quiet"
1424   wget \   wget \
1425   ${WGET_FETCH_OPTIONS} \   ${wget_opts} \
1426   --directory-prefix=${temp} \   --directory-prefix=${temp} \
1427   ${opt} ${mymirr}/rsync/tarballs/${latest_md5}   ${opt} ${mymirr}/rsync/tarballs/${latest_md5}
1428    
1429   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1430   echo "fetching latest tarball from ${mymirr} ..."   echo "fetching latest tarball from ${mymirr} ..."
1431   wget \   wget \
1432   ${WGET_FETCH_OPTIONS} \   ${wget_opts} \
1433   --directory-prefix=${temp} \   --directory-prefix=${temp} \
1434   ${opt} ${mymirr}/rsync/tarballs/${latest_tarball}   ${opt} ${mymirr}/rsync/tarballs/${latest_tarball}
1435   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 1571  get_highest_magefile() Line 1598  get_highest_magefile()
1598   local magefile   local magefile
1599    
1600   # do not list the content of a directory, only the name (-d)   # do not list the content of a directory, only the name (-d)
1601   for magefile in $(ls --format=single-column -v -d ${MAGEDIR}/${PCAT}/${PNAME}/*)   for magefile in $(ls --format=single-column -v -d ${MAGEDIR}/${PCAT}/${PNAME}/* 2> /dev/null)
1602   do   do
1603   [[ -z ${magefile} ]] && continue   [[ -z ${magefile} ]] && continue
1604   # we exclude subdirs (for stuff like a md5sum dir)   # we exclude subdirs (for stuff like a md5sum dir)
# Line 2458  mage_install() Line 2485  mage_install()
2485   if [[ -n ${MAGE_TARGETS} ]]   if [[ -n ${MAGE_TARGETS} ]]
2486   then   then
2487   # basic svn compat   # basic svn compat
2488   if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]   if [[ -d ${SMAGESCRIPTSDIR}/.svn ]]
2489   then   then
2490   for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2   for i in ${SMAGESCRIPTSDIR}/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2
2491   do   do
2492   smage2file="${i}"   smage2file="${i}"
2493   done   done
# Line 2471  mage_install() Line 2498  mage_install()
2498   elif [[ -n ${SPLIT_PACKAGE_BASE} ]]   elif [[ -n ${SPLIT_PACKAGE_BASE} ]]
2499   then   then
2500   # basic svn compat   # basic svn compat
2501   if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]   if [[ -d ${SMAGESCRIPTSDIR}/.svn ]]
2502   then   then
2503   for i in ${SMAGESCRIPTSDIR}/trunk/*/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2   for i in ${SMAGESCRIPTSDIR}/*/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2
2504   do   do
2505   smage2file="${i}"   smage2file="${i}"
2506   done   done
# Line 2483  mage_install() Line 2510  mage_install()
2510    
2511   else   else
2512   # basic svn compat   # basic svn compat
2513   if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]   if [[ -d ${SMAGESCRIPTSDIR}/.svn ]]
2514   then   then
2515   for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2   for i in ${SMAGESCRIPTSDIR}/*/${pname}/${pname}-${pver}-${pbuild}.smage2
2516   do   do
2517   smage2file="${i}"   smage2file="${i}"
2518   done   done
# Line 3085  need_busybox_support() Line 3112  need_busybox_support()
3112   then   then
3113   # needs busybox support   # needs busybox support
3114   return 0   return 0
  else  
  # no busybox  
  return 1  
3115   fi   fi
3116   fi   fi
3117    
3118     # no busybox
3119     return 1
3120  }  }
3121    
3122  # busybox_filter_wget_options ${wget_opts}  # busybox_filter_wget_options ${wget_opts}
# Line 3124  busybox_filter_wget_options() Line 3151  busybox_filter_wget_options()
3151   echo "${opts}"   echo "${opts}"
3152   fi   fi
3153  }  }
3154    
3155    have_root_privileges()
3156    {
3157     local retval
3158    
3159     if [[ $(id -u) = 0 ]]
3160     then
3161     retval=0
3162     else
3163     retval=1
3164     fi
3165    
3166     return ${retval}
3167    }

Legend:
Removed from v.1289  
changed lines
  Added in v.1547