-
Notifications
You must be signed in to change notification settings - Fork 8
/
win32-setup.sh
105 lines (99 loc) · 2.94 KB
/
win32-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh
#
# Win32 sctplib script
# Copyright (C) 2003-2008 by Michael Tuexen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: discussion@sctp.de
# thomas.dreibholz@gmail.com
# tuexen@fh-muenster.de
DOWNLOAD_PREFIX="http://anonsvn.wireshark.org/wireshark-win32-libs/tags/2007-11-20/packages"
err_exit () {
echo "ERROR: $1"
echo ""
exit 1
}
usage () {
echo "Usage:"
echo " $0 --appverify <appname> [<appname>] ..."
echo " $0 --download <destination> <subdirectory> <package>"
echo ""
exit 1
}
case "$1" in
--appverify)
shift
if [ -z "$*" ] ; then
usage
fi
echo "Checking for required applications:"
for APP in $* ; do
APP_PATH=`cygpath --unix $APP`
if [ -x "$APP_PATH" -a ! -d "$APP_PATH" ] ; then
APP_LOC="$APP_PATH"
else
APP_LOC=`which $APP_PATH 2> /dev/null`
fi
if [ "$APP_LOC" = "" ] ; then
err_exit "Can't find $APP"
fi
echo " $APP: $APP_LOC $res"
done
;;
--download)
if [ -z "$2" -o -z "$3" -o -z "$4" ] ; then
usage
fi
DEST_PATH=`cygpath --unix "$2"`
DEST_SUBDIR=$3
PACKAGE_PATH=$4
PACKAGE=`basename "$PACKAGE_PATH"`
if [ -z "$http_proxy" -a -z "$HTTP_PROXY" ] ; then
echo "No HTTP proxy specified (http_proxy and HTTP_PROXY are empty)."
use_proxy="-Y off"
else
use_proxy="-Y on"
if [ -z "$http_proxy" ] ; then
echo "HTTP proxy ($HTTP_PROXY) has been specified and will be used."
else
echo "HTTP proxy ($http_proxy) has been specified and will be used."
fi
fi
echo "Downloading $4 into $DEST_PATH, installing into $3"
if [ ! -d "$DEST_PATH/$DEST_SUBDIR" ] ; then
mkdir -p "$DEST_PATH/$DEST_SUBDIR" || \
err_exit "Can't create $DEST_PATH/$DEST_SUBDIR"
fi
cd "$DEST_PATH" || err_exit "Can't find $DEST_PATH"
wget $use_proxy -nc "$DOWNLOAD_PREFIX/$PACKAGE_PATH" || \
err_exit "Can't download $DOWNLOAD_PREFIX/$PACKAGE_PATH"
cd $DEST_SUBDIR
echo "Extracting $DEST_PATH/$PACKAGE into $DEST_PATH/$DEST_SUBDIR"
unzip -nq "$DEST_PATH/$PACKAGE" ||
err_exit "Couldn't unpack $DEST_PATH/$PACKAGE"
echo "Verifying that the DLLs in $DEST_PATH/$DEST_SUBDIR are executable."
for i in `find $DEST_PATH/$DEST_SUBDIR -name \*\.dll` ; do
if [ ! -x "$i" ] ; then
echo "Changing file permissions (add executable bit) to:"
echo "$i"
chmod a+x "$i"
fi
done
;;
*)
usage
;;
esac
exit 0