[q3map2] Unwind script stack in case of script loading error.
[xonotic/netradiant.git] / install-dlls-fedora.sh
1 #!/bin/sh
2 set -x
3
4 DLL_PATH=/usr/i686-w64-mingw32/sys-root/mingw/bin
5
6 cd install
7
8 STARTDIR=`pwd`
9
10 COPYDEPS() 
11 {
12         FILE=$1
13         if [ -e "$FILE" ] ;then
14                 DEPS=`objdump -p "$FILE" 2>/dev/null |grep -i "DLL Name"|sort |uniq|cut -d\  -f3 |egrep -vi '(GDI32.dll|KERNEL32.dll|USER32.dll|msvcrt.dll|MSIMG32.DLL|ole32.dll|OPENGL32.DLL|SHELL32.DLL|WS2_32.dll)' || true`
15                                 
16                 for DEP in $DEPS; do
17                         basename -a "$STARTDIR"/*.dll | grep -v "*.dll"|sort >  "$STARTDIR"/.HAVES
18                         if ! cat "$STARTDIR"/.HAVES | grep "$DEP" >/dev/null ;then
19                                 cp -v "$DLL_PATH"/"$DEP" "$STARTDIR" 2>/dev/null
20                                 COPYDEPS "$DLL_PATH"/"$DEP"
21                         fi
22                         rm -f "$STARTDIR"/.HAVES
23                 done
24         fi
25 }
26
27 for i in *.exe;do
28         COPYDEPS "$i";
29 done
30