5 kx #!/bin/sh
5 kx
5 kx trap 'echo ""; echo "`basename $0`: interrupted"; killall wget && killall "`basename $0`"; exit' 1 2 3 9 15
5 kx
5 kx TARBALL=$1
5 kx
5 kx if [ -z "$TARBALL" ] ; then
5 kx echo "#"
5 kx echo -e "# ERROR: Toolchain URL is not defined."
5 kx echo "#"
5 kx exit 1
5 kx fi
5 kx
5 kx tarball=`basename $TARBALL`
5 kx
5 kx progress() {
5 kx echo "#"
5 kx echo -n "# wgetting '$tarball': "
5 kx while true ; do
5 kx echo -n "." ; sleep 1 ;
5 kx done
5 kx }
5 kx
5 kx progress &
5 kx PID=$!
5 kx echo "$TARBALL" | xargs -n 1 -P 100 wget -q -N -i
5 kx kill $PID > /dev/null 2>&1
5 kx echo -e "\n#"
5 kx echo -n "# unpack '$tarball': "
5 kx tar --checkpoint=.1000 -xf $tarball
5 kx echo -e "\n#"