--- /dev/null
+#!/bin/sh
+
+check_version(){
+check_lib_version happydoc ${PYTHONHOME}/bin
+if [ "$?" -ne "0" ]; then
+ return 1
+fi
+ver=`happydoc | grep "HappyDoc version 2.1"`
+if [ -n "$ver" ]; then
+ #echo "The product ${PRODUCT} has been already installed on yours system"
+ return 0
+fi
+return 1
+}
+
+print_env(){
+cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
+#$DELIM ${PRODUCT_TYPE} $DELIM
+export PATH=\${INSTALL_ROOT}/${PRODUCT}/bin:\${PATH}
+export PYTHONPATH=\${INSTALL_ROOT}/${PRODUCT}/lib/python2.2/site-packages:\${PYTHONPATH}
+##
+EOF
+(test -w ${PRODUCT_DIR} && cp ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh ${PRODUCT_DIR})
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+}
+
+# looks for the native product and collects it's environment (used by make_env())
+try_native(){
+happydoc="`find_in_path happydoc ${PATH}`"
+if [ -n "${happydoc}" ] ; then
+ cat > ${INSTALL_WORK}/try_native.py <<EOF
+import sys
+try :
+ import happydoclib
+ sys.exit(0)
+except ImportError, r :
+ sys.exit(1)
+EOF
+ python ${INSTALL_WORK}/try_native.py
+ if [ $? -eq 0 ] ; then
+ tmp="${happydoc} ${happydoc} \${PATH} ${PATH}";
+ path=`sort_path ${tmp}`
+ pythonpath="`find_in_path happydocset ${PYTHONPATH}`"
+ tmp="${pythonpath} ${pythonpath} \${PYTHONPATH} ${PYTHONPATH}";
+ pythonpath=`sort_path ${tmp}`
+ cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <<EOF
+#$DELIM ${PRODUCT_TYPE} $DELIM
+export PATH=${path}
+export PYTHONPATH=${pythonpath}
+##
+EOF
+ make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}"
+ rm -f ${INSTALL_WORK}/try_native.py
+ return 0
+ fi
+fi
+rm -f ${INSTALL_WORK}/try_native.py
+return 1
+}
+
+try_preinstalled(){
+try_existing ${PRODUCT_DIR} ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+return $?
+}
+
+install_source()
+{
+make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" ${PRODUCT_TYPE}
+source ${INSTALL_WORK}/$SHRC
+
+check_jb tar xfz ${SOURCE_DIR}/HappyDoc_r2_1.tar.gz -C ${INSTALL_WORK}
+
+cd ${PRODUCT_WORK}
+makedir ${PRODUCT_DIR}
+check_job ${PRODUCT_DIR}/INSTALL.LOG python setup.py install --prefix=${PRODUCT_DIR}
+#file_pth=${PRODUCT_DIR}/lib/python2.2/site-packages/happydoclib.pth
+#if [ ! -f ${file_pth} ] ; then
+# touch ${file_pth}
+# cat > ${file_pth} <<EOF
+#happydoclib
+#EOF
+#fi
+
+rm -fr ${PRODUCT_WORK}
+print_env
+}
+
+install_binary()
+{
+check_jb tar xfz ${SOURCE_DIR}/HappyDoc-r2_1.tar.gz -C ${INSTALL_ROOT}
+
+print_env
+}
+
+export PROCEDURE=$1;
+export INSTALL_WORK=$2;
+export SOURCE_DIR=$3;
+export INSTALL_ROOT=$4;
+export PRODUCT_SEQUENCE=$5;
+if [ $# == 6 ] ; then export PRODUCT_TYPE=$6 ; else export PRODUCT_TYPE="happydoc" ; fi
+export PRODUCT="HappyDoc-r2_1"
+export PRODUCT_DIR=${INSTALL_ROOT}/${PRODUCT}
+export PRODUCT_WORK=${INSTALL_WORK}/${PRODUCT}
+source ./common.sh
+$PROCEDURE