aboutsummaryrefslogtreecommitdiffstats
path: root/tools/win32-setup.sh
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2008-08-27 22:06:13 +0000
committerGerald Combs <gerald@wireshark.org>2008-08-27 22:06:13 +0000
commit205d47a9055f6ffc29a9001e87c0e9815976c222 (patch)
treec6effeab7bdc1a94fdef280eca4d5e3413e732da /tools/win32-setup.sh
parent32dc6c98e44d9416d65cd6f13e603b85cf615479 (diff)
Add proxy detection to win32-setup.sh. Update and clean up some of the
proxy-related documentation. svn path=/trunk/; revision=26100
Diffstat (limited to 'tools/win32-setup.sh')
-rwxr-xr-xtools/win32-setup.sh86
1 files changed, 53 insertions, 33 deletions
diff --git a/tools/win32-setup.sh b/tools/win32-setup.sh
index 774621cc05..01b6d6e7d3 100755
--- a/tools/win32-setup.sh
+++ b/tools/win32-setup.sh
@@ -16,9 +16,9 @@ TAG_FILE="current_tag.txt"
err_exit () {
echo ""
- for str in "$@" ; do
- echo "ERROR: $str"
- done
+ for str in "$@" ; do
+ echo "ERROR: $str"
+ done
echo ""
exit 1
}
@@ -34,6 +34,38 @@ usage () {
exit 1
}
+# Try to find our proxy settings, and set http_proxy/use_proxy accordingly.
+find_proxy() {
+ # Someone went to the trouble of configuring wget.
+ if grep "^use_proxy *= *on" $HOME/.wgetrc > /dev/null 2>&1 ; then
+ return
+ fi
+
+ # ...and wget can't fetch two registry keys because...?
+ proxy_enabled=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyEnable 2>/dev/null`
+ if [ -n "$proxy_enabled" -a $proxy_enabled -ne 0 ] ; then
+ http_proxy=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyServer 2>/dev/null`
+ echo "Using Internet Explorer proxy settings."
+ fi
+
+ if [ -z "$http_proxy" -a -z "$HTTP_PROXY" ] ; then
+ echo "No HTTP proxy specified (http_proxy and HTTP_PROXY are empty)."
+ # a proxy might also be specified using .wgetrc, so don't switch off the proxy
+ #use_proxy="-Y off"
+ return
+ fi
+
+ # We found a proxy somewhere
+ use_proxy="-Y on"
+ if [ -z "$http_proxy" ] ; then
+ echo "HTTP proxy ($HTTP_PROXY) has been specified and will be used."
+ export http_proxy=$HTTP_PROXY
+ else
+ echo "HTTP proxy ($http_proxy) has been specified and will be used."
+ fi
+}
+
+
case "$1" in
--appverify)
@@ -67,7 +99,7 @@ case "$1" in
if [ ! -e $DEST_PATH/$PACKAGE ] ; then
err_exit "Package $PACKAGE is needed but is apparently not downloaded; 'nmake -f ... setup' required ?"
fi
- ;;
+ ;;
--download)
if [ -z "$2" -o -z "$3" -o -z "$4" ] ; then
usage
@@ -78,19 +110,7 @@ case "$1" in
PACKAGE=`basename "$PACKAGE_PATH"`
echo ""
echo "****** $PACKAGE ******"
- if [ -z "$http_proxy" -a -z "$HTTP_PROXY" ] ; then
- echo "No HTTP proxy specified (http_proxy and HTTP_PROXY are empty)."
- # a proxy might also be specified using .wgetrc, so don't switch off the proxy
- #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."
- export http_proxy=$HTTP_PROXY
- else
- echo "HTTP proxy ($http_proxy) has been specified and will be used."
- fi
- fi
+ find_proxy
echo "Downloading $4 into $DEST_PATH, installing into $3"
if [ ! -d "$DEST_PATH/$DEST_SUBDIR" ] ; then
mkdir -p "$DEST_PATH/$DEST_SUBDIR" || \
@@ -104,9 +124,9 @@ case "$1" in
unzip -oq "$DEST_PATH/$PACKAGE" ||
err_exit "Couldn't unpack $DEST_PATH/$PACKAGE"
echo "Verifying that the DLLs and EXEs in $DEST_SUBDIR are executable."
- # XX: Note that find will check *all* dlls/exes in DEST_SUBDIR and below
- # which may be more than those just unzipped depending upon DEST_SUBDIR.
- # This may cause extra repeated checks but will do no harm.
+ # XX: Note that find will check *all* dlls/exes in DEST_SUBDIR and below
+ # which may be more than those just unzipped depending upon DEST_SUBDIR.
+ # This may cause extra repeated checks but will do no harm.
for i in `/usr/bin/find . \( -name '*\.dll' -o -name '*\.exe' \)` ; do
if [ ! -x "$i" ] ; then
echo "Changing file permissions (add executable bit) to:"
@@ -120,25 +140,25 @@ case "$1" in
usage
fi
DEST_PATH=`cygpath --dos "$2"`
- echo "$DOWNLOAD_TAG" > $DEST_PATH/$TAG_FILE
- ;;
+ echo "$DOWNLOAD_TAG" > $DEST_PATH/$TAG_FILE
+ ;;
--checktag)
if [ -z "$2" ] ; then
usage
fi
DEST_PATH=`cygpath --dos "$2"`
WIN_PATH=`cygpath --windows "$2"`
- LAST_TAG=`cat $DEST_PATH/$TAG_FILE 2> /dev/null`
- if [ "$DOWNLOAD_TAG" != "$LAST_TAG" ] ; then
- if [ -z "$LAST_TAG" ] ; then
- LAST_TAG="(unknown)"
- fi
- err_exit \
- "The contents of $WIN_PATH\\$TAG_FILE is $LAST_TAG." \
- "It should be $DOWNLOAD_TAG." \
- "Do you need to run \"nmake -f makefile.nmake setup\"?"
- fi
- ;;
+ LAST_TAG=`cat $DEST_PATH/$TAG_FILE 2> /dev/null`
+ if [ "$DOWNLOAD_TAG" != "$LAST_TAG" ] ; then
+ if [ -z "$LAST_TAG" ] ; then
+ LAST_TAG="(unknown)"
+ fi
+ err_exit \
+ "The contents of $WIN_PATH\\$TAG_FILE is $LAST_TAG." \
+ "It should be $DOWNLOAD_TAG." \
+ "Do you need to run \"nmake -f makefile.nmake setup\"?"
+ fi
+ ;;
*)
usage
;;