2 # package-db-tutorial.sh - Package up the tutorial into various formats
3 # Copyright (C) Tony Gale 2000-2002
4 # Contact: gale@gtk.org
6 # NOTE: This script requires the following to be installed:
14 SOURCE=`pwd`/gtk-tut.sgml
17 EXAMPLES=`pwd`/../../examples
20 BUILDDIR=gtk-tutorial.$DATE
24 # Check target directory
25 if [ ! -d $TARGETDIR ]; then
26 if [ -e $TARGETDIR ]; then
27 echo "ERROR: target directory is not a directory"
30 if ! mkdir $TARGETDIR; then
31 echo "mkdir for target directory failed"
36 # Check top level build directory
37 if [ ! -d $BUILDDIR ]; then
38 if [ -e $BUILDDIR ]; then
39 echo "ERROR: build directory is not a directory"
42 if ! mkdir $BUILDDIR; then
43 echo "mkdir of build directory failed"
48 if ! cd $BUILDDIR; then
49 echo "cd to build directory failed"
57 echo -n "Copy SGML and images.... "
58 if [ ! -d gtk-tutorial.sgml ]; then
59 if [ -e gtk-tutorial.sgml ]; then
60 echo "ERROR: gtk-tutorial.sgml is not a directory"
63 mkdir gtk-tutorial.sgml
66 (cd gtk-tutorial.sgml && cp $SOURCE . && cp -R $IMAGES . && rm -rf $IMAGESDIR/CVS)
67 tar cvfz $TARGETDIR/gtk-tutorial.sgml.tgz gtk-tutorial.sgml
71 echo -n "Formatting into HTML.... "
72 if [ ! -d gtk-tutorial.html ]; then
73 if [ -e gtk-tutorial.html ]; then
74 echo "ERROR: gtk-tutorial.html is not a directory"
77 mkdir gtk-tutorial.html
80 (db2html -o gtk-tutorial.html $SOURCE && cp -R $IMAGES gtk-tutorial.html && rm gtk-tutorial.html/$IMAGESDIR/*.eps) > /dev/null
81 (cd gtk-tutorial.html && rm -rf $IMAGESDIR/CVS && ln -s book1.html index.html)
82 tar cvfz $TARGETDIR/gtk-tutorial.html.tgz gtk-tutorial.html
86 echo -n "Formatting into PS and PDF.... "
87 if [ ! -d gtk-tutorial.ps ]; then
88 if [ -e gtk-tutorial.ps ]; then
89 echo "ERROR: gtk-tutorial.ps is not a directory"
95 if [ ! -d gtk-tutorial.pdf ]; then
96 if [ -e gtk-tutorial.pdf ]; then
97 echo "ERROR: gtk-tutorial.pdf is not a directory"
100 mkdir gtk-tutorial.pdf
103 sed "s/images\/\(.*\)\.png/images\/\1.eps/g" $SOURCE > gtk-tutorial.ps/gtk-tut.sgml
104 cp -R $IMAGES gtk-tutorial.ps
105 (cd gtk-tutorial.ps && db2dvi gtk-tut.sgml && dvips gtk-tut.dvi -o gtk-tut.ps && dvipdf gtk-tut.dvi ../gtk-tutorial.pdf/gtk-tut.pdf)
106 gzip -c gtk-tutorial.ps/gtk-tut.ps > $TARGETDIR/gtk-tutorial.ps.gz
107 gzip -c gtk-tutorial.pdf/gtk-tut.pdf > $TARGETDIR/gtk-tutorial.pdf.gz
111 #echo -n "Formatting into RTF.... "
112 #if [ ! -d gtk-tutorial.rtf ]; then
113 # if [ -e gtk-tutorial.rtf ]; then
114 # echo "ERROR: is not a directory"
117 # mkdir gtk-tutorial.rtf
120 #cp -R $IMAGES gtk-tutorial.rtf
121 #(cd gtk-tutorial.rtf && db2rtf $SOURCE) # > /dev/null
122 #gzip -c gtk-tutorial.rtf/gtk-tut.rtf > $TARGETDIR/gtk-tutorial.rtf.gz
126 echo -n "Copying examples"
128 (cd examples && make clean && rm -rf CVS */CVS */.cvsignore README.1ST extract.awk extract.sh find-examples.sh)
129 tar cfz $TARGETDIR/examples.tgz examples
136 echo Packages created.