2013-07-13 17:19:22 +01:00
|
|
|
#! /bin/bash
|
2013-08-19 14:31:11 +01:00
|
|
|
###########################################################################
|
|
|
|
# GLUED: GNU/Linux Uniform Environment Distribution #
|
2017-01-16 10:30:25 +00:00
|
|
|
# Copyright (C) 2007-2017 Universidade do Porto - Faculdade de Engenharia #
|
2013-08-19 14:31:11 +01:00
|
|
|
# Laboratório de Sistemas e Tecnologia Subaquática (LSTS) #
|
|
|
|
###########################################################################
|
|
|
|
# This program is free software; you can redistribute it and/or modify #
|
|
|
|
# it under the terms of the GNU General Public License as published by #
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or (at #
|
|
|
|
# your option) any later version. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, but #
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
|
|
|
|
# General Public License for more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License #
|
|
|
|
# along with this program; if not, write to the Free Software #
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA #
|
|
|
|
# 02110-1301 USA. #
|
|
|
|
###########################################################################
|
2013-07-13 17:19:22 +01:00
|
|
|
|
|
|
|
if [ -f 'functions.bash' ]; then
|
|
|
|
DST='downloads'
|
2014-02-28 17:07:45 +00:00
|
|
|
PKGS='rules'
|
2013-07-13 17:19:22 +01:00
|
|
|
source 'functions.bash'
|
|
|
|
elif [ -f '../functions.bash' ]; then
|
|
|
|
DST='../downloads'
|
2014-02-28 17:07:45 +00:00
|
|
|
PKGS='../rules'
|
2013-07-13 17:19:22 +01:00
|
|
|
source '../functions.bash'
|
|
|
|
else
|
|
|
|
echo "ERROR: unable to find functions.bash."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$DST"
|
|
|
|
|
|
|
|
find "$PKGS" -name '*.bash' | while read file; do
|
|
|
|
url=()
|
|
|
|
PKG_COMMON="$(dirname "$file")/common.bash"
|
|
|
|
source "$file" 2> /dev/null
|
|
|
|
n=0; while [ -n "${url[$n]}" ]; do
|
|
|
|
m="${md5[$n]}"
|
|
|
|
u="${url[$n]}"
|
|
|
|
f="$DST/$(basename $u)"
|
|
|
|
fh="$(md5sum "$f" 2> /dev/null | cut -f1 -d' ')"
|
|
|
|
if [ "$fh" != "$m" ]; then
|
|
|
|
nfo1 "Downloading $f"
|
|
|
|
echo ""
|
2014-08-07 15:23:20 +01:00
|
|
|
wget \
|
|
|
|
--timeout=30 \
|
|
|
|
--tries 1 \
|
|
|
|
-P "$DST" -4 -c "$u"
|
2013-07-13 18:16:56 +01:00
|
|
|
echo ""
|
2013-07-13 17:19:22 +01:00
|
|
|
fi
|
|
|
|
let n++
|
|
|
|
done
|
|
|
|
done
|