1a34fd
#!/bin/bash
1a34fd
#
1a34fd
# This script removes non-linux dialects from upstream source package before
1a34fd
# release.  There is a problem with copyrights for some UN*Xes ... also .. this
1a34fd
# script merges all to the one normal tarball and rename all to lsof_X.XX-rh.
1a34fd
#
1a34fd
# Usage:  ./upstream2downstream  <usptream-tarball>
1a34fd
# 
1a34fd
# This code is in the public domain; do with it what you wish.
1a34fd
#
1a34fd
# Copyright (C) 2007 Karel Zak <kzak@redhat.com>
1a34fd
#
1a34fd
1a34fd
UPSTREAM="$1"
d9489e
NAME=$(basename $UPSTREAM .tar.gz)
1a34fd
MYPWD=$(pwd)
1a34fd
TMP=$(mktemp -d)
1a34fd
1a34fd
echo
1a34fd
echo -n "Extracting upstream code..."
d9489e
tar -xf $UPSTREAM  -C $TMP
1a34fd
cd $TMP/$NAME
1a34fd
echo " done."
1a34fd
d9489e
echo -n "Removing non-Linux dialects..."
d9489e
rm -rf ./dialects/{aix,darwin,du,freebsd,hpux,n+obsd,n+os,osr,sun,uw}
1a34fd
echo " done."
1a34fd
d9489e
echo -n "Removing unused distribution scripts..."
d9489e
rm -rf ./support
1a34fd
echo " done."
1a34fd
1a34fd
echo -n "Creating final downstream tarball..."
d9489e
cd ..
d9489e
mv $NAME $NAME-rh
1a34fd
tar Jcf $MYPWD/"$NAME"-rh.tar.xz "$NAME"-rh
1a34fd
echo " done."
1a34fd
1a34fd
rm -rf $TMP
1a34fd
cd $MYPWD
1a34fd
1a34fd
echo
1a34fd
echo "Linux-only tarball: $MYPWD/"$NAME"-rh.tar.xz"
1a34fd
echo
1a34fd