Make it possible to generate 29tsoc ebooks
[project-aon.git] / common / pdf / build / check-images.sh
1 #!/bin/sh
2
3 # Check if the included files are all available in the current directory
4
5 file=$1
6
7 if [ -z "$file" ] ; then
8     echo "Usage: $0 file.tex" 
9     echo "Checks if the included graphics in the TeX file are available in "
10     echo "the current directory"
11     exit 1
12 fi
13
14 if [ ! -r "$file" ] ; then
15     echo "ERROR: Cannot read $file"
16     exit 1
17 fi
18
19 exitval=0
20 grep includegraphics $file | 
21 perl -ne 'print $1."\n" if /.*\{(\w+\.pdf)\}/' |
22 sort -u  | 
23 while read graph; do 
24     [ ! -e "$graph" ] && echo "WARNING: Included graphic file $graph is not available in the current directory." >&2 
25     exitval=1
26 done
27
28
29 exit $exitval