1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
#!/bin/sh -e
DOCDIR=/usr/share/doc/vtk-doc/html
SCRIPT=search-vtk.cgi
DOXYDIR=""
CGIDIR=""
exitinfo ()
{
if [ "$1" = "toconfig" ] ; then
echo -e "\nIf you ever want searcheable vtk docs then \
rerun the script\n\t\t/var/lib/dpkg/info/vtk-doc.postinst configure\n"
elif [ "$1" = "nodoxygen" ] ; then
echo -e "\nInstall doxygen (either as a deb or from sources) \
and then rerun the script\n\\t\t/var/lib/dpkg/info/vtk-doc.postinst configure\n"
elif [ "$1" = "nohttpd" ] ; then
echo -e "\nInstall a http server and then rerun the script\n\\t\t/var/lib/dpkg/info/vtk-doc.postinst configure\n"
fi
}
guessdoxy ()
{
echo "Guessing location of doxytag and doxysearch ..."
for exdir in /usr/bin /usr/local/bin
do
if [ -x $exdir/doxysearch -a -x $exdir/doxytag ] ; then
echo "Found doxytag and doxysearch."
DOXYDIR=$exdir
break
fi
done
if [ "$DOXYDIR" = "" ] ; then
echo "Cant find doxysearch and doxytag."
echo -n "Enter directory where doxysearch/doxytag can be found --> "
read ANS
DOXYDIR=$ANS
if [ -d $ANS ] ; then
if [ ! -x $ANS/doxytag ] ; then
echo "Cant find doxytag"
exitinfo "nodoxygen"
exit
elif [ ! -x $ANS/doxysearch ] ; then
echo "Cant find doxysearch"
exitinfo "nodoxygen"
exit
else
echo "Found doxytag and doxysearch."
fi
else
echo "Not a valid directory"
exitinfo "nodoxygen"
exit
fi
fi
}
setcgidir ()
{
CGIDIR="/usr/lib/cgi-bin"
if [ -d $CGIDIR ] ; then
echo "Installing search CGI script in $CGIDIR."
else
echo "Error: No CGI bin directory found."
echo "You will need a web server capable of handling cgi-bin scripts"
echo "to use the search engine."
echo -n "Shall I create the directory and install the script anyway? [Y,n]: "
read ANS
if [ "$ANS" = "N" -o "$ANS" = "n" ] ; then
exitinfo "nohttpd"
exit
else
mkdir $CGIDIR
if [ ! -d $CGIDIR ] ; then
exitinfo "toconfig"
exit 1
fi
fi
fi
}
initialize ()
{
echo -n "Do you want searcheable documentation? [Y/n]: "
read ANS
if [ "$ANS" = "N" -o "$ANS" = "n" ] ; then
exitinfo "toconfig"
exit
fi
echo -n "Have you installed the package doxygen? [Y/n]: "
read ANS
if [ "$ANS" = "N" -o "$ANS" = "n" ] ; then
exitinfo "nodoxygen"
exit
fi
}
setupsearch ()
{
cd $DOCDIR
echo "Generating search index."
echo "This may take a while..."
$DOXYDIR/doxytag -s search.idx
echo "done"
# reseting the search.cfg for the new settings
MYNAME=`hostname`.`dnsdomainname`
echo "http://$MYNAME/cgi-bin/dwww?type=file&location=$DOCDIR" > search.cfg
echo "http://$MYNAME/cgi-bin/$SCRIPT" >> search.cfg
# resetting the cgi script appropriately
DIRVAR=`echo $DOXYDIR | sed -e 's#/#\\\/#g'`
perl -i -pe "s/^DOXYSEARCH=.*/DOXYSEARCH=$DIRVAR\/doxysearch/" $SCRIPT
DIRVAR=`echo $DOCDIR | sed -e 's#/#\\\/#g'`
perl -i -pe "s/^DOXYPATH=.*/DOXYPATH=$DIRVAR/" $SCRIPT
# this fixes some broken links.
perl installdox
}
installsearch ()
{
echo "Installing the CGI script"
install -m 755 $SCRIPT $CGIDIR
echo "Done"
}
cleanup ()
{
echo "Read $DOCDIR/index.html to see the documentation."
}
configuredoc ()
{
initialize
echo
guessdoxy
echo
setupsearch
echo
setcgidir
echo
installsearch
echo
cleanup
echo
}
if [ "$1" = "configure" ] ; then
if command -v install-docs >/dev/null 2>&1; then
install-docs -i /usr/share/doc-base/vtk-doc
fi
# The docs are no longer searcheable because they are too large
# and doxytag chokes while generating the tag index.
#configuredoc
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|