Hi all,
I tried to use the mkcygwget script to download a cygwin mirror for offline installation. The mkcygwget script generates a script named cygwget to do the heavy lifting of retreiving files. However, I got a "argument list too long" exception from wget, since the generated script has all the files to be downloaded appended to a single wget command.

I've made a slight modification to the mkcygwget script so that the generated cygwget contains a separate wget command for each file to be downloaded. This solved the problem I was having....thought I'd post the modified script to this mailing list in case anyone else was interested.
r,
Lance Nehring
New Particles Corp
http://www.newparticles.com/

#!/bin/bash


getBZ2=1


# Validate usage (minimally)
if [ $# -ne 1 ]; then
        echo "mkcygwget: Usage $0 <mirrorURL>" >&2
        exit 1
fi

mirrorURL="$1"


# Dissect the argument to separate the host and directory portions
mirrorHost="${mirrorURL%*/}"
mirrorDir="${mirrorURL##*/}"

ueMirror="$(echo "$mirrorURL" |sed -e 's/:/%3a/g' -e 's|/|%2f|g')"

mkdir "$ueMirror"


# Retrieve the "setup.ini" file from the mirror

# Get the BZip2-compressed form?
if [ "$getBZ2" ]; then
        wget -O "$ueMirror/setup.bz2" "$mirrorHost/setup.bz2"

        if [ $? -ne 0 ]; then
                echo "mkwget: Error retrieving \"setup.bz2\" from 
\"$mirrorHost/setup.bz2\"" >&2
                exit 1;
        fi

        bzcat "$ueMirror/setup.bz2" >"$ueMirror/setup.ini"
        rm "$ueMirror/setup.bz2"

# Get the uncompressed "setup.ini" file
else
        wget -O "$ueMirror/setup.ini" "$mirrorHost/setup.ini"

        if [ $? -ne 0 ]; then
                echo "mkwget: Error retrieving \"setup.ini\" from 
\"$mirrorHost/setup.ini\"" >&2
                exit 1;
        fi

fi


# Use the "setup.ini" file to produce a download script
wgetprefix="wget -x -nH --cut-dirs=1 $mirrorURL"
(
        echo -e '#!/bin/sh\n'

        echo -e "cd \"$ueMirror\"\n"

        sed -n -e "/^install: / s|^install: \([^ ]*\) .*|\t$wgetprefix/\1 |p" 
"$ueMirror/setup.ini"

        echo
) >|cygwget

chmod +x cygwget

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to