#!/bin/sh
DEB=$1
if ! [ -f "$1" ]; then
 echo Usage: $0 skype_i386.deb >&2
 exit 1
fi
TMP=$(mktemp -d /tmp/skype-lenny-convert-to-amd64.XXXXXX)
dpkg-deb -x $DEB $TMP/$(basename $1 _i386.deb)
dpkg-deb -e $DEB $TMP/$(basename $1 _i386.deb)/DEBIAN
cd $TMP/$(basename $1 _i386.deb)
patch --no-backup-if-mismatch -p0 <<EOT
Index: DEBIAN/control
@@ -3,5 +3,5 @@
 Section: non-free/net
 Priority: extra
-Architecture: i386
-Depends: libasound2 (>> 1.0.16), libc6 (>= 2.7-1), libgcc1 (>= 1:4.3), libqt4-dbus (>= 4.4.3), libqt4-network (>= 4.4.3), libqtcore4 (>= 4.4.3), libqtgui4 (>= 4.4.3), libstdc++6 (>= 4.3), libx11-6, libxext6, libxss1, libxv1
+Architecture: amd64
+Depends: lib32stdc++6 (>= 4.1.1-21), lib32asound2 (>> 1.0.14), ia32-libs-gtk (>= 1.6), libc6-i386 (>= 2.7-1), lib32gcc1 (>= 1:4.1.1-21+ia32.libs.1.19)
EOT
cd -
cd $TMP
dpkg-deb -b $(basename $1 _i386.deb)
cd -
mv $TMP/$(basename $1 _i386.deb).deb $(basename $1 _i386.deb)_amd64.deb
rm -rf $TMP
