#!/bin/sh # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA # This is heavily based on work done by Bernd Zeimetz, and has been # extended slightly. set -e #command --upstream-version version filename [ $# -eq 3 ] || exit 255 version="$2" filename="$3" echo >&2 '' echo >&2 " Starting to get ${filename} " # Unpack, and find the directory it unpacked into tar xfj ${filename} dir=`tar tfj ${filename} | head -1 | sed 's,/.*,,g'` # Package specific cleanups DIRS_TO_REMOVE=${dir}/debian FILES_TO_REMOVE=${filename} echo >&2 " Munging ${filename} ==> ${filename%%.orig.tar.bz2}.ds.orig.tar.gz" rm -f ${FILES_TO_REMOVE} rm -rf ${DIRS_TO_REMOVE} # Any additional cleanup goes in here : echo '' # rename, repack, cleanup mv ${dir} ${dir}.ds.orig tar cf - ${dir}.ds.orig | gzip -9 > ${filename%%.orig.tar.bz2}.ds.orig.tar.gz rm -rf ${dir}.ds.orig echo >&2 " ${filename%%.orig.tar.gz}.ds.orig.tar.gz created."