Temporary Hardcoded Ubuntu repo
[fuel.git] / build / check_dependencies.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 # Given a file as input, this script verifies that all URIs in the file can
13 # be fetched.
14
15 if [ $# -ne 1 ]; then
16   echo "Usage: $(basename $0) <filename>"
17   exit 1
18 fi
19
20 if [ ! -e $1 ]; then
21   echo "Could not open $1"
22   exit 1
23 fi
24
25 echo "Checking dependencies in $1"
26 rc=0
27 for uri in `cat $1`
28 do
29   if ! curl -sfr 0-100 $uri > /dev/null; then
30     echo "Failed fetching $uri" >&2
31     rc=1
32   fi
33 done
34
35 if [ $rc -ne 0 ]; then
36   echo "ERROR checking dependencies in $1"
37 else
38   echo "Dependencies OK"
39 fi
40
41 exit $rc