2 (set -o igncr) 2>/dev/null && set -o igncr; # hack to force this file to be processed by cygwin bash with -o igncr
3 # needed when this file is exec'd from win32-setup.sh & win64-setup.sh
18 if [ -z "$DOWNLOAD_TAG" ]; then
19 err_exit "DOWNLOAD_TAG not defined (internal error)"
22 if [ -z "$WIRESHARK_TARGET_PLATFORM" ]; then
23 err_exit "WIRESHARK_TARGET_PLATFORM not defined (internal error)"
26 # This MUST be in the form
27 # http://anonsvn.wireshark.org/wireshark-win32-libs/tags/<date>/packages
29 # http://anonsvn.wireshark.org/wireshark-win64-libs/tags/<date>/packages
30 # in order to provide backward compatibility with older trees (e.g. a
31 # previous release or an older SVN checkout).
34 # Set DOWNLOAD_PREFIX to /packages to test uploads before creating the tag.
35 #DOWNLOAD_PREFIX="http://anonsvn.wireshark.org/wireshark-$WIRESHARK_TARGET_PLATFORM-libs/trunk/packages/"
36 DOWNLOAD_PREFIX="http://anonsvn.wireshark.org/wireshark-$WIRESHARK_TARGET_PLATFORM-libs/tags/$DOWNLOAD_TAG/packages/"
38 TAG_FILE="current_tag.txt"
42 echo " $0 --appverify <appname> [<appname>] ..."
43 echo " $0 --libverify <destination> <subdirectory> <package>"
44 echo " $0 --download <destination> <subdirectory> <package>"
45 echo " $0 --settag <destination>"
46 echo " $0 --checktag <destination>"
51 # Try to find our proxy settings, and set http_proxy/use_proxy accordingly.
53 # Someone went to the trouble of configuring wget.
54 if grep "^use_proxy *= *on" $HOME/.wgetrc > /dev/null 2>&1 ; then
58 # ...and wget can't fetch two registry keys because...?
59 proxy_enabled=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyEnable 2>/dev/null | tr -d '\012'`
61 # Bash's test command appears not to use short-circuit evaluation,
64 # -n "$proxy_enabled" -a "$proxy_enabled" -ne 0
66 # causes a complaint if "$proxy_enabled" is an empty string -
67 # the first test fails, but the second test is done anyway,
68 # and generates a complaint about the LHS of -ne not being
69 # numeric. Therefore, we do the tests separately.
71 if [ -n "$proxy_enabled" ] ; then
72 if [ "$proxy_enabled" -ne 0 ] ; then
73 export http_proxy=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyServer 2>/dev/null`
74 echo "Using Internet Explorer proxy settings."
78 if [ -z "$http_proxy" -a -z "$HTTP_PROXY" ] ; then
79 echo "No HTTP proxy specified (http_proxy and HTTP_PROXY are empty)."
80 # a proxy might also be specified using .wgetrc, so don't switch off the proxy
85 # We found a proxy somewhere
87 if [ -z "$http_proxy" ] ; then
88 echo "HTTP proxy ($HTTP_PROXY) has been specified and will be used."
89 export http_proxy=$HTTP_PROXY
91 echo "HTTP proxy ($http_proxy) has been specified and will be used."
101 if [ -z "$*" ] ; then
105 echo "Checking for required applications:"
106 which which > /dev/null 2>&1 || \
107 err_exit "Can't find 'which'. Unable to proceed."
115 PATH_RE="^/cygdrive/.*/"
124 APP_PATH=`cygpath --unix "$APP"`
125 if [ -x "$APP_PATH" -a ! -d "$APP_PATH" ] ; then
128 APP_LOC=`which $APP_PATH 2> /dev/null`
130 echo "$APP_LOC" | grep "$PATH_RE" > /dev/null 2>&1
132 if [ "$APP_LOC" = "" -o $IN_PATH -ne 0 ] ; then
133 MISSING_APPS="$MISSING_APPS $APP"
135 echo " $APP: $APP_LOC $res"
141 if [ -n "$MISSING_APPS" ]; then
143 echo "Can't find: $MISSING_APPS"
144 err_exit "These application(s) are either not installed or simply can't be found in the current PATH: $PATH." \
145 "" "For additional help, please visit:" " http://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html"
149 if [ -z "$2" -o -z "$3" -o -z "$4" ] ; then
152 DEST_PATH=`cygpath "$2"`
154 PACKAGE=`basename "$PACKAGE_PATH"`
155 if [ ! -e $DEST_PATH/$PACKAGE ] ; then
156 err_exit "Package $PACKAGE is needed but is apparently not downloaded; 'nmake -f ... setup' required ?"
160 if [ -z "$2" -o -z "$3" -o -z "$4" ] ; then
163 DEST_PATH=`cygpath "$2"`
166 PACKAGE=`basename "$PACKAGE_PATH"`
168 echo "****** $PACKAGE ******"
170 echo "Downloading $4 into $DEST_PATH, installing into $3"
171 if [ ! -d "$DEST_PATH/$DEST_SUBDIR" ] ; then
172 mkdir -p "$DEST_PATH/$DEST_SUBDIR" || \
173 err_exit "Can't create $DEST_PATH/$DEST_SUBDIR"
175 cd "$DEST_PATH" || err_exit "Can't find $DEST_PATH"
176 wget $use_proxy -nc "$DOWNLOAD_PREFIX/$PACKAGE_PATH" || \
177 err_exit "Can't download $DOWNLOAD_PREFIX/$PACKAGE_PATH"
178 cd "$DEST_SUBDIR" || err_exit "Can't find $DEST_SUBDIR"
179 echo "Extracting $DEST_PATH/$PACKAGE into $DEST_PATH/$DEST_SUBDIR"
180 unzip -oq "$DEST_PATH/$PACKAGE" ||
181 err_exit "Couldn't unpack $DEST_PATH/$PACKAGE"
182 echo "Verifying that the DLLs and EXEs in $DEST_SUBDIR are executable."
183 # XX: Note that find will check *all* dlls/exes in DEST_SUBDIR and below
184 # which may be more than those just unzipped depending upon DEST_SUBDIR.
185 # This may cause extra repeated checks but will do no harm.
186 for i in `/usr/bin/find . \( -name '*\.dll' -o -name '*\.exe' \)` ; do
187 if [ ! -x "$i" ] ; then
188 echo "Changing file permissions (add executable bit) to:"
195 if [ -z "$2" ] ; then
198 DEST_PATH=`cygpath "$2"`
199 echo "$DOWNLOAD_TAG" > $DEST_PATH/$TAG_FILE
202 if [ -z "$2" ] ; then
205 DEST_PATH=`cygpath "$2"`
206 WIN_PATH=`cygpath --windows "$2"`
207 LAST_TAG=`cat $DEST_PATH/$TAG_FILE 2> /dev/null`
208 if [ "$DOWNLOAD_TAG" != "$LAST_TAG" ] ; then
209 if [ -z "$LAST_TAG" ] ; then
213 "The contents of $WIN_PATH\\$TAG_FILE is $LAST_TAG." \
214 "It should be $DOWNLOAD_TAG."