Dutch translation updated (Gideon van Melle)
[pidgin-git.git] / pidgin / win32 / nsis / rpm2zip.sh
blob51c6adaf33f5022fbef0a6053a729c0377d1e355
1 #!/bin/sh
3 here=`pwd`
4 for F in $*; do
5 case $F in
6 mingw32-*.noarch.rpm|mingw64-*.noarch.rpm|*/mingw32-*.noarch.rpm|*/mingw64-*.noarch.rpm)
7 package=`rpm -qp $F 2>/dev/null`
8 case $package in
9 mingw32-*|mingw64-*)
10 case $package in
11 mingw32-*)
12 cpu=i686
13 bits=32
15 mingw64-*)
16 cpu=x86_64
17 bits=64
19 esac
20 origname=`rpm -qp --queryformat='%{NAME}' $F 2>/dev/null`
21 name=$origname
22 case $name in
23 *-devel)
24 name=${name%el}
26 esac
27 shortpackage="$name"_`rpm -qp --queryformat='%{VERSION}-%{RELEASE}'_win${bits} $F 2>/dev/null`
28 shortpackage=${shortpackage#mingw32-}
29 shortpackage=${shortpackage#mingw64-}
30 shortname=$name
31 shortname=${shortname#mingw32-}
32 shortname=${shortname#mingw64-}
33 tmp=`mktemp -d`
34 #rpm2cpio $F | lzcat | (cd $tmp && cpio --quiet -id)
35 rpm2cpio $F | (cd $tmp && cpio --quiet -id)
37 cd $tmp
38 zipfile="$here/$shortpackage.zip"
39 rm -f $zipfile
40 (cd usr/${cpu}-pc-mingw32/sys-root/mingw && zip -q -r -D $zipfile .)
41 if [ -d usr/share/doc/packages/$origname ] ; then
42 mv usr/share/doc/packages/$origname usr/share/doc/packages/$shortname
43 (cd usr && zip -q -r -D $zipfile share/doc/packages/$shortname)
45 mkdir -p manifest
46 unzip -l $zipfile >manifest/$shortpackage.mft
47 zip -q $zipfile manifest/$shortpackage.mft
48 N=`unzip -l $zipfile | wc -l | sed -e 's/^ *\([0-9]*\).*/\1/'`
49 Nm1=`expr $N - 1`
50 unzip -l $zipfile | sed -e "1,3 d" -e "$Nm1,$N d" | awk '{print $4}' | grep -v -E '/$' >manifest/$shortpackage.mft
51 zip -q $zipfile manifest/$shortpackage.mft
52 echo $zipfile
54 rm -rf $tmp
57 echo $F is not a mingw32/64 RPM package >&2
59 esac
62 echo $F is not a mingw32/64 RPM package >&2
64 esac
65 done