#!/bin/sh # # build-struct - script used in conjuction with Makefile of 'diplomovka' # Creates directory structure for typeseting Postscript # and PDF document "diplomovka.ps|diplomovka.pdf" # # Usage: ./build-struct # # Developed by Lubomir Host 'rajo' # Copyright (c) 2003 Platon SDG # Licensed under terms of GNU General Public License. # All rights reserved. # # Changelog: # 30/01/2003 - created # # $Platon: $ ARGV0="$0" usage() { echo "Usage:" echo echo "$0 ''" echo } test_environ() { for i in $*; do if [ -z "${!i}" ]; then echo "$ARGV0: \$$i not defined" fi done } make_symlinks() { for i in $DEPEND; do ln -s -f "../$i" "$i" \ || cp "../$i" "$i" done for i in $IMAGES_DIR; do ln -s -f -n "../$i" "./$i" \ || cp "../$i" "./$i" done } if [ "$#" -lt "1" ]; then usage; fi echo "Building $1" if [ "X$1" = "XPostScript" ]; then test_environ DEPEND OUTPUT IMAGES_DIR \ ps__OUTPUT ps__INPUT test -d PostScript || mkdir -p PostScript for psout in $ps__OUTPUT; do ln -s -f "PostScript/$psout" "$psout" done cd PostScript \ && make_symlinks \ && for psin in $ps__INPUT; do ln -s -f "../$psin" "$psin" done elif [ "X$1" = "XPDF" ]; then test_environ DEPEND OUTPUT IMAGES_DIR \ pdf_OUTPUT pdf_INPUT test -d PDF || mkdir -p PDF for pdfout in $pdf_OUTPUT; do ln -s -f "PDF/$pdfout" "$pdfout" done cd PDF \ && make_symlinks \ && for pdfin in $pdf_INPUT; do ln -s -f "../$pdfin" "$pdfin" done else echo "I don't know, what do you want with parameter '$1'..." exit 1 fi