3 # Copyright 2013 Gerald Combs <gerald@wireshark.org>
7 # Wireshark - Network traffic analyzer
8 # By Gerald Combs <gerald@wireshark.org>
9 # Copyright 1998 Gerald Combs
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License
13 # as published by the Free Software Foundation; either version 2
14 # of the License, or (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 (set -o igncr
) 2>/dev
/null
&& set -o igncr
; # hack to force this file to be processed by cygwin bash with -o igncr
25 # needed when this file is exec'd from win32-setup.sh & win64-setup.sh
38 if [ -z "$DOWNLOAD_TAG" ]; then
39 err_exit
"DOWNLOAD_TAG not defined (internal error)"
42 if [ -z "$WIRESHARK_TARGET_PLATFORM" ]; then
43 err_exit
"WIRESHARK_TARGET_PLATFORM not defined (internal error)"
46 # This MUST be in the form
47 # http://anonsvn.wireshark.org/wireshark-win32-libs/tags/<date>/packages
49 # http://anonsvn.wireshark.org/wireshark-win64-libs/tags/<date>/packages
50 # in order to provide backward compatibility with older trees (e.g. a
51 # previous release or an older SVN checkout).
54 # Set DOWNLOAD_PREFIX to /packages to test uploads before creating the tag.
55 #DOWNLOAD_PREFIX="http://anonsvn.wireshark.org/wireshark-$WIRESHARK_TARGET_PLATFORM-libs/trunk/packages/"
56 DOWNLOAD_PREFIX
="http://anonsvn.wireshark.org/wireshark-$WIRESHARK_TARGET_PLATFORM-libs/tags/$DOWNLOAD_TAG/packages/"
58 TAG_FILE
="current_tag.txt"
62 echo " $0 --appverify <appname> [<appname>] ..."
63 echo " $0 --libverify <destination> <subdirectory> <package>"
64 echo " $0 --download <destination> <subdirectory> <package>"
65 echo " $0 --settag <destination>"
66 echo " $0 --checktag <destination>"
71 # Try to find our proxy settings, and set http_proxy/use_proxy accordingly.
73 # Someone went to the trouble of configuring wget.
74 if grep "^use_proxy *= *on" $HOME/.wgetrc
> /dev
/null
2>&1 ; then
78 # ...and wget can't fetch two registry keys because...?
79 proxy_enabled
=$
(regtool get
/HKCU
/Software
/Microsoft
/Windows
/CurrentVersion
/Internet\ Settings
/ProxyEnable
2>/dev
/null |
tr -d '\012')
81 # Bash's test command appears not to use short-circuit evaluation,
84 # -n "$proxy_enabled" -a "$proxy_enabled" -ne 0
86 # causes a complaint if "$proxy_enabled" is an empty string -
87 # the first test fails, but the second test is done anyway,
88 # and generates a complaint about the LHS of -ne not being
89 # numeric. Therefore, we do the tests separately.
91 if [ -n "$proxy_enabled" ] ; then
92 if [ "$proxy_enabled" -ne 0 ] ; then
93 export http_proxy
=$
(regtool get
/HKCU
/Software
/Microsoft
/Windows
/CurrentVersion
/Internet\ Settings
/ProxyServer
2>/dev
/null
)
94 echo "Using Internet Explorer proxy settings."
98 if [ -z "$http_proxy" -a -z "$HTTP_PROXY" ] ; then
99 echo "No HTTP proxy specified (http_proxy and HTTP_PROXY are empty)."
100 # a proxy might also be specified using .wgetrc, so don't switch off the proxy
105 # We found a proxy somewhere
107 if [ -z "$http_proxy" ] ; then
108 echo "HTTP proxy ($HTTP_PROXY) has been specified and will be used."
109 export http_proxy
=$HTTP_PROXY
111 echo "HTTP proxy ($http_proxy) has been specified and will be used."
121 if [ -z "$*" ] ; then
125 echo "Checking for required applications:"
126 which which > /dev
/null
2>&1 || \
127 err_exit
"Can't find 'which'. Unable to proceed."
135 PATH_RE
="^/cygdrive/.*/"
144 APP_PATH
=$
(cygpath
--unix "$APP")
145 if [ -x "$APP_PATH" -a ! -d "$APP_PATH" ] ; then
148 APP_LOC
=$
(which "$APP_PATH" 2> /dev
/null
)
150 echo "$APP_LOC" |
grep "$PATH_RE" > /dev
/null
2>&1
152 if [ "$APP_LOC" = "" -o $IN_PATH -ne 0 ] ; then
153 MISSING_APPS
="$MISSING_APPS $APP"
155 echo " $APP: $APP_LOC $res"
161 if [ -n "$MISSING_APPS" ]; then
163 echo "Can't find: $MISSING_APPS"
164 err_exit
"These application(s) are either not installed or simply can't be found in the current PATH: $PATH." \
165 "" "For additional help, please visit:" " http://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html"
169 if [ -z "$2" -o -z "$3" -o -z "$4" ] ; then
172 DEST_PATH
=$
(cygpath
"$2")
174 PACKAGE
=$
(basename "$PACKAGE_PATH")
175 if [ ! -e "$DEST_PATH/$PACKAGE" ] ; then
176 err_exit
"Package $PACKAGE is needed but is apparently not downloaded; 'nmake -f ... setup' required ?"
180 if [ -z "$2" -o -z "$3" -o -z "$4" ] ; then
183 DEST_PATH
=$
(cygpath
"$2")
186 PACKAGE
=$
(basename "$PACKAGE_PATH")
188 echo "****** $PACKAGE ******"
190 echo "Downloading $4 into '$DEST_PATH', installing into $3"
191 if [ ! -d "$DEST_PATH/$DEST_SUBDIR" ] ; then
192 mkdir
-p "$DEST_PATH/$DEST_SUBDIR" || \
193 err_exit
"Can't create '$DEST_PATH/$DEST_SUBDIR'"
195 cd "$DEST_PATH" || err_exit
"Can't find '$DEST_PATH'"
197 wget
$use_proxy -nc "$DOWNLOAD_PREFIX/$PACKAGE_PATH" || \
198 err_exit
"Can't download $DOWNLOAD_PREFIX/$PACKAGE_PATH"
199 cd "$DEST_SUBDIR" || err_exit
"Can't find $DEST_SUBDIR"
200 echo "Extracting '$PKG_PATH/$PACKAGE' into '$PKG_PATH/$DEST_SUBDIR'"
201 if [[ "$PACKAGE" == *.
zip ]] ; then
202 unzip -oq "$PKG_PATH/$PACKAGE" ||
203 err_exit
"Couldn't unpack '$PKG_PATH/$PACKAGE'"
204 echo "Verifying that the DLLs and EXEs in $DEST_SUBDIR are executable."
205 # XX: Note that find will check *all* dlls/exes in DEST_SUBDIR and below
206 # which may be more than those just unzipped depending upon DEST_SUBDIR.
207 # This may cause extra repeated checks but will do no harm.
208 for i
in $
(/usr
/bin
/find . \
( -name '*\.dll' -o -name '*\.exe' \
)) ; do
209 if [ ! -x "$i" ] ; then
210 echo "Changing file permissions (add executable bit) to:"
218 if [ -z "$2" ] ; then
221 DEST_PATH
=$
(cygpath
"$2")
222 echo "$DOWNLOAD_TAG" > "$DEST_PATH/$TAG_FILE"
225 if [ -z "$2" ] ; then
228 DEST_PATH
=$
(cygpath
"$2")
229 WIN_PATH
=$
(cygpath
--windows "$2")
230 LAST_TAG
=$
(cat "$DEST_PATH/$TAG_FILE" 2> /dev
/null
)
231 if [ "$DOWNLOAD_TAG" != "$LAST_TAG" ] ; then
232 if [ -z "$LAST_TAG" ] ; then
236 "The contents of '$WIN_PATH\\$TAG_FILE' is $LAST_TAG." \
237 "It should be $DOWNLOAD_TAG."