#! /bin/sh
USER_R_HOME="${HOME}/.R"
PKGLIST="${USER_R_HOME}/doc/html/packages.html"
SEARCHINDEX="${USER_R_HOME}/doc/html/search/index.txt"
rm -rf ${USER_R_HOME}
dirs="${USER_R_HOME} ${USER_R_HOME}/doc ${USER_R_HOME}/doc/html ${USER_R_HOME}/doc/html/search ${USER_R_HOME}/library"
for d in ${dirs}; do
mkdir -p ${d}
done
for f in ${R_HOME}/doc/html/*; do
if test -f $f; then
ln -s ${f} ${USER_R_HOME}/doc/html
fi
done
for f in ${R_HOME}/doc/html/search/*; do
if test -f $f; then
ln -s ${f} ${USER_R_HOME}/doc/html/search
fi
done
rm -f ${PKGLIST}
cp ${R_HOME}/doc/html/packages-head.html ${PKGLIST}
for lib in $*; do
echo "
Packages in ${lib}
" >> ${PKGLIST}
echo "" >> ${PKGLIST}
if test -d ${lib}; then
for pkg in `ls -d ${lib}/* | sed '/CVS$/d; /profile$/d'`; do
if test -d ${pkg}; then
rm -f ${USER_R_HOME}/library/${pkg}
ln -s ${pkg} ${USER_R_HOME}/library
pkgname=`basename ${pkg}`
if test -r ${pkg}/TITLE; then
pkgtitle=`cat ${pkg}/TITLE | sed "s/^${pkgname}//"`
else
pkgtitle=""
fi
echo "
${pkgname} | ${pkgtitle} |
" \
>> ${PKGLIST}
fi
done
fi
echo "
" >> ${PKGLIST}
echo "" >> ${PKGLIST}
done
cat ${R_HOME}/doc/html/packages-foot.html >> ${PKGLIST}
rm -f ${SEARCHINDEX}
cat ${USER_R_HOME}/library/*/CONTENTS > ${SEARCHINDEX}
### Local Variables: ***
### mode: sh ***
### sh-indentation: 2 ***
### End: ***