#! /bin/bash # Last edited on 2003-11-22 15:31:00 by stolfi cmd="${0##*/}" usage="${cmd} PKG VERSION EXPORTDIR" # Makes a "tar" archive named "{PKG}-{VERSION}.tgz" containing all # files of "{PKG}/{VERSION}" that are listed in # "{PKG}/{VERSION}/.export". Then moves that tarball to directory # "{EXPORTDIR}". # # All file names in the archive will be prefixed with # "{PKGTAIL}/{VERSION}/" where {PKGTAIL} is the last component of # {PKG}. if [ $# -ne 3 ]; then echo "usage: ${usage}"; exit 1 fi pkg="$1"; shift; version="$1"; shift; exdir="$1"; shift; pvdir="${pkg}/${version}" tarball="${pkg}-${version}.tgz" filelist="${pvdir}/.export" fileprefix="${pkg##*/}/${version}" if [ ! -d ${pvdir} ]; then echo "${pvdir} missing or not a directory"; exit 1 fi if [ ! -r ${filelist} ]; then echo "${filelist} missing or not a directory"; exit 1 fi if [ ! -d ${exdir} ]; then echo "${exdir} missing or not a directory"; exit 1 fi tar -cvzf ${tarball} `cat ${filelist} | sed -e "s;^;${fileprefix}/;"` mv -v ${tarball} ${exdir}