File dpkg-deb of Package deb2suse
#! /bin/sh
set -x
dir=debian/tmp
case $1 in
--build)
shift
dir=$1
shift
;;
*)
exec /usr/bin/dpkg-deb "$@"
;;
esac
# ignore ..
if test "$1" = ..; then
filelistdir=$(pwd)
elif test -d "$1"; then
filelistdir=$(cd $1 && pwd)
else
filelistdir=$(pwd)
fi
pushd $dir
/usr/lib/deb2suse/bin/fix-common-installs
pack=`grep Package: DEBIAN/control | head -n 1 | cut -d: -f2- | sed -e "s, *,,"`
rm -rf DEBIAN
find . -type f -o -type l | cut -b2- | sed -e 's,[ *],?,g' > $filelistdir/list.$pack
tempfile=$(mktemp /tmp/file.XXXXXX)
/usr/lib/deb2suse/bin/deb2suse_filedups \
/usr/share/deb2suse/Contents.suse.gz $filelistdir/list.$pack \
> $tempfile
eval reqs=\$REQUIRES_$(echo $pack | sed -e "s,[-+.],_,g")
for req in $reqs; do
if rpm -q $req > /dev/null; then
rpm -ql $req | while read file ; do rm -vf "./$file" ; done
else
grep " $req"'$' $tempfile | cut -d' ' -f1 | while read file ; do
rm -v ./$file
done
fi
grep -v " $req"'$' $tempfile > $tempfile.new
mv $tempfile.new $tempfile
done
if test -s "$tempfile"; then
echo "DUPLICATED FILES:"
cat $tempfile
exit 1
fi
rm -f $tempfile
echo "%defattr(-,root,root)" > $filelistdir/list.$pack
find . -type f -o -type l | cut -b2- | sed -e 's,[ *],?,g' >> $filelistdir/list.$pack
cp -a * $RPM_BUILD_ROOT
popd