Changeset 61c0e64 for scripts/funcs
- Timestamp:
- Feb 21, 2006, 12:16:32 AM (19 years ago)
- Branches:
- clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- 9b5d6cdc
- Parents:
- 99e4712
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/funcs/tarball-funcs.sh
r99e4712 r61c0e64 64 64 65 65 fetch_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 67 69 fetch ${1}.${type} 68 70 if [ "${?}" = "0" ]; then return 0 ; fi 69 # if the following is true, we failed in our mission70 if [ "${type}" = "bleh" ]; then return 1 ; fi71 71 done 72 72 } … … 76 76 shift 77 77 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 78 86 # Easier add of .tgz 79 87 … … 88 96 89 97 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` 91 99 92 100 if [ -z ${archive} ]; then … … 98 106 *.gz | *.tgz ) local CAT="gzip -dc" ;; 99 107 *.bz2 ) local CAT="bzcat" ;; 100 *.tar ) local CAT="cat" ;; 108 *.Z ) local CAT="zcat" ;; 109 *.tar ) local CAT="cat" ;; 101 110 * ) echo "unpack_tarball: unable to determine tarball type... exiting" 102 111 exit 1 ;; … … 126 135 filelist=`echo ${filelist} | \ 127 136 sed "s@\([-+_a-zA-Z0-9/.]* \?\)@${PKGDIR}/\1@g"` 128 elif [ -d ${PKGDIR} ]; then137 elif [ -d ${PKGDIR} -a ! "${no_remove}" = "Y" ]; then 129 138 echo -n "Removing existing ${PKGDIR} directory... " 130 139 rm -rf ${PKGDIR} && echo "DONE" || … … 135 144 echo "Unpacking ${archive}" 136 145 ${CAT} ${archive} | tar -xf - ${filelist} 2> /dev/null && 137 echo " o ${ 1} unpacked successfully" ||146 echo " o ${archive} unpacked successfully" || 138 147 { 139 148 echo "unpack_tarball: unable to unpack tarball ${archive}... exiting" … … 197 206 # 2> /dev/null | head -n 1` 198 207 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` 200 209 201 210 if [ -z "${archive}" ]; then
Note:
See TracChangeset
for help on using the changeset viewer.