move global capture_child flag into capture_options
[obnox/wireshark/wip.git] / tools / win32-setup.sh
1 #!/bin/sh
2
3 # DOWNLOAD_PREFIX="http://www.ethereal.com/distribution/win32/development"
4 DOWNLOAD_PREFIX="http://anonsvn.ethereal.com/ethereal-win32-libs/tags/2004-11-23/packages"
5
6 err_exit () {
7         echo "ERROR: $1"
8         echo ""
9         exit 1
10 }
11
12 usage () {
13         echo "Usage:"
14         echo "  $0 --appverify <appname> [<appname>] ..."
15         echo "  $0 --download <destination> <subdirectory> <package>"
16         echo ""
17         exit 1
18 }
19
20
21 case "$1" in
22 --appverify)
23         shift
24         if [ -z "$*" ] ; then
25                 usage
26         fi
27         echo "Checking for required applications:"
28         for APP in $* ; do
29                 APP_PATH=`cygpath --unix $APP`
30                 if [ -x "$APP_PATH" -a ! -d "$APP_PATH" ] ; then
31                         APP_LOC="$APP_PATH"
32                 else
33                         APP_LOC=`which $APP_PATH 2> /dev/null`
34                 fi
35                 if [ "$APP_LOC" = "" ] ; then
36                         err_exit "Can't find $APP"
37                 fi
38                 echo "  $APP: $APP_LOC $res"
39         done
40         ;;
41 --download)
42         if [ -z "$2" -o -z "$3" -o -z "$4" ] ; then
43                 usage
44         fi
45         DEST_PATH=`cygpath --unix "$2"`
46         DEST_SUBDIR=$3
47         PACKAGE_PATH=$4
48         PACKAGE=`basename "$PACKAGE_PATH"`
49         echo "****** $PACKAGE ******"
50         if [ -z "$http_proxy" -a -z "$HTTP_PROXY" ] ; then
51                 echo "No HTTP proxy specified (http_proxy and HTTP_PROXY are empty)."
52                 use_proxy="-Y off"
53         else
54                 use_proxy="-Y on"
55                 if [ -z "$http_proxy" ] ; then
56                         echo "HTTP proxy ($HTTP_PROXY) has been specified and will be used."
57                 else
58                         echo "HTTP proxy ($http_proxy) has been specified and will be used."
59                 fi
60         fi
61         echo "Downloading $4 into $DEST_PATH, installing into $3"
62         if [ ! -d "$DEST_PATH/$DEST_SUBDIR" ] ; then
63                 mkdir -p "$DEST_PATH/$DEST_SUBDIR" || \
64                         err_exit "Can't create $DEST_PATH/$DEST_SUBDIR"
65         fi
66         cd "$DEST_PATH" || err_exit "Can't find $DEST_PATH"
67         wget $use_proxy -nc "$DOWNLOAD_PREFIX/$PACKAGE_PATH" || \
68                 err_exit "Can't download $DOWNLOAD_PREFIX/$PACKAGE_PATH"
69         cd "$DEST_SUBDIR" || err_exit "Can't find $DEST_SUBDIR"
70         echo "Extracting $DEST_PATH/$PACKAGE into $DEST_PATH/$DEST_SUBDIR"
71         unzip -nq "$DEST_PATH/$PACKAGE" || 
72                 err_exit "Couldn't unpack $DEST_PATH/$PACKAGE"
73         echo "Verifying that the DLLs in $DEST_PATH/$DEST_SUBDIR are executable."
74         for i in `/usr/bin/find $DEST_PATH/$DEST_SUBDIR -name \*\.dll` ; do
75                 if [ ! -x "$i" ] ; then
76                         echo "Changing file permissions (add executable bit) to:"
77                         echo "$i"
78                         chmod a+x "$i"
79                 fi
80         done            
81         ;;
82 *)
83         usage
84         ;;
85 esac
86
87 exit 0