Changeset 61c0e64 for scripts/funcs


Ignore:
Timestamp:
Feb 21, 2006, 12:16:32 AM (19 years ago)
Author:
Jim Gifford <clfs@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
9b5d6cdc
Parents:
99e4712
Message:

r568@server (orig r566): ryan | 2005-06-09 08:36:17 -0700
Several changes

  • Handle tar.Z files (use zcat)
  • add a -no-remove option to unpack_tarball and fix the OK message to display the tarball name, not ${1}



File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/funcs/tarball-funcs.sh

    r99e4712 r61c0e64  
    6464
    6565fetch_tarball() { # ${1} should be a package name w version
    66    for type in tar.bz2 tar.gz tgz tar bleh; do
     66   for type in tar.bz2 tar.gz tgz tar.Z tar bleh; do
     67      # if the following is true, we failed in our mission
     68      if [ "${type}" = "bleh" ]; then return 1 ; fi
    6769      fetch ${1}.${type}
    6870      if [ "${?}" = "0" ]; then return 0 ; fi
    69       # if the following is true, we failed in our mission
    70       if [ "${type}" = "bleh" ]; then return 1 ; fi
    7171   done
    7272}
     
    7676   shift
    7777   local filelist="${@}"
     78
     79   # Check if -no-remove option is set
     80   echo ${filelist} | grep \\-no-remove > /dev/null 2>&1 &&
     81   {
     82      local no_remove=Y
     83      filelist=`echo ${filelist} | sed 's@-no-remove@@g'`
     84   }
     85
    7886   # Easier add of .tgz
    7987
     
    8896   
    8997   local archive=`ls -t ${TARBALLS}/${pkgname}* 2> /dev/null | \
    90       ${GREP} -E ${pkgname}.\(tgz\|tar.gz\|tar.bz2\|tar\)$ | head -n 1`
     98      ${GREP} -E ${pkgname}.\(tgz\|tar.gz\|tar.bz2\|tar.Z\|tar\)$ | head -n 1`
    9199
    92100   if [ -z ${archive} ]; then
     
    98106      *.gz | *.tgz )   local CAT="gzip -dc" ;;
    99107      *.bz2 )          local CAT="bzcat"    ;;
    100       *.tar )          local CAT="cat"    ;;
     108      *.Z )            local CAT="zcat"     ;;
     109      *.tar )          local CAT="cat"      ;;
    101110      * )   echo "unpack_tarball: unable to determine tarball type... exiting"
    102111            exit 1 ;;
     
    126135      filelist=`echo ${filelist} | \
    127136         sed "s@\([-+_a-zA-Z0-9/.]* \?\)@${PKGDIR}/\1@g"`
    128    elif [ -d ${PKGDIR} ]; then
     137   elif [ -d ${PKGDIR} -a ! "${no_remove}" = "Y" ]; then
    129138      echo -n "Removing existing ${PKGDIR} directory... "
    130139      rm -rf ${PKGDIR} && echo "DONE" ||
     
    135144   echo "Unpacking ${archive}"
    136145   ${CAT} ${archive} | tar -xf - ${filelist} 2> /dev/null &&
    137    echo " o ${1} unpacked successfully" ||
     146   echo " o ${archive} unpacked successfully" ||
    138147   {
    139148      echo "unpack_tarball: unable to unpack tarball ${archive}... exiting"
     
    197206      #  2> /dev/null | head -n 1`
    198207      local archive=`ls -t ${TARBALLS}/${pkgname}* 2> /dev/null | \
    199       ${GREP} -E ${pkgname}.\(tgz\|tar.gz\|tar.bz2\|tar\)$ | head -n 1`
     208      ${GREP} -E ${pkgname}.\(tgz\|tar.gz\|tar.bz2\|tar.Z\|tar\)$ | head -n 1`
    200209
    201210      if [ -z "${archive}" ]; then
Note: See TracChangeset for help on using the changeset viewer.