#!/bin/sh #------------------------------------------------------------------------------ # /_ADMIN/_do_ - make script - will be processed before # package generation. # # Copyright (c) 2001-2024 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2006-09-24 jed # Last Update: $Id: _do_antispam 29586 2012-01-21 09:39:42Z jed $ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #------------------------------------------------------------------------------ # set -x myecho () { if [ "`hostname`" = "farragut" ] then echo $@ fi } pgmname=$0 packname=capi2text packdir=`dirname ${pgmname}` currdir=`pwd` basename ${pgmname} | grep -q 'eis64+' if [ $? -eq 0 ] then arch='eis64' else arch='eis1' fi myecho "ARCH:${arch}" myecho "${packname} custom build script" if [ `echo "${currdir}" | grep -q "_ADMIN$"; echo $?` -eq 0 ] then # directory ends on '_ADMIN' cd ${packdir}/.. else cd ${packdir} fi # get absolute path to package directory # e.g. /svn/eis-trunk/mail/antispam/_ADMIN abs_packdir=`pwd` # copy jedlib file to include directory jedlib_file=../../../contrib/jed-eislib/var/install/include/jedlib dest_file1=../common/var/install/include/jedlib dest_file2=/var/install/include/jedlib if [ -f ${jedlib_file} ] then # source file exists if [ -f ${dest_file1}.${packname} ] then # distination file exists - check versions srcver=`/bin/bash ${jedlib_file} version` destver=`/bin/bash ${dest_file1}.${packname} version` if [ -n "${destver}" ] then # version number exists - compare version numbers if [ `echo "${srcver} > ${destver}" | bc` -eq 1 ] then # update file myecho "${jedlib_file} -> ${dest_file1}.${packname}" cp ${jedlib_file} ${dest_file1}.${packname} fi else # no version number exists - update file myecho "${jedlib_file} -> ${dest_file1}.${packname}" cp ${jedlib_file} ${dest_file1}.${packname} fi else # file doesn't exist - update file myecho "${jedlib_file} -> ${dest_file1}.${packname}" cp ${jedlib_file} ${dest_file1}.${packname} fi chmod 644 ${dest_file1}.${packname} if [ -d `dirname ${dest_file2}` ] then if [ -f ${dest_file2} ] then # distination file exists - check versions srcver=`/bin/bash ${jedlib_file} version` destver=`/bin/bash ${dest_file2} version` if [ -n "${destver}" ] then # version number exists - compare version numbers if [ `echo "${srcver} > ${destver}" | bc` -eq 1 ] then # update file myecho "${jedlib_file} -> ${dest_file2}" cp ${jedlib_file} ${dest_file2} fi else # no version number exists - update file myecho "${jedlib_file} -> ${dest_file2}" cp ${jedlib_file} ${dest_file2} fi else # file doesn't exist - update file myecho "${jedlib_file} -> ${dest_file2}" cp ${jedlib_file} ${dest_file2} fi fi fi # update base package requirement in preinstall.sh currdir="`pwd`" preinst_file=../common/tmp/preinstall.sh pack_file=../eis1/var/install/packages/${packname} old_version=`sed -n '/^base_version=/s/^base_version=.\([0-9.]*\).*$/\1/p' ${preinst_file}` new_version=`sed -n '/base/s/base *\([0-9.]*\).*/\1/p' ${pack_file}` if [ "${old_version}" != "${new_version}" ] then # replace version number sed -i "/^base_version=/s/^base_version=.*$/base_version='${new_version}'/" ${preinst_file} fi currdir="`pwd`" #webgui_dir='capi2text_webgui_v4' #webgui_dir='capi2text_webgui_v5' webgui_dir='capi2text_webgui_v6' webgui_archive="usr/share/doc/${packname}/c2t-webgui.tgz" cd ../${webgui_dir} if [ -f ../common/${webgui_archive} ] then rm -f ../common/${webgui_archive} fi # don't include .svn (SVN files) and ./installer directory due to possible security issues tar czf ${currdir}/../common/${webgui_archive} --exclude .svn --exclude capi2text-index-params.inc . webgui_old_dir='capi2text_webgui_old' webgui_old_archive="usr/share/doc/${packname}/c2t-webgui-old.tgz" cd ../${webgui_old_dir} if [ -f ../common/${webgui_old_archive} ] then rm -f ../common/${webgui_old_archive} fi # don't include .svn (SVN files) and ./installer directory due to possible security issues tar czf ${currdir}/../common/${webgui_old_archive} --exclude .svn --exclude capi2text-index-params.inc . webgui_filelist="usr/share/doc/${packname}/c2t-webgui-filelist.txt" webgui_old_filelist="usr/share/doc/${packname}/c2t-webgui-old-filelist.txt" { tar tvzf ${currdir}/../common/${webgui_archive} | cut -c 51- | grep -v "^ *$" } | sort -r | uniq > ${currdir}/../common/${webgui_filelist} { tar tvzf ${currdir}/../common/${webgui_old_archive} | cut -c 51- | grep -v "^ *$" } | sort -r | uniq > ${currdir}/../common/${webgui_old_filelist} cd ${currdir} # set +x