diff --git a/livesupport/README b/livesupport/README index ab8f1b9b9..05f73baa9 100644 --- a/livesupport/README +++ b/livesupport/README @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/README,v $ -------------------------------------------------------------------------------- @@ -34,6 +34,7 @@ The generic documentation start page is doc/index.html For the impatient, do the following: +./configure make setup make compile diff --git a/livesupport/bin/autogen.sh b/livesupport/bin/autogen.sh new file mode 100755 index 000000000..84ed11a18 --- /dev/null +++ b/livesupport/bin/autogen.sh @@ -0,0 +1,80 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/autogen.sh,v $ +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Run this to set up the build system: configure, makefiles, etc. +# (based on the version in enlightenment's cvs) +#------------------------------------------------------------------------------- + +package="LiveSupport" + +# assume we're in $basedir/bin +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +test -z "$basedir" && basedir=. + +bindir=$basedir/bin +etcdir=$basedir/etc +tmpdir=$basedir/tmp + +cd "$tmpdir" +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile $package." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." +fi + +echo "Generating configuration files for $package, please wait...." + +configure_ac=${etcdir}/configure.ac +configure=${tmpdir}/configure +aclocal_m4=${tmpdir}/aclocal.m4 + +if [ -f ${etcdir}/acinclude.m4 ]; then +# run aclocal in etc, as it's blind, only sees files in the current directory + ACLOCAL_FLAGS="--output=${aclocal_m4}" + echo " aclocal $ACLOCAL_FLAGS" + cd ${etcdir} && aclocal $ACLOCAL_FLAGS ; cd ${tmpdir} +fi +echo " autoconf -I ${tmpdir} -o ${configure} ${configure_ac}" +autoconf -I ${tmpdir} -o ${configure} ${configure_ac} + +${configure} "$@" && echo diff --git a/livesupport/bin/copyInstall.sh b/livesupport/bin/copyInstall.sh new file mode 100755 index 000000000..b28f9d6dc --- /dev/null +++ b/livesupport/bin/copyInstall.sh @@ -0,0 +1,191 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/Attic/copyInstall.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script installs LiveSupport files to their installation location. +# +# Invoke as: +# ./bin/copyInstall.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp +toolsdir=$basedir/tools +modules_dir=$basedir/modules +products_dir=$basedir/products + +usrdir=`cd $basedir/usr; pwd;` + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport install copy script."; + echo "parameters"; + echo ""; + echo " -d, --directory The installation directory, required."; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o d:h -l directory:,help -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -d|--directory) + installdir=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$installdir" == "x" ]; then + echo "Required parameter install directory not specified."; + printUsage; + exit 1; +fi + + +echo "Installing LiveSupport files."; +echo ""; +echo "Using the following installation parameters:"; +echo ""; +echo " installation directory: $installdir"; +echo "" + + +#------------------------------------------------------------------------------- +# The details of installation +#------------------------------------------------------------------------------- +install_bin=$installdir/bin +install_etc=$installdir/etc +install_lib=$installdir/lib +install_tmp=$installdir/tmp +install_var=$installdir/var + + +#------------------------------------------------------------------------------- +# Create the installation directory structure +#------------------------------------------------------------------------------- +echo "Copying files..." + +mkdir -p $installdir +mkdir -p $install_bin +mkdir -p $install_etc +mkdir -p $install_lib +mkdir -p $install_tmp +mkdir -p $install_var + + +#------------------------------------------------------------------------------- +# Copy the PHP files +#------------------------------------------------------------------------------- +mkdir $install_var/getid3 +cp -pPR $modules_dir/getid3/var $install_var/getid3 + +mkdir $install_var/alib +cp -pPR $modules_dir/alib/var $install_var/alib + +mkdir $install_var/storageServer +cp -pPR $modules_dir/storageServer/var $install_var/storageServer + +mkdir $install_var/archiveServer +cp -pPR $modules_dir/archiveServer/var $install_var/archiveServer + +mkdir $install_var/htmlUI +cp -pPR $modules_dir/htmlUI/var $install_var/htmlUI + + +#------------------------------------------------------------------------------- +# Copy libraries +#------------------------------------------------------------------------------- +cp -pPR $usrdir/lib/* $install_lib + + +#------------------------------------------------------------------------------- +# Copy scheduler related files +#------------------------------------------------------------------------------- +cp -pPR $products_dir/scheduler/tmp/scheduler $install_bin +cp -pPR $products_dir/scheduler/bin/scheduler.sh $install_bin + + +#------------------------------------------------------------------------------- +# Copy gLiveSupport related files +#------------------------------------------------------------------------------- +cp -pPR $products_dir/gLiveSupport/tmp/gLiveSupport $install_bin +cp -pPR $products_dir/gLiveSupport/bin/gLiveSupport.sh $install_bin + + +#------------------------------------------------------------------------------- +# Copy post-installation configuration related files +#------------------------------------------------------------------------------- +cp -pPR $bindir/postInstallScheduler.sh $install_bin +cp -pPR $bindir/postInstallGLiveSupport.sh $install_bin +cp -pPR $products_dir/scheduler/etc/scheduler.xml.template $install_etc +cp -pPR $products_dir/scheduler/etc/odbcinst_template $install_etc +cp -pPR $products_dir/scheduler/etc/odbcinst_debian_template $install_etc +cp -pPR $products_dir/scheduler/etc/odbc_template $install_etc +cp -pPR $products_dir/gLiveSupport/etc/gLiveSupport.xml.template $install_etc + + +#------------------------------------------------------------------------------- +# Clean up remnants of the CVS system +#------------------------------------------------------------------------------- +rm -rf `find $install_var -type d -name CVS` + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo "Done." + diff --git a/livesupport/bin/createDebianPackages.sh b/livesupport/bin/createDebianPackages.sh new file mode 100755 index 000000000..288eb3353 --- /dev/null +++ b/livesupport/bin/createDebianPackages.sh @@ -0,0 +1,251 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/createDebianPackages.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script creates Debian packages from LiveSupport tarballs. +# To create the tarballs first, see the dist.sh script. +# +# Invoke as: +# ./bin/createDebianPackages.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp + +usrdir=`cd $basedir/usr; pwd;` + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport debian source package creation script"; + echo "parameters"; + echo ""; + echo " -d, --directory Place to look for the livesupport source"; + echo " tarballs [default: current directory]"; + echo " -m, --maintainer The name and e-mail address of the package"; + echo " maintainer."; + echo " -o, --output-directory the output directory for the files"; + echo " [default: current directory]"; + echo " -v, --version The version number of the created packages."; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o d:hm:o:v: -l directory:,help,maintainer:,output-directory,version: -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -d|--directory) + directory=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + -m|--maintainer) + maintainer=$2; + shift; shift;; + -o|--output-directory) + outdir=$2; + shift; shift;; + -v|--version) + version=$2; + shift; shift;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$maintainer" == "x" ]; then + echo "Required parameter maintainer not specified."; + printUsage; + exit 1; +fi + +if [ "x$version" == "x" ]; then + echo "Required parameter version not specified."; + printUsage; + exit 1; +fi + +if [ "x$directory" == "x" ]; then + directory=`pwd`; +else + directory=`cd $directory; pwd;` +fi + +if [ "x$outdir" == "x" ]; then + outdir=`pwd`; +else + outdir=`cd $outdir; pwd;` +fi + + +echo "Creating Debian source packages for LiveSupport."; +echo ""; +echo "Using the following parameters:"; +echo ""; +echo " tarball directory: $directory"; +echo " maintainer: $maintainer"; +echo " package version number: $version"; +echo " output directory: $outdir"; +echo "" + + +#------------------------------------------------------------------------------- +# More definitions +#------------------------------------------------------------------------------- +tarball=$directory/livesupport-$version.tar.bz2 +tarball_libs=$directory/livesupport-libraries-$version.tar.bz2 + +if [ ! -f $tarball ]; then + echo "source tarball $tarball not found in directory $directory"; + exit 1; +fi + +if [ ! -f $tarball_libs ]; then + echo "source tarball $tarball_libs not found in directory $directory"; + exit 1; +fi + + +# TODO: maybe read debianVersion as a command line parameter +debianVersion=1 +packageName=livesupport-$version +packageNameOrig=$packageName.orig +workdir=$tmpdir/debianize +fullVersion=$version-$debianVersion +diffGz=livesupport_$fullVersion.diff.gz +origTarGz=livesupport_$fullVersion.orig.tar.gz +dsc=livesupport_$fullVersion.dsc + +replace_sed_string="s/ls_version/$version/; \ + s/ls_debianVersion/$debianVersion/; \ + s/ls_maintainer/$maintainer/;" + + +#------------------------------------------------------------------------------- +# Create the environment +#------------------------------------------------------------------------------- +rm -rf $workdir +mkdir -p $workdir +cd $workdir + + +#------------------------------------------------------------------------------- +# Untar the source tarballs +#------------------------------------------------------------------------------- +echo "Extracting source tarballs..."; + +# untar first, and rename as livesupport-$version.orig +tar xfj $tarball +tar xfj $tarball_libs +mv $packageName $packageNameOrig + +# untar again, and leave it as livesupport-$version +tar xfj $tarball +tar xfj $tarball_libs + + +#------------------------------------------------------------------------------- +# Debianize the livesupport-$version sources +#------------------------------------------------------------------------------- +echo "Debianizing sources..."; + +cp -pPR $etcdir/debian $packageName + +# get rid of the remnants of the CVS system +rm -rf `find $packageName -name CVS -type d` + + +#------------------------------------------------------------------------------- +# Create a debianized source package. +#------------------------------------------------------------------------------- +echo "Creating debian source package..."; + +diff -Naur $packageNameOrig $packageName | gzip -9 > $diffGz + +# create the original source tarball +tar cfz $origTarGz $packageNameOrig + +# customize the dsc file +cat $etcdir/livesupport.dsc.template | sed -e "$replace_sed_string" > $dsc + +# append with checksums, sizes and source file names +md5sum=`md5sum $origTarGz | cut -d" " -f1` +size=`find . -name $origTarGz -printf "%s"` +echo " $md5sum $size $origTarGz" >> $dsc + +md5sum=`md5sum $diffGz | cut -d" " -f1` +size=`find . -name $diffGz -printf "%s"` +echo " $md5sum $size $diffGz" >> $dsc + + +#------------------------------------------------------------------------------- +# Copy the resulting files to the target directory +#------------------------------------------------------------------------------- +echo "Moving debian source package files to target directory..."; + +mv -f $origTarGz $diffGz $dsc $outdir + + +#------------------------------------------------------------------------------- +# Clean up +#------------------------------------------------------------------------------- +echo "Cleaning up..."; + +cd $basedir +#rm -rf $workdir + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo "Done." + diff --git a/livesupport/bin/dist.sh b/livesupport/bin/dist.sh index ec7eb7d73..2a1557fc2 100755 --- a/livesupport/bin/dist.sh +++ b/livesupport/bin/dist.sh @@ -22,7 +22,7 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.4 $ +# Version : $Revision: 1.5 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/dist.sh,v $ #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- @@ -32,23 +32,9 @@ # livesupport-libraries-.tar.bz2 - dependent libraries # # Invoke as: -# ./bin/dist.sh +# ./bin/dist.sh -v #------------------------------------------------------------------------------- -if [ "x$1" == "x" ]; then - echo "Please provide a version number as the first paramter."; - exit 0; -fi - -version=$1 -tarball=livesupport-$version.tar.bz2 -tarball_libs=livesupport-libraries-$version.tar.bz2 - -echo "WARNING! make sure to run this script on a freshly checked-out copy"; -echo " of LiveSupport, with NO generated files!"; -echo ""; -echo "Creating $tarball and $tarball_libs"; - #------------------------------------------------------------------------------- # Determine directories, files #------------------------------------------------------------------------------- @@ -64,6 +50,80 @@ products_dir=$basedir/products usrdir=`cd $basedir/usr; pwd;` + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport install script."; + echo "parameters"; + echo ""; + echo " -d, --directory Place the tarballs in the specified directory."; + echo " [default: current directory]"; + echo " -h, --help Print this message and exit."; + echo " -v, --version The version number of the created packages."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o d:hv: -l directory:,help,version: -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -d|--directory) + directory=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + -v|--version) + version=$2; + shift; shift;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$version" == "x" ]; then + echo "Required parameter version not specified."; + printUsage; + exit 1; +fi + +if [ "x$directory" == "x" ]; then + directory=`pwd`; +fi + + +echo "Creating tarballs for LiveSupport."; +echo ""; +echo "Using the following parameters:"; +echo ""; +echo " output directory: $directory"; +echo " package version number: $version"; +echo "" +echo "WARNING! make sure to run this script on a freshly checked-out copy"; +echo " of LiveSupport, with NO generated files!"; +echo "" + + +#------------------------------------------------------------------------------- +# More definitions +#------------------------------------------------------------------------------- +tarball=$directory/livesupport-$version.tar.bz2 +tarball_libs=$directory/livesupport-libraries-$version.tar.bz2 + ls_tmpdir=$tmpdir/livesupport-$version tools_tmpdir=$ls_tmpdir/tools modules_tmpdir=$ls_tmpdir/modules diff --git a/livesupport/bin/install.sh b/livesupport/bin/install.sh index 34c76e25c..1fc46d674 100755 --- a/livesupport/bin/install.sh +++ b/livesupport/bin/install.sh @@ -22,7 +22,7 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.8 $ +# Version : $Revision: 1.9 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/Attic/install.sh,v $ #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- @@ -49,8 +49,6 @@ products_dir=$basedir/products usrdir=`cd $basedir/usr; pwd;` -installlog=/tmp/livesupport_install.log - #------------------------------------------------------------------------------- # Print the usage information for this script. @@ -70,6 +68,8 @@ printUsage() echo " -p, --port The port of the apache web server [default: 80]" echo " -P, --scheduler-port The port of the scheduler daemon to install" echo " [default: 3344]"; + echo " -r, --www-root The root directory for web documents served"; + echo " by apache [default: /var/www]"; echo " -s, --dbserver The name of the database server host."; echo " [default: localhost]"; echo " -u, --dbuser The name of the database user to access the" @@ -86,7 +86,7 @@ printUsage() #------------------------------------------------------------------------------- CMD=${0##*/} -opts=$(getopt -o d:D:g:H:hp:P:s:u:w: -l apache-group:,database:,dbserver:,dbuser:,dbpassword:,directory:,host:,help,port:,scheduler-port -n $CMD -- "$@") || exit 1 +opts=$(getopt -o d:D:g:H:hp:P:r:s:u:w: -l apache-group:,database:,dbserver:,dbuser:,dbpassword:,directory:,host:,help,port:,scheduler-port:,www-root: -n $CMD -- "$@") || exit 1 eval set -- "$opts" while true; do case "$1" in @@ -111,6 +111,9 @@ while true; do -P|--scheduler-port) scheduler_port=$2; shift; shift;; + -r|--www-root) + www_root=$2; + shift; shift;; -s|--dbserver) dbserver=$2; shift; shift;; @@ -168,6 +171,10 @@ if [ "x$apache_group" == "x" ]; then apache_group=apache; fi +if [ "x$www_root" == "x" ]; then + www_root=/var/www +fi + echo "Installing LiveSupport."; echo ""; @@ -182,305 +189,42 @@ echo " database: $database"; echo " database user: $dbuser"; echo " database user password: $dbpassword"; echo " apache daemon group: $apache_group"; +echo " apache document root: $www_root"; echo "" -# check for the apache group to be a real group -group_tmp_file=/tmp/ls_group_check.$$ -touch $group_tmp_file -test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null` -if [ $? != 0 ]; then - rm -f $group_tmp_file; - echo "Unable to use apache deamon group $apache_group."; - echo "Please check if $apache_group is a correct user group."; - exit 1; -fi -rm -f $group_tmp_file; + +#------------------------------------------------------------------------------- +# Do pre-install checks +#------------------------------------------------------------------------------- +$bindir/preInstall.sh --apache-group $apache_group || exit 1; #------------------------------------------------------------------------------- -# The details of installation +# Copy the files #------------------------------------------------------------------------------- -ls_php_host=$hostname -ls_php_port=$http_port -ls_php_urlPrefix=livesupport - -ls_alib_xmlRpcPrefix="xmlrpc/xrLocStor.php" -ls_storage_xmlRpcPrefix="xmlrpc/xrLocStor.php" - -ls_dbserver=$dbserver -ls_dbuser=$dbuser -ls_dbpassword=$dbpassword -ls_database=$database - -ls_scheduler_host=$hostname -ls_scheduler_port=$scheduler_port -ls_scheduler_urlPrefix= -ls_scheduler_xmlRpcPrefix=RC2 - - -postgres_user=postgres - -install_bin=$installdir/bin -install_etc=$installdir/etc -install_lib=$installdir/lib -install_tmp=$installdir/tmp -install_var=$installdir/var - - -# replace / characters with a \/ sequence, for sed below -# the sed statement is really "s/\//\\\\\//g", but needs escaping because of -# bash, hence the extra '\' characters -installdir_s=`echo $installdir | sed -e "s/\//\\\\\\\\\//g"` -ls_storage_xmlRpcPrefix_s=`echo $ls_storage_xmlRpcPrefix | \ - sed -e "s/\//\\\\\\\\\//g"` -ls_alib_xmlRpcPrefix_s=`echo $ls_alib_xmlRpcPrefix | sed -e "s/\//\\\\\\\\\//g"` -ls_php_urlPrefix_s=`echo $ls_php_urlPrefix | sed -e "s/\//\\\\\\\\\//g"` -ls_scheduler_urlPrefix_s=`echo $ls_scheduler_urlPrefix | \ - sed -e "s/\//\\\\\\\\\//g"` -ls_scheduler_xmlRpcPrefix_s=`echo $ls_scheduler_xmlRpcPrefix | \ - sed -e "s/\//\\\\\\\\\//g"` - -replace_sed_string="s/ls_install_dir/$installdir_s/; \ - s/ls_dbuser/$ls_dbuser/; \ - s/ls_dbpassword/$ls_dbpassword/; \ - s/ls_dbserver/$ls_dbserver/; \ - s/ls_database/$ls_database/; \ - s/ls_storageUrlPath/\/$ls_php_urlPrefix_s\/storageServer\/var/; \ - s/ls_php_urlPrefix/$ls_php_urlPrefix_s/; \ - s/ls_storage_xmlRpcPrefix/$ls_storage_xmlRpcPrefix_s/; \ - s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \ - s/ls_php_host/$ls_php_host/; \ - s/ls_php_port/$ls_php_port/; \ - s/ls_archiveUrlPath/\/$ls_php_urlPrefix_s\/archiveServer\/var/; \ - s/ls_scheduler_urlPrefix/$ls_scheduler_urlPrefix_s/; \ - s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/; \ - s/ls_scheduler_host/$ls_scheduler_host/; \ - s/ls_scheduler_port/$ls_scheduler_port/;" - +$bindir/copyInstall.sh --directory $installdir || exit 1; #------------------------------------------------------------------------------- -# Function to check for the existence of an executable on the PATH -# -# @param $1 the name of the exectuable -# @return 0 if the executable exists on the PATH, non-0 otherwise +# Do post-install setup #------------------------------------------------------------------------------- -check_exe() { - if [ -x "`which $1 2> /dev/null`" ]; then - echo "Exectuable $1 found..."; - return 0; - else - echo "Exectuable $1 not found..."; - return 1; - fi -} +$bindir/postInstallScheduler.sh --directory $installdir \ + --database $database \ + --apache-group $apache_group \ + --host $hostname \ + --port $http_port \ + --scheduler-port $scheduler_port \ + --dbserver $dbserver \ + --dbuser $dbuser \ + --dbpassword $dbpassword \ + --www-root $www_root \ + || exit 1; - -#------------------------------------------------------------------------------- -# Function to check for a PEAR module -# -# @param $1 the name of the PEAR module -# @return 0 if the module is available, non-0 otherwise -#------------------------------------------------------------------------------- -check_pear_module() { - test_result=`pear info $1` - if [ $? = 0 ]; then - echo "PEAR module $1 found..."; - return 0; - else - echo "PEAR module $1 not found..."; - return 1; - fi -} - - -#------------------------------------------------------------------------------- -# Check to see if this script is being run as root -#------------------------------------------------------------------------------- -if [ `whoami` != "root" ]; then - echo "Please run this script as root."; - exit ; -fi - - -#------------------------------------------------------------------------------- -# Check for required tools -#------------------------------------------------------------------------------- -echo "Checking for required tools..." - -check_exe "sed" || exit 1; -check_exe "psql" || exit 1; -check_exe "php" || exit 1; -check_exe "pear" || exit 1; -check_exe "odbcinst" || exit 1; - -check_pear_module "DB" || exit 1; -check_pear_module "Calendar" || exit 1; -check_pear_module "File" || exit 1; -check_pear_module "File_Find" || exit 1; -check_pear_module "HTML_Common" || exit 1; -check_pear_module "HTML_QuickForm" || exit 1; -check_pear_module "XML_Beautifier" || exit 1; -check_pear_module "XML_Parser" || exit 1; -check_pear_module "XML_RPC" || exit 1; -check_pear_module "XML_Serializer" || exit 1; -check_pear_module "XML_Util" || exit 1; - - -#------------------------------------------------------------------------------- -# Create the necessary database user and database itself -#------------------------------------------------------------------------------- -echo "Creating database and database user..."; - -# FIXME: the below might not work for remote databases - -su - $postgres_user -c "echo \"CREATE USER $ls_dbuser \ - ENCRYPTED PASSWORD '$ls_dbpassword' \ - CREATEDB NOCREATEUSER;\" \ - | psql -h $ls_dbserver template1" \ - || echo "Couldn't create database user $ls_dbuser."; - -su - $postgres_user -c "echo \"CREATE DATABASE \\\"$ls_database\\\" \ - OWNER $ls_dbuser ENCODING 'utf-8';\" \ - | psql -h $ls_dbserver template1" \ - || echo "Couldn't create database $ls_database."; - - -# TODO: check for the success of these operations somehow - - -#------------------------------------------------------------------------------- -# Create the ODBC data source and driver -#------------------------------------------------------------------------------- -echo "Creating ODBC data source and driver..."; - -odbcinst_template=$products_dir/scheduler/etc/odbcinst_template -odbc_template=$products_dir/scheduler/etc/odbc_template -odbc_template_tmp=/tmp/odbc_template.$$ - -# check for an existing PostgreSQL ODBC driver, and only install if necessary -odbcinst_res=`odbcinst -q -d | grep "\[PostgreSQL\]"` -if [ "x$odbcinst_res" == "x" ]; then - echo "Registering ODBC PostgreSQL driver..."; - odbcinst -i -d -v -f $odbcinst_template || exit 1; -fi - -echo "Registering LiveSupport ODBC data source..."; -cat $odbc_template | sed -e "$replace_sed_string" > $odbc_template_tmp -odbcinst -i -s -l -f $odbc_template_tmp || exit 1; -rm -f $odbc_template_tmp - - -#------------------------------------------------------------------------------- -# Create the installation directory structure -#------------------------------------------------------------------------------- -echo "Copying files..." - -mkdir -p $installdir -mkdir -p $install_bin -mkdir -p $install_etc -mkdir -p $install_lib -mkdir -p $install_tmp -mkdir -p $install_var - - -#------------------------------------------------------------------------------- -# Copy the PHP files -#------------------------------------------------------------------------------- -mkdir $install_var/getid3 -cp -pPR $modules_dir/getid3/var $install_var/getid3 - -mkdir $install_var/alib -cp -pPR $modules_dir/alib/var $install_var/alib - -mkdir $install_var/storageServer -cp -pPR $modules_dir/storageServer/var $install_var/storageServer - -mkdir $install_var/archiveServer -cp -pPR $modules_dir/archiveServer/var $install_var/archiveServer - -mkdir $install_var/htmlUI -cp -pPR $modules_dir/htmlUI/var $install_var/htmlUI - - -#------------------------------------------------------------------------------- -# Copy scheduler related files -#------------------------------------------------------------------------------- -cp -pPR $usrdir/lib/* $install_lib -cp -pPR $products_dir/scheduler/tmp/scheduler $install_bin -cp -pPR $products_dir/scheduler/bin/scheduler.sh $install_bin - - -#------------------------------------------------------------------------------- -# Clean up remnants of the CVS system -#------------------------------------------------------------------------------- -rm -rf `find $install_var -type d -name CVS` - - -#------------------------------------------------------------------------------- -# Customize the configuration files with the appropriate values -#------------------------------------------------------------------------------- -echo "Customizing configuration files..." - -cat $install_var/storageServer/var/conf.php.template \ - | sed -e "$replace_sed_string" \ - > $install_var/storageServer/var/conf.php - -cat $install_var/archiveServer/var/conf.php.template \ - | sed -e "$replace_sed_string" \ - > $install_var/archiveServer/var/conf.php - -cat $products_dir/scheduler/etc/scheduler.xml.template \ - | sed -e "$replace_sed_string" \ - > $install_etc/scheduler.xml - - -#------------------------------------------------------------------------------- -# Setup directory permissions -#------------------------------------------------------------------------------- -echo "Setting up directory permissions..." - -chgrp $apache_group $install_var/archiveServer/var/stor -chgrp $apache_group $install_var/archiveServer/var/access -chgrp $apache_group $install_var/archiveServer/var/trans -chgrp $apache_group $install_var/archiveServer/var/stor/buffer - -chmod g+sw $install_var/archiveServer/var/stor -chmod g+sw $install_var/archiveServer/var/access -chmod g+sw $install_var/archiveServer/var/trans -chmod g+sw $install_var/archiveServer/var/stor/buffer - -chgrp $apache_group $install_var/storageServer/var/stor -chgrp $apache_group $install_var/storageServer/var/access -chgrp $apache_group $install_var/storageServer/var/trans -chgrp $apache_group $install_var/storageServer/var/stor/buffer - -chmod g+sw $install_var/storageServer/var/stor -chmod g+sw $install_var/storageServer/var/access -chmod g+sw $install_var/storageServer/var/trans -chmod g+sw $install_var/storageServer/var/stor/buffer - -chgrp $apache_group $install_var/htmlUI/var/templates_c -chgrp $apache_group $install_var/htmlUI/var/html/img - -chmod g+sw $install_var/htmlUI/var/templates_c -chmod g+sw $install_var/htmlUI/var/html/img - - -#------------------------------------------------------------------------------- -# Initialize the database -#------------------------------------------------------------------------------- -echo "Initializing database..."; - -# create PHP-related database tables -cd $install_var/storageServer/var/install -php -q install.php || exit 1; -cd - - -# create scheduler-related database tables -cd $installdir -./bin/scheduler.sh install || exit 1; -cd - +$bindir/postInstallGLiveSupport.sh --directory $installdir \ + --host $hostname \ + --port $http_port \ + --scheduler-port $scheduler_port \ + || exit 1; #------------------------------------------------------------------------------- diff --git a/livesupport/bin/postInstallGLiveSupport.sh b/livesupport/bin/postInstallGLiveSupport.sh new file mode 100755 index 000000000..06f22bf05 --- /dev/null +++ b/livesupport/bin/postInstallGLiveSupport.sh @@ -0,0 +1,220 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/Attic/postInstallGLiveSupport.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script makes post-installation steps for GLiveSupport. +# +# Invoke as: +# ./bin/postInstallGLiveSupport.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "GLiveSupport post-install script."; + echo "parameters"; + echo ""; + echo " -d, --directory The installation directory, required."; + echo " -H, --host The fully qualified host name of the system"; + echo " [default: guess]."; + echo " -p, --port The port of the apache web server [default: 80]" + echo " -P, --scheduler-port The port of the scheduler daemon to install" + echo " [default: 3344]"; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o d:H:hp:P: -l directory:,host:,help,port:,scheduler-port: -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -d|--directory) + installdir=$2; + shift; shift;; + -H|--host) + hostname=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + -p|--port) + http_port=$2; + shift; shift;; + -P|--scheduler-port) + scheduler_port=$2; + shift; shift;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$installdir" == "x" ]; then + echo "Required parameter install directory not specified."; + printUsage; + exit 1; +fi + +if [ "x$hostname" == "x" ]; then + hostname=`hostname -f`; +fi + +if [ "x$http_port" == "x" ]; then + http_port=80; +fi + +if [ "x$scheduler_port" == "x" ]; then + scheduler_port=3344; +fi + + +echo "Making post-install steps for GLiveSupport."; +echo ""; +echo "Using the following installation parameters:"; +echo ""; +echo " installation directory: $installdir"; +echo " host name: $hostname"; +echo " web server port: $http_port"; +echo " scheduler port: $scheduler_port"; +echo "" + +#------------------------------------------------------------------------------- +# The details of installation +#------------------------------------------------------------------------------- +ls_php_host=$hostname +ls_php_port=$http_port +ls_php_urlPrefix=livesupport + +ls_alib_xmlRpcPrefix="xmlrpc/xrLocStor.php" +ls_storage_xmlRpcPrefix="xmlrpc/xrLocStor.php" + +ls_scheduler_host=$hostname +ls_scheduler_port=$scheduler_port +ls_scheduler_urlPrefix= +ls_scheduler_xmlRpcPrefix=RC2 + + +install_bin=$installdir/bin +install_etc=$installdir/etc +install_lib=$installdir/lib +install_tmp=$installdir/tmp +install_var=$installdir/var + + +# replace / characters with a \/ sequence, for sed below +# the sed statement is really "s/\//\\\\\//g", but needs escaping because of +# bash, hence the extra '\' characters +installdir_s=`echo $installdir | sed -e "s/\//\\\\\\\\\//g"` +ls_storage_xmlRpcPrefix_s=`echo $ls_storage_xmlRpcPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` +ls_alib_xmlRpcPrefix_s=`echo $ls_alib_xmlRpcPrefix | sed -e "s/\//\\\\\\\\\//g"` +ls_php_urlPrefix_s=`echo $ls_php_urlPrefix | sed -e "s/\//\\\\\\\\\//g"` +ls_scheduler_urlPrefix_s=`echo $ls_scheduler_urlPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` +ls_scheduler_xmlRpcPrefix_s=`echo $ls_scheduler_xmlRpcPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` + +replace_sed_string="s/ls_install_dir/$installdir_s/; \ + s/ls_storageUrlPath/\/$ls_php_urlPrefix_s\/storageServer\/var/; \ + s/ls_php_urlPrefix/$ls_php_urlPrefix_s/; \ + s/ls_storage_xmlRpcPrefix/$ls_storage_xmlRpcPrefix_s/; \ + s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \ + s/ls_php_host/$ls_php_host/; \ + s/ls_php_port/$ls_php_port/; \ + s/ls_archiveUrlPath/\/$ls_php_urlPrefix_s\/archiveServer\/var/; \ + s/ls_scheduler_urlPrefix/$ls_scheduler_urlPrefix_s/; \ + s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/; \ + s/ls_scheduler_host/$ls_scheduler_host/; \ + s/ls_scheduler_port/$ls_scheduler_port/;" + + + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Check for required tools +#------------------------------------------------------------------------------- +echo "Checking for required tools..." + +check_exe "sed" || exit 1; + + +#------------------------------------------------------------------------------- +# Customize the configuration files with the appropriate values +#------------------------------------------------------------------------------- +echo "Customizing configuration files..." + +cat $install_etc/gLiveSupport.xml.template \ + | sed -e "$replace_sed_string" \ + > $install_etc/gLiveSupport.xml + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo "Done." + diff --git a/livesupport/bin/postInstallScheduler.sh b/livesupport/bin/postInstallScheduler.sh new file mode 100755 index 000000000..41250106d --- /dev/null +++ b/livesupport/bin/postInstallScheduler.sh @@ -0,0 +1,445 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/Attic/postInstallScheduler.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script makes post-installation steps for the LiveSupport scheduler. +# +# Invoke as: +# ./bin/postInstallScheduler.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport scheduler post-install script."; + echo "parameters"; + echo ""; + echo " -d, --directory The installation directory, required."; + echo " -D, --database The name of the LiveSupport database."; + echo " [default: LiveSupport]"; + echo " -g, --apache-group The group the apache daemon runs as."; + echo " [default: apache]"; + echo " -H, --host The fully qualified host name of the system"; + echo " [default: guess]."; + echo " -p, --port The port of the apache web server [default: 80]" + echo " -P, --scheduler-port The port of the scheduler daemon to install" + echo " [default: 3344]"; + echo " -r, --www-root The root directory for web documents served"; + echo " by apache [default: /var/www]"; + echo " -s, --dbserver The name of the database server host."; + echo " [default: localhost]"; + echo " -u, --dbuser The name of the database user to access the" + echo " database. [default: livesupport]"; + echo " -w, --dbpassword The database user password."; + echo " [default: livesupport]"; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o d:D:g:H:hp:P:r:s:u:w: -l apache-group:,database:,dbserver:,dbuser:,dbpassword:,directory:,host:,help,port:,scheduler-port:,www-root: -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -d|--directory) + installdir=$2; + shift; shift;; + -D|--database) + database=$2; + shift; shift;; + -g|--apache-group) + apache_group=$2; + shift; shift;; + -H|--host) + hostname=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + -p|--port) + http_port=$2; + shift; shift;; + -P|--scheduler-port) + scheduler_port=$2; + shift; shift;; + -r|--www-root) + www_root=$2; + shift; shift;; + -s|--dbserver) + dbserver=$2; + shift; shift;; + -u|--dbuser) + dbuser=$2; + shift; shift;; + -w|--dbpassword) + dbpassword=$2; + shift; shift;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$installdir" == "x" ]; then + echo "Required parameter install directory not specified."; + printUsage; + exit 1; +fi + +if [ "x$hostname" == "x" ]; then + hostname=`hostname -f`; +fi + +if [ "x$http_port" == "x" ]; then + http_port=80; +fi + +if [ "x$scheduler_port" == "x" ]; then + scheduler_port=3344; +fi + +if [ "x$dbserver" == "x" ]; then + dbserver=localhost; +fi + +if [ "x$database" == "x" ]; then + database=LiveSupport; +fi + +if [ "x$dbuser" == "x" ]; then + dbuser=livesupport; +fi + +if [ "x$dbpassword" == "x" ]; then + dbpassword=livesupport; +fi + +if [ "x$apache_group" == "x" ]; then + apache_group=apache; +fi + +if [ "x$www_root" == "x" ]; then + www_root=/var/www +fi + + +echo "Making post-install steps for the LiveSupport scheduler."; +echo ""; +echo "Using the following installation parameters:"; +echo ""; +echo " installation directory: $installdir"; +echo " host name: $hostname"; +echo " web server port: $http_port"; +echo " scheduler port: $scheduler_port"; +echo " database server: $dbserver"; +echo " database: $database"; +echo " database user: $dbuser"; +echo " database user password: $dbpassword"; +echo " apache daemon group: $apache_group"; +echo " apache document root: $www_root"; +echo "" + +#------------------------------------------------------------------------------- +# The details of installation +#------------------------------------------------------------------------------- +ls_php_host=$hostname +ls_php_port=$http_port +ls_php_urlPrefix=livesupport + +ls_alib_xmlRpcPrefix="xmlrpc/xrLocStor.php" +ls_storage_xmlRpcPrefix="xmlrpc/xrLocStor.php" + +ls_dbserver=$dbserver +ls_dbuser=$dbuser +ls_dbpassword=$dbpassword +ls_database=$database + +ls_scheduler_host=$hostname +ls_scheduler_port=$scheduler_port +ls_scheduler_urlPrefix= +ls_scheduler_xmlRpcPrefix=RC2 + + +postgres_user=postgres + +install_bin=$installdir/bin +install_etc=$installdir/etc +install_lib=$installdir/lib +install_tmp=$installdir/tmp +install_var=$installdir/var + + +# replace / characters with a \/ sequence, for sed below +# the sed statement is really "s/\//\\\\\//g", but needs escaping because of +# bash, hence the extra '\' characters +installdir_s=`echo $installdir | sed -e "s/\//\\\\\\\\\//g"` +ls_storage_xmlRpcPrefix_s=`echo $ls_storage_xmlRpcPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` +ls_alib_xmlRpcPrefix_s=`echo $ls_alib_xmlRpcPrefix | sed -e "s/\//\\\\\\\\\//g"` +ls_php_urlPrefix_s=`echo $ls_php_urlPrefix | sed -e "s/\//\\\\\\\\\//g"` +ls_scheduler_urlPrefix_s=`echo $ls_scheduler_urlPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` +ls_scheduler_xmlRpcPrefix_s=`echo $ls_scheduler_xmlRpcPrefix | \ + sed -e "s/\//\\\\\\\\\//g"` + +replace_sed_string="s/ls_install_dir/$installdir_s/; \ + s/ls_dbuser/$ls_dbuser/; \ + s/ls_dbpassword/$ls_dbpassword/; \ + s/ls_dbserver/$ls_dbserver/; \ + s/ls_database/$ls_database/; \ + s/ls_storageUrlPath/\/$ls_php_urlPrefix_s\/storageServer\/var/; \ + s/ls_php_urlPrefix/$ls_php_urlPrefix_s/; \ + s/ls_storage_xmlRpcPrefix/$ls_storage_xmlRpcPrefix_s/; \ + s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \ + s/ls_php_host/$ls_php_host/; \ + s/ls_php_port/$ls_php_port/; \ + s/ls_archiveUrlPath/\/$ls_php_urlPrefix_s\/archiveServer\/var/; \ + s/ls_scheduler_urlPrefix/$ls_scheduler_urlPrefix_s/; \ + s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/; \ + s/ls_scheduler_host/$ls_scheduler_host/; \ + s/ls_scheduler_port/$ls_scheduler_port/;" + + + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Check to see if this script is being run as root +#------------------------------------------------------------------------------- +if [ `whoami` != "root" ]; then + echo "Please run this script as root."; + exit ; +fi + + +#------------------------------------------------------------------------------- +# Check for required tools +#------------------------------------------------------------------------------- +echo "Checking for required tools..." + +check_exe "sed" || exit 1; +check_exe "psql" || exit 1; +check_exe "php" || exit 1; +check_exe "pear" || exit 1; +check_exe "odbcinst" || exit 1; + + +#------------------------------------------------------------------------------- +# Check for the apache group to be a real group +#------------------------------------------------------------------------------- +group_tmp_file=/tmp/ls_group_check.$$ +touch $group_tmp_file +test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null` +if [ $? != 0 ]; then + rm -f $group_tmp_file; + echo "Unable to use apache deamon group $apache_group."; + echo "Please check if $apache_group is a correct user group."; + exit 1; +fi +rm -f $group_tmp_file; + + +#------------------------------------------------------------------------------- +# Create the necessary database user and database itself +#------------------------------------------------------------------------------- +echo "Creating database and database user..."; + +# FIXME: the below might not work for remote databases + +if [ "x$ls_dbserver" == "xlocalhost" ]; then + su - $postgres_user -c "echo \"CREATE USER $ls_dbuser \ + ENCRYPTED PASSWORD '$ls_dbpassword' \ + CREATEDB NOCREATEUSER;\" \ + | psql template1" \ + || echo "Couldn't create database user $ls_dbuser."; + + su - $postgres_user -c "echo \"CREATE DATABASE \\\"$ls_database\\\" \ + OWNER $ls_dbuser ENCODING 'utf-8';\" \ + | psql template1" \ + || echo "Couldn't create database $ls_database."; +else + echo "Unable to automatically create database user and table for"; + echo "remote database $ls_dbserver."; + echo "Make sure to create database user $ls_dbuser with password"; + echo "$ls_dbpassword on database server at $ls_dbserver."; + echo "Also create a database called $ld_database, owned by this user."; + echo ""; + echo "The easiest way to achieve this is by issuing the following SQL"; + echo "commands to PostgreSQL:"; + echo "CREATE USER $ls_dbuser"; + echo " ENCRYPTED PASSWORD '$ls_dbpassword'"; + echo " CREATEDB NOCREATEUSER;"; + echo "CREATE DATABASE \"$ls_database\""; + echo " OWNER $ls_dbuser ENCODING 'utf-8';"; +fi + + +# TODO: check for the success of these operations somehow + + +#------------------------------------------------------------------------------- +# Create the ODBC data source and driver +#------------------------------------------------------------------------------- +echo "Creating ODBC data source and driver..."; + +odbcinst_template=$install_etc/odbcinst_template +odbc_template=$install_etc/odbc_template +odbc_template_tmp=/tmp/odbc_template.$$ + +# check for an existing PostgreSQL ODBC driver, and only install if necessary +odbcinst_res=`odbcinst -q -d | grep "\[PostgreSQL\]"` +if [ "x$odbcinst_res" == "x" ]; then + echo "Registering ODBC PostgreSQL driver..."; + odbcinst -i -d -v -f $odbcinst_template || exit 1; +fi + +echo "Registering LiveSupport ODBC data source..."; +cat $odbc_template | sed -e "$replace_sed_string" > $odbc_template_tmp +odbcinst -i -s -l -f $odbc_template_tmp || exit 1; +rm -f $odbc_template_tmp + + +#------------------------------------------------------------------------------- +# Customize the configuration files with the appropriate values +#------------------------------------------------------------------------------- +echo "Customizing configuration files..." + +cat $install_var/storageServer/var/conf.php.template \ + | sed -e "$replace_sed_string" \ + > $install_var/storageServer/var/conf.php + +cat $install_var/archiveServer/var/conf.php.template \ + | sed -e "$replace_sed_string" \ + > $install_var/archiveServer/var/conf.php + +cat $install_etc/scheduler.xml.template \ + | sed -e "$replace_sed_string" \ + > $install_etc/scheduler.xml + + +#------------------------------------------------------------------------------- +# Setup directory permissions +#------------------------------------------------------------------------------- +echo "Setting up directory permissions..." + +chgrp $apache_group $install_var/archiveServer/var/stor +chgrp $apache_group $install_var/archiveServer/var/access +chgrp $apache_group $install_var/archiveServer/var/trans +chgrp $apache_group $install_var/archiveServer/var/stor/buffer + +chmod g+sw $install_var/archiveServer/var/stor +chmod g+sw $install_var/archiveServer/var/access +chmod g+sw $install_var/archiveServer/var/trans +chmod g+sw $install_var/archiveServer/var/stor/buffer + +chgrp $apache_group $install_var/storageServer/var/stor +chgrp $apache_group $install_var/storageServer/var/access +chgrp $apache_group $install_var/storageServer/var/trans +chgrp $apache_group $install_var/storageServer/var/stor/buffer + +chmod g+sw $install_var/storageServer/var/stor +chmod g+sw $install_var/storageServer/var/access +chmod g+sw $install_var/storageServer/var/trans +chmod g+sw $install_var/storageServer/var/stor/buffer + +chgrp $apache_group $install_var/htmlUI/var/templates_c +chgrp $apache_group $install_var/htmlUI/var/html/img + +chmod g+sw $install_var/htmlUI/var/templates_c +chmod g+sw $install_var/htmlUI/var/html/img + + +#------------------------------------------------------------------------------- +# Create symlinks +#------------------------------------------------------------------------------- +echo "Creating symlinks..."; + +# create symlink for the PHP pages in apache's document root +rm -f $www_root/livesupport +ln -s $install_var $www_root/livesupport + + +#------------------------------------------------------------------------------- +# Initialize the database +#------------------------------------------------------------------------------- +echo "Initializing database..."; + +# create PHP-related database tables +cd $install_var/storageServer/var/install +php -q install.php || exit 1; +cd - + +# create scheduler-related database tables +cd $installdir +$bindir/scheduler.sh install || exit 1; +cd - + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo "Done." + diff --git a/livesupport/bin/postUninstall.sh b/livesupport/bin/postUninstall.sh new file mode 100755 index 000000000..c823d3f14 --- /dev/null +++ b/livesupport/bin/postUninstall.sh @@ -0,0 +1,264 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/postUninstall.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script makes post-uninstallation steps for LiveSupport. +# +# Invoke as: +# ./bin/postUninstall.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport post-uninstall script."; + echo "parameters"; + echo ""; + echo " -d, --directory The installation directory, required."; + echo " -D, --database The name of the LiveSupport database."; + echo " [default: LiveSupport]"; + echo " -r, --www-root The root directory for web documents served"; + echo " by apache [default: /var/www]"; + echo " -s, --dbserver The name of the database server host."; + echo " [default: localhost]"; + echo " -u, --dbuser The name of the database user to access the" + echo " database. [default: livesupport]"; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o d:D:hr:s:u: -l database:,dbserver:,dbuser:,directory:,help,www-root: -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -d|--directory) + installdir=$2; + shift; shift;; + -D|--database) + database=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + -r|--www-root) + www_root=$2; + shift; shift;; + -s|--dbserver) + dbserver=$2; + shift; shift;; + -u|--dbuser) + dbuser=$2; + shift; shift;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$installdir" == "x" ]; then + echo "Required parameter install directory not specified."; + printUsage; + exit 1; +fi + +if [ "x$dbserver" == "x" ]; then + dbserver=localhost; +fi + +if [ "x$database" == "x" ]; then + database=LiveSupport; +fi + +if [ "x$dbuser" == "x" ]; then + dbuser=livesupport; +fi + +if [ "x$www_root" == "x" ]; then + www_root=/var/www +fi + + +echo "Making post-uninstall steps for LiveSupport."; +echo ""; +echo "Using the following installation parameters:"; +echo ""; +echo " installation directory: $installdir"; +echo " database server: $dbserver"; +echo " database: $database"; +echo " database user: $dbuser"; +echo " apache document root: $www_root"; +echo "" + +#------------------------------------------------------------------------------- +# The details of installation +#------------------------------------------------------------------------------- +ls_dbserver=$dbserver +ls_dbuser=$dbuser +ls_database=$database + + +postgres_user=postgres + +install_bin=$installdir/bin +install_etc=$installdir/etc +install_lib=$installdir/lib +install_tmp=$installdir/tmp +install_var=$installdir/var + + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Check to see if this script is being run as root +#------------------------------------------------------------------------------- +if [ `whoami` != "root" ]; then + echo "Please run this script as root."; + exit ; +fi + + +#------------------------------------------------------------------------------- +# Check for required tools +#------------------------------------------------------------------------------- +echo "Checking for required tools..." + +check_exe "psql" || exit 1; +check_exe "odbcinst" || exit 1; + + +#------------------------------------------------------------------------------- +# Remove symlinks +#------------------------------------------------------------------------------- +echo "Removing symlinks..."; + +# remove symlink for the PHP pages in apache's document root +rm -f $www_root/livesupport + + +#------------------------------------------------------------------------------- +# Delete data files +#------------------------------------------------------------------------------- +echo "Deleting data files..."; + +rm -rf $installdir/var/htmlUI/var/html/img/* +rm -rf $installdir/var/htmlUI/var/templates_c/* +rm -rf $installdir/var/storageServer/var/stor/* +rm -rf $installdir/var/storageServer/var/access/* +rm -rf $installdir/var/storageServer/var/trans/* +rm -rf $installdir/var/archiveServer/var/stor/* +rm -rf $installdir/var/archiveServer/var/access/* +rm -rf $installdir/var/archiveServer/var/trans/* + + +#------------------------------------------------------------------------------- +# Remove the ODBC data source and driver +#------------------------------------------------------------------------------- +echo "Removing ODBC data source and driver..."; + +echo "Removing LiveSupport ODBC data source..."; +odbcinst -u -s -l -n $ls_database || exit 1; + +echo "De-registering ODBC PostgreSQL driver..."; +odbcinst -u -d -v -n PostgreSQL || exit 1; + + +#------------------------------------------------------------------------------- +# Remove the database user and the database itself +#------------------------------------------------------------------------------- +echo "Removing database and database user..."; + +if [ "x$ls_dbserver" == "xlocalhost" ]; then + su - $postgres_user -c "echo \"DROP DATABASE \\\"$ls_database\\\" \"\ + | psql template1" \ + || echo "Couldn't drop database $ls_database."; + + su - $postgres_user -c "echo \"DROP USER $ls_dbuser \"\ + | psql template1" \ + || echo "Couldn't drop database user $ls_dbuser."; + +else + echo "Unable to automatically drop database user and table for"; + echo "remote database $ls_dbserver."; + echo "Make sure to drop database user $ls_dbuser on database server"; + echo "at $ls_dbserver."; + echo "Also drop the database called $ld_database, owned by this user."; + echo ""; + echo "The easiest way to achieve this is by issuing the following SQL"; + echo "commands to PostgreSQL:"; + echo "DROP DATABASE \"$ls_database\";"; + echo "DROP USER $ls_dbuser;"; +fi + + +# TODO: check for the success of these operations somehow + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo "Done." + diff --git a/livesupport/bin/preInstall.sh b/livesupport/bin/preInstall.sh new file mode 100755 index 000000000..adb5a1647 --- /dev/null +++ b/livesupport/bin/preInstall.sh @@ -0,0 +1,184 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/preInstall.sh,v $ +#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# This script makes pre-install steps and checks for LiveSupport. +# +# Invoke as: +# ./bin/preInstall.sh +# +# To get usage help, try the -h option +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +docdir=$basedir/doc +tmpdir=$basedir/tmp +toolsdir=$basedir/tools +modules_dir=$basedir/modules +products_dir=$basedir/products + +usrdir=`cd $basedir/usr; pwd;` + + +#------------------------------------------------------------------------------- +# Print the usage information for this script. +#------------------------------------------------------------------------------- +printUsage() +{ + echo "LiveSupport pre-install script."; + echo "parameters"; + echo ""; + echo " -g, --apache-group The group the apache daemon runs as."; + echo " [default: apache]"; + echo " -h, --help Print this message and exit."; + echo ""; +} + + +#------------------------------------------------------------------------------- +# Process command line parameters +#------------------------------------------------------------------------------- +CMD=${0##*/} + +opts=$(getopt -o g:h -l apache-group:,help -n $CMD -- "$@") || exit 1 +eval set -- "$opts" +while true; do + case "$1" in + -g|--apache-group) + apache_group=$2; + shift; shift;; + -h|--help) + printUsage; + exit 0;; + --) + shift; + break;; + *) + echo "Unrecognized option $1."; + printUsage; + exit 1; + esac +done + +if [ "x$apache_group" == "x" ]; then + apache_group=apache; +fi + + +echo "Making pre-install steps for LiveSupport."; +echo ""; +echo "Using the following installation parameters:"; +echo ""; +echo " apache daemon group: $apache_group"; +echo "" + + +#------------------------------------------------------------------------------- +# Check for the apache group to be a real group +#------------------------------------------------------------------------------- +group_tmp_file=/tmp/ls_group_check.$$ +touch $group_tmp_file +test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null` +if [ $? != 0 ]; then + rm -f $group_tmp_file; + echo "Unable to use apache deamon group $apache_group."; + echo "Please check if $apache_group is a correct user group."; + exit 1; +fi +rm -f $group_tmp_file; + + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Function to check for a PEAR module +# +# @param $1 the name of the PEAR module +# @return 0 if the module is available, non-0 otherwise +#------------------------------------------------------------------------------- +check_pear_module() { + test_result=`pear info $1` + if [ $? = 0 ]; then + echo "PEAR module $1 found..."; + return 0; + else + echo "PEAR module $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Check for required tools +#------------------------------------------------------------------------------- +echo "Checking for required tools..." + +check_exe "sed" || exit 1; +check_exe "psql" || exit 1; +check_exe "php" || exit 1; +check_exe "pear" || exit 1; +check_exe "odbcinst" || exit 1; + +check_pear_module "DB" || exit 1; +check_pear_module "Calendar" || exit 1; +check_pear_module "File" || exit 1; +check_pear_module "File_Find" || exit 1; +check_pear_module "HTML_Common" || exit 1; +check_pear_module "HTML_QuickForm" || exit 1; +check_pear_module "XML_Beautifier" || exit 1; +check_pear_module "XML_Parser" || exit 1; +check_pear_module "XML_RPC" || exit 1; +check_pear_module "XML_Serializer" || exit 1; +check_pear_module "XML_Util" || exit 1; + + +#------------------------------------------------------------------------------- +# Say goodbye +#------------------------------------------------------------------------------- +echo "Done." + diff --git a/livesupport/Makefile b/livesupport/etc/Makefile.in similarity index 87% rename from livesupport/Makefile rename to livesupport/etc/Makefile.in index f915120f3..6f782c3f1 100644 --- a/livesupport/Makefile +++ b/livesupport/etc/Makefile.in @@ -21,8 +21,8 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.29 $ -# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/Attic/Makefile,v $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/etc/Makefile.in,v $ #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- @@ -42,10 +42,12 @@ FLAWFINDER = flawfinder # Basic directory and file definitions #------------------------------------------------------------------------------- BASE_DIR = . +BIN_DIR = ${BASE_DIR}/bin DOC_DIR = ${BASE_DIR}/doc DOXYGEN_DIR = ${DOC_DIR}/doxygen COVERAGE_DIR = ${DOC_DIR}/coverage ETC_DIR = ${BASE_DIR}/etc +TMP_DIR = ${BASE_DIR}/tmp DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config XMLRPC-DOXYGEN_CONFIG = ${ETC_DIR}/xmlrpc-doxygen.config @@ -155,12 +157,16 @@ flawfinder: clean: ${RMDIR} ${DOXYGEN_DIR}/html ${RMDIR} ${COVERAGE_DIR}/* + ${RM} ${TMP_DIR}/*.stamp -setup: tools_setup doxytag_setup modules_setup products_setup +setup: ${TMP_DIR}/setup.stamp +${TMP_DIR}/setup.stamp: tools_setup doxytag_setup modules_setup products_setup + touch ${TMP_DIR}/setup.stamp recompile: distclean modules_setup products_setup compile -tools_setup: +tools_setup: ${TMP_DIR}/tools_setup.stamp +${TMP_DIR}/tools_setup.stamp: ${BOOST_DIR}/${BOOST_VERSION}/bin/install.sh ${CXXUNIT_DIR}/${CXXUNIT_VERSION}/bin/install.sh ${LIBODBCXX_DIR}/${LIBODBCXX_VERSION}/bin/install.sh @@ -173,11 +179,15 @@ tools_setup: ${ICU_DIR}/${ICU_VERSION}/bin/install.sh ${CURL_DIR}/${CURL_VERSION}/bin/install.sh ${TAGLIB_DIR}/${TAGLIB_VERSION}/bin/install.sh + touch ${TMP_DIR}/tools_setup.stamp -doxytag_setup: +doxytag_setup: ${TMP_DIR}/doxytag_setup.stamp +${TMP_DIR}/doxytag_setup.stamp: ${DOXYTAG} -t ${TAGFILE} ${EXTERNAL_DOC_PAGES} + touch ${TMP_DIR}/doxytag_setup.stamp -modules_setup: +modules_setup: ${TMP_DIR}/modules_setup.stamp +${TMP_DIR}/modules_setup.stamp: ${CORE_DIR}/bin/autogen.sh ${AUTHENTICATION_DIR}/bin/autogen.sh ${DB_DIR}/bin/autogen.sh @@ -188,10 +198,13 @@ modules_setup: ${WIDGETS_DIR}/bin/autogen.sh # -${MAKE} -C ${STORAGE_SERVER_DIR} dir_setup -${MAKE} -C ${STORAGE_SERVER_DIR} all + touch ${TMP_DIR}/modules_setup.stamp -products_setup: +products_setup: ${TMP_DIR}/products_setup.stamp +${TMP_DIR}/products_setup.stamp: ${SCHEDULER_DIR}/bin/autogen.sh ${GLIVESUPPORT_DIR}/bin/autogen.sh + touch ${TMP_DIR}/products_setup.stamp distclean: ${MAKE} -C ${CORE_DIR} distclean @@ -218,7 +231,8 @@ depclean: ${MAKE} -C ${GLIVESUPPORT_DIR} depclean -${MAKE} -C ${STORAGE_SERVER_DIR} depclean -compile: +compile: ${TMP_DIR}/compile.stamp +${TMP_DIR}/compile.stamp: ${MAKE} -C ${CORE_DIR} all ${MAKE} -C ${AUTHENTICATION_DIR} all ${MAKE} -C ${DB_DIR} all @@ -229,6 +243,7 @@ compile: ${MAKE} -C ${WIDGETS_DIR} all ${MAKE} -C ${SCHEDULER_DIR} all ${MAKE} -C ${GLIVESUPPORT_DIR} all + touch ${TMP_DIR}/compile.stamp check: -${MAKE} -C ${CORE_DIR} check @@ -243,3 +258,20 @@ check: # -${MAKE} -C ${GLIVESUPPORT_DIR} check # -${MAKE} -C ${STORAGE_SERVER_DIR} check + +#------------------------------------------------------------------------------- +# Installation related targets +#------------------------------------------------------------------------------- +.PHONY: install + +INSTALL_COPY_EXE = ${BIN_DIR}/copyInstall.sh +ifeq (${prefix},) + INSTALL_PREFIX = @prefix@ +else + INSTALL_PREFIX = ${prefix} +endif +APACHE_GROUP = @apache_group@ + +install: setup compile + ${INSTALL_COPY_EXE} --directory ${INSTALL_PREFIX} + diff --git a/livesupport/etc/configure.ac b/livesupport/etc/configure.ac new file mode 100644 index 000000000..757fbbbaa --- /dev/null +++ b/livesupport/etc/configure.ac @@ -0,0 +1,55 @@ +dnl----------------------------------------------------------------------------- +dnl Copyright (c) 2004 Media Development Loan Fund +dnl +dnl This file is part of the LiveSupport project. +dnl http://livesupport.campware.org/ +dnl To report bugs, send an e-mail to bugs@campware.org +dnl +dnl LiveSupport is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl LiveSupport is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with LiveSupport; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl +dnl Author : $Author: maroy $ +dnl Version : $Revision: 1.1 $ +dnl Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/etc/configure.ac,v $ +dnl----------------------------------------------------------------------------- + +dnl----------------------------------------------------------------------------- +dnl NOTE: Run all configure related scripts from the tmp directory of the +dnl project. +dnl This is due to the fact that configure spreads a lot of trash around, +dnl like atom4te cache directories, config.* files, etc. into the directory +dnl it is being run from. We clearly don't want these in our base directory. +dnl----------------------------------------------------------------------------- +AC_INIT(LiveSupport, 0.9, bugs@campware.org) +AC_PREREQ(2.59) +AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL]) +AC_REVISION($Revision: 1.1 $) + +AC_CONFIG_SRCDIR(../products/scheduler/src/main.cxx) + +AC_PROG_CXX() + +AC_ARG_WITH([apache-group], +[ --with-apache-group specify the system group the apache daemon runs as + defaults to: [apache]], + CONFIG_APACHE_GROUP=${withval}, CONFIG_APACHE_GROUP="apache") + +apache_group=${CONFIG_APACHE_GROUP} +AC_MSG_RESULT([using apache daemon group: ${apache_group}]) +AC_SUBST(apache_group) + +AC_CONFIG_FILES(../Makefile:../etc/Makefile.in) + +AC_OUTPUT() diff --git a/livesupport/etc/debian/README.Debian b/livesupport/etc/debian/README.Debian new file mode 100644 index 000000000..63be9608b --- /dev/null +++ b/livesupport/etc/debian/README.Debian @@ -0,0 +1,6 @@ +livesupport for Debian +---------------------- + +First debian package of LiveSupport. + + -- Akos Maroy , Tue, 19 Apr 2005 07:40:13 -0400 diff --git a/livesupport/etc/debian/changelog b/livesupport/etc/debian/changelog new file mode 100644 index 000000000..68cef68ab --- /dev/null +++ b/livesupport/etc/debian/changelog @@ -0,0 +1,6 @@ +livesupport (0.9.1-1) unstable; urgency=low + + * Initial Release. + + -- Akos Maroy Tue, 19 Apr 2005 07:40:13 -0400 + diff --git a/livesupport/etc/debian/compat b/livesupport/etc/debian/compat new file mode 100644 index 000000000..b8626c4cf --- /dev/null +++ b/livesupport/etc/debian/compat @@ -0,0 +1 @@ +4 diff --git a/livesupport/etc/debian/control b/livesupport/etc/debian/control new file mode 100644 index 000000000..78823b1e7 --- /dev/null +++ b/livesupport/etc/debian/control @@ -0,0 +1,66 @@ +Source: livesupport +Section: unknown +Priority: optional +Maintainer: Akos Maroy +Build-Depends: debhelper (>= 4.0.0), + binutils (>= 2.13), + gcc (>= 3.3), + g++ (>= 3.3), + make (>= 3.80). + automake1.7, + autoconf (>= 2.59), + libtool, + pkgconfig (>= 0.15), + patch (>= 2.5.9), + doxygen, + tar, + gzip, + bzip2, + curl, + unixodbc-dev (>= 2.2), + x-window-system-dev, + libfontconfig1-dev, + libpng12-dev, + libjpeg62-dev, + libssl-dev, + libxml2-dev +Standards-Version: 3.6.1 + +Package: livesupport-libs +Architecture: any +Depends: ${shlibs:Depends}, + unixodbc (>= 2.2), + x-window-system, + libfontconfig1, + libpng12-0, + libjpeg62, + libssl0.9.7, + libxml2 +Description: A radio program automation and support tool. + This package contains the libraries used by LiveSupport. + +Package: livesupport-station +Architecture: any +Depends: ${shlibs:Depends}, + livesupport-libs (${dpkg:Version}), + sed, + odbc-postgresql, + apache | apache2, + php4, + php4-domxml, + php4-pear, + php4-pgsql, + libapache-mod-php4 | libapache2-mod-php4, + postgresql (>= 7.4), + postgresql-client (>=7.4) +Description: A radio program automation and support tool. + This package contains the server components of LiveSupport. + This includes a scheluer deamon, and web-based server components. + +Package: livesupport-studio +Architecture: any +Depends: ${shlibs:Depends}, + livesupport-libs (${dpkg:Version}), + sed +Description: A radio program automation and support tool. + This package contains the GUI client components of LiveSupport. diff --git a/livesupport/etc/debian/copyright b/livesupport/etc/debian/copyright new file mode 100644 index 000000000..773c0e129 --- /dev/null +++ b/livesupport/etc/debian/copyright @@ -0,0 +1,25 @@ +This package was debianized by Akos Maroy on +Tue, 19 Apr 2005 07:40:13 -0400. + +It was downloaded from http://livesupport.campware.org/ + +Copyright: + +Upstream Author(s): Media Developmnet Loan Fund, http://www.mdlf.org/ + +License: + + LiveSupport 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. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + diff --git a/livesupport/etc/debian/dirs b/livesupport/etc/debian/dirs new file mode 100644 index 000000000..b67467194 --- /dev/null +++ b/livesupport/etc/debian/dirs @@ -0,0 +1 @@ +opt/livesupport diff --git a/livesupport/etc/debian/livesupport-station.conffiles b/livesupport/etc/debian/livesupport-station.conffiles new file mode 100644 index 000000000..6c2ce9a54 --- /dev/null +++ b/livesupport/etc/debian/livesupport-station.conffiles @@ -0,0 +1,3 @@ +/opt/livesupport/var/storageServer/var/conf.php +/opt/livesupport/var/archiveServer/var/conf.php +/opt/livesupport/etc/scheduler.xml diff --git a/livesupport/etc/debian/livesupport-station.init.d b/livesupport/etc/debian/livesupport-station.init.d new file mode 100644 index 000000000..b9eae72c0 --- /dev/null +++ b/livesupport/etc/debian/livesupport-station.init.d @@ -0,0 +1,51 @@ +#!/bin/sh +# +# + +LIVESUPPORT_DIR=/opt/livesupport +LIVESUPPORT_BIN=$LIVESUPPORT_DIR/bin +LIVESUPPORT_ETC=$LIVESUPPORT_DIR/etc +LIVESUPPORT_LIB=$LIVESUPPORT_DIR/lib + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:$LIVESUPPORT_BIN +LD_LIBRARY_PATH=$LIVESUPPORT_LIB:$LD_LIBRARY_PATH +DAEMON=$LIVESUPPORT_BIN/scheduler +NAME=livesupport-scheduler +DESC="livesupport scheduler" + +test -x $DAEMON || exit 0 + +export PATH +export LD_LIBRARY_PATH + +DAEMON_OPTS="-c $LIVESUPPORT_ETC/scheduler.xml" + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + $DAEMON -c $LIVESUPPORT_ETC/scheduler.xml start > /dev/null + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + $DAEMON -c $LIVESUPPORT_ETC/scheduler.xml stop > /dev/null + echo "$NAME." + ;; + restart|force-reload) + echo -n "Restarting $DESC: " + $DAEMON -c $LIVESUPPORT_ETC/scheduler.xml stop > /dev/null + sleep 1 + $DAEMON -c $LIVESUPPORT_ETC/scheduler.xml start > /dev/null + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload|kill}" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/livesupport/etc/debian/livesupport-station.postinst b/livesupport/etc/debian/livesupport-station.postinst new file mode 100644 index 000000000..7b167e090 --- /dev/null +++ b/livesupport/etc/debian/livesupport-station.postinst @@ -0,0 +1,59 @@ +#! /bin/sh +# postinst script for livesupport +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +installdir=/opt/livesupport +apache_group=www-data +apache_docroot=/var/www + +case "$1" in + configure) + # replace the odbcinst.ini template with the debian-specific version + cp -f $installdir/etc/odbcinst_debian_template \ + $installdir/etc/odbcinst_template + # do post-installation configuration + $installdir/bin/postInstallScheduler.sh --directory $installdir \ + --apache-group $apache_group \ + --www-root $apache_docroot + # register and start the livesupport scheduler deamon + update-rc.d livesupport-station defaults 40 + if command -v invoke-rc.d >/dev/null 2>&1 ; then + invoke-rc.d livesupport-station start + else + /etc/init.d/livesupport-station start + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/livesupport/etc/debian/livesupport-station.postrm b/livesupport/etc/debian/livesupport-station.postrm new file mode 100644 index 000000000..73c530ed1 --- /dev/null +++ b/livesupport/etc/debian/livesupport-station.postrm @@ -0,0 +1,129 @@ +#! /bin/sh +# postrm script for livesupport +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +installdir=/opt/livesupport +apache_docroot=/var/www + +postgres_user=postgres + +ls_dbserver=localhost +ls_database=LiveSupport +ls_dbuser=livesupport + + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +case "$1" in + remove|upgrade|failed-upgrade|abort-install|abort-upgrade) + # remove the init script by hand + # this is an ugly hack, dpkg should remove it! + rm -f /etc/init.d/livesupport-station + + # remove the livesupport scheduler daemon as a service + update-rc.d livesupport-station remove + + # remove the symlink to the livesupport web pages + rm -f $apache_docroot/livesupport + + ;; + + purge|disappear) + echo "Checking for required tools..." + + check_exe "psql" || exit 1; + check_exe "odbcinst" || exit 1; + + + echo "Deleting data files..."; + + rm -rf $installdir/etc/scheduler.xml + rm -rf $installdir/var/htmlUI/var/html/img/* + rm -rf $installdir/var/htmlUI/var/templates_c/* + rm -rf $installdir/var/storageServer/var/stor/* + rm -rf $installdir/var/storageServer/var/access/* + rm -rf $installdir/var/storageServer/var/trans/* + rm -rf $installdir/var/archiveServer/var/stor/* + rm -rf $installdir/var/archiveServer/var/access/* + rm -rf $installdir/var/archiveServer/var/trans/* + + + echo "Removing ODBC data source and driver..."; + + echo "Removing LiveSupport ODBC data source..."; + odbcinst -u -s -l -n $ls_database || exit 1; + + echo "De-registering ODBC PostgreSQL driver..."; + odbcinst -u -d -v -n PostgreSQL || exit 1; + + + echo "Removing database and database user..."; + + if [ "x$ls_dbserver" == "xlocalhost" ]; then + su - $postgres_user -c \ + "echo \"DROP DATABASE \\\"$ls_database\\\" \"\ + | psql template1" \ + || echo "Couldn't drop database $ls_database."; + + su - $postgres_user -c "echo \"DROP USER $ls_dbuser \"\ + | psql template1" \ + || echo "Couldn't drop database user $ls_dbuser."; + + else + echo "Unable to automatically drop database user and table for"; + echo "remote database $ls_dbserver."; + echo "Make sure to drop database user $ls_dbuser on database"; + echo "server at $ls_dbserver."; + echo "Also drop the database called $ld_database."; + echo ""; + echo "The easiest way to achieve this is by issuing the"; + echo "following SQL commands to PostgreSQL:"; + echo "DROP DATABASE \"$ls_database\";"; + echo "DROP USER $ls_dbuser;"; + fi + + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/livesupport/etc/debian/livesupport-station.preinst b/livesupport/etc/debian/livesupport-station.preinst new file mode 100644 index 000000000..895a3b571 --- /dev/null +++ b/livesupport/etc/debian/livesupport-station.preinst @@ -0,0 +1,133 @@ +#! /bin/sh +# preinst script for livesupport +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +#------------------------------------------------------------------------------- +# Function to check for a group to be available, and the ability +# to set files to belong into that group +# +# @param $1 the group to check +# @return 0 if the groups id OK, non-0 otherwise +#------------------------------------------------------------------------------- +check_group_permission() { + group_tmp_file=/tmp/ls_group_check.$$ + touch $group_tmp_file + test_result=`chgrp $1 $group_tmp_file 2> /dev/null` + if [ $? != 0 ]; then + rm -f $group_tmp_file; + echo "Unable to use apache deamon group $1."; + echo "Please check if $1 is a correct user group."; + return 1; + fi + rm -f $group_tmp_file; + echo "Apache daemon group $1 OK."; + + return 0; +} + +#------------------------------------------------------------------------------- +# Function to check for the existence of an executable on the PATH +# +# @param $1 the name of the exectuable +# @return 0 if the executable exists on the PATH, non-0 otherwise +#------------------------------------------------------------------------------- +check_exe() { + if [ -x "`which $1 2> /dev/null`" ]; then + echo "Exectuable $1 found..."; + return 0; + else + echo "Exectuable $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Function to check for a PEAR module +# +# @param $1 the name of the PEAR module +# @return 0 if the module is available, non-0 otherwise +#------------------------------------------------------------------------------- +check_pear_module() { + test_result=`pear info $1` + if [ $? = 0 ]; then + echo "PEAR module $1 found..."; + return 0; + else + echo "PEAR module $1 not found..."; + return 1; + fi +} + + +#------------------------------------------------------------------------------- +# Variables +#------------------------------------------------------------------------------- +apache_group=www-data + + +case "$1" in + install|upgrade) + echo "Checking for required tools..." + + check_exe "sed" || exit 1; + check_exe "psql" || exit 1; + check_exe "php" || exit 1; + check_exe "pear" || exit 1; + check_exe "odbcinst" || exit 1; + + check_pear_module "DB" || exit 1; + check_pear_module "Calendar" || exit 1; + check_pear_module "File" || exit 1; + check_pear_module "File_Find" || exit 1; + check_pear_module "HTML_Common" || exit 1; + check_pear_module "HTML_QuickForm" || exit 1; + check_pear_module "XML_Beautifier" || exit 1; + check_pear_module "XML_Parser" || exit 1; + check_pear_module "XML_RPC" || exit 1; + check_pear_module "XML_Serializer" || exit 1; + check_pear_module "XML_Util" || exit 1; + + echo "Checking for validity of apache daemon group $apache_group..."; + check_group_permission $apache_group || exit 1; + + if [ "$1" = "upgrade" ]; then + if command -v invoke-rc.d >/dev/null 2>&1 ; then + invoke-rc.d livesupport-station stop + invoke-rc.d livesupport-station kill + else + /etc/init.d/livesupport-station stop + /etc/init.d/livesupport-station kill + fi + fi + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/livesupport/etc/debian/livesupport-station.prerm b/livesupport/etc/debian/livesupport-station.prerm new file mode 100644 index 000000000..23e75ec7a --- /dev/null +++ b/livesupport/etc/debian/livesupport-station.prerm @@ -0,0 +1,46 @@ +#! /bin/sh +# prerm script for livesupport +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + # stop and remove the livesupport scheduler daemon + if command -v invoke-rc.d >/dev/null 2>&1 ; then + invoke-rc.d livesupport-station stop + invoke-rc.d livesupport-station kill + else + /etc/init.d/livesupport-station stop + /etc/init.d/livesupport-station kill + fi + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/livesupport/etc/debian/livesupport-studio.conffiles b/livesupport/etc/debian/livesupport-studio.conffiles new file mode 100644 index 000000000..0ba6221d4 --- /dev/null +++ b/livesupport/etc/debian/livesupport-studio.conffiles @@ -0,0 +1 @@ +/opt/livesupport/etc/gLiveSupport.xml diff --git a/livesupport/etc/debian/livesupport-studio.postinst b/livesupport/etc/debian/livesupport-studio.postinst new file mode 100644 index 000000000..ba27878dc --- /dev/null +++ b/livesupport/etc/debian/livesupport-studio.postinst @@ -0,0 +1,47 @@ +#! /bin/sh +# postinst script for livesupport +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +installdir=/opt/livesupport +apache_group=www-data +apache_docroot=/var/www + +case "$1" in + configure) + # do post-installation configuration + $installdir/bin/postInstallGLiveSupport.sh --directory $installdir + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/livesupport/etc/debian/rules b/livesupport/etc/debian/rules new file mode 100755 index 000000000..af39e33df --- /dev/null +++ b/livesupport/etc/debian/rules @@ -0,0 +1,145 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +config.status: configure + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/opt/livesupport --with-apache-group=www-data + + +build: build-arch + +build-arch: build-arch-stamp +build-arch-stamp: config.status + + # Add here commands to compile the arch part of the package. + $(MAKE) setup compile + touch build-arch-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-arch-stamp #CONFIGURE-STAMP# + + # Add here commands to clean up after the build process. + -$(MAKE) distclean clean + + dh_clean + +install: install-arch + +install-arch: + dh_testdir + dh_testroot + dh_clean -k -s + dh_installdirs -s + + # this will install everything into debian/livesupport + $(MAKE) install prefix=$(CURDIR)/debian/livesupport/opt/livesupport + + # copy the template config files into their final places + # so as to please the conffiles file, and the debian packager + # that such a file really exist + cp -f $(CURDIR)/debian/livesupport/opt/livesupport/etc/scheduler.xml.template \ + $(CURDIR)/debian/livesupport/opt/livesupport/etc/scheduler.xml + cp -f $(CURDIR)/debian/livesupport/opt/livesupport/etc/gLiveSupport.xml.template \ + $(CURDIR)/debian/livesupport/opt/livesupport/etc/gLiveSupport.xml + + # now separate the libraries into debian/livesupport-libs + mkdir -p $(CURDIR)/debian/livesupport-libs + mkdir -p $(CURDIR)/debian/livesupport-libs/opt/livesupport + mkdir -p $(CURDIR)/debian/livesupport-libs/opt/livesupport/tmp + mv -f $(CURDIR)/debian/livesupport/opt/livesupport/lib \ + $(CURDIR)/debian/livesupport-libs/opt/livesupport + + # now separate the station (server) files into debian/livesupport-station + mkdir -p $(CURDIR)/debian/livesupport-station + mkdir -p $(CURDIR)/debian/livesupport-station/opt/livesupport + mkdir -p $(CURDIR)/debian/livesupport-station/opt/livesupport/bin + mkdir -p $(CURDIR)/debian/livesupport-station/opt/livesupport/etc + mkdir -p $(CURDIR)/debian/livesupport-station/opt/livesupport/tmp + mv -f $(CURDIR)/debian/livesupport/opt/livesupport/bin/scheduler \ + $(CURDIR)/debian/livesupport/opt/livesupport/bin/scheduler.sh \ + $(CURDIR)/debian/livesupport/opt/livesupport/bin/postInstallScheduler.sh \ + $(CURDIR)/debian/livesupport-station/opt/livesupport/bin + mv -f $(CURDIR)/debian/livesupport/opt/livesupport/etc/scheduler.xml* \ + $(CURDIR)/debian/livesupport/opt/livesupport/etc/odbc* \ + $(CURDIR)/debian/livesupport-station/opt/livesupport/etc + mv -f $(CURDIR)/debian/livesupport/opt/livesupport/var \ + $(CURDIR)/debian/livesupport-station/opt/livesupport + + # now separate the studio (client) files into debian/livesupport-studio + mkdir -p $(CURDIR)/debian/livesupport-studio + mkdir -p $(CURDIR)/debian/livesupport-studio/opt/livesupport + mkdir -p $(CURDIR)/debian/livesupport-studio/opt/livesupport/bin + mkdir -p $(CURDIR)/debian/livesupport-studio/opt/livesupport/etc + mkdir -p $(CURDIR)/debian/livesupport-studio/opt/livesupport/tmp + mv -f $(CURDIR)/debian/livesupport/opt/livesupport/bin/gLiveSupport \ + $(CURDIR)/debian/livesupport/opt/livesupport/bin/gLiveSupport.sh \ + $(CURDIR)/debian/livesupport/opt/livesupport/bin/postInstallGLiveSupport.sh \ + $(CURDIR)/debian/livesupport-studio/opt/livesupport/bin + mv -f $(CURDIR)/debian/livesupport/opt/livesupport/etc/gLiveSupport.xml* \ + $(CURDIR)/debian/livesupport-studio/opt/livesupport/etc + + + dh_install -s + +binary-common: + dh_testdir + dh_testroot +# dh_installchangelogs +# dh_installdocs +# dh_installexamples +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime + dh_installinit +# dh_installcron +# dh_installinfo +# dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +# Build architecture dependant packages using the common target. +binary-arch: build-arch install-arch + $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common + +binary: binary-arch +.PHONY: build clean binary-arch binary install install-arch diff --git a/livesupport/etc/livesupport.dsc.template b/livesupport/etc/livesupport.dsc.template new file mode 100644 index 000000000..3aa32d5e3 --- /dev/null +++ b/livesupport/etc/livesupport.dsc.template @@ -0,0 +1,30 @@ +Format: 1.0 +Source: livesupport +Version: ls_version-ls_debianVersion +Binary: livesupport-libs, libesupport-station, livesupport-studio +Maintainer: ls_maintainer +Architecture: any +Standards-Version: 3.6.1 +Build-Depends: debhelper (>= 4.0.0), + binutils (>= 2.13), + gcc (>= 3.3), + g++ (>= 3.3), + make (>= 3.80). + automake1.7, + autoconf (>= 2.59), + libtool, + pkgconfig (>= 0.15), + patch (>= 2.5.9), + doxygen, + tar, + gzip, + bzip2, + curl, + unixodbc-dev (>= 2.2), + x-window-system-dev, + libfontconfig1-dev, + libpng12-dev, + libjpeg62-dev, + libssl-dev, + libxml2-dev +Files: diff --git a/livesupport/products/gLiveSupport/bin/gLiveSupport.sh b/livesupport/products/gLiveSupport/bin/gLiveSupport.sh new file mode 100755 index 000000000..672b90e42 --- /dev/null +++ b/livesupport/products/gLiveSupport/bin/gLiveSupport.sh @@ -0,0 +1,55 @@ +#!/bin/sh +#------------------------------------------------------------------------------- +# Copyright (c) 2004 Media Development Loan Fund +# +# This file is part of the LiveSupport project. +# http://livesupport.campware.org/ +# To report bugs, send an e-mail to bugs@campware.org +# +# LiveSupport 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. +# +# LiveSupport is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LiveSupport; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# +# Author : $Author: maroy $ +# Version : $Revision: 1.1 $ +# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/bin/gLiveSupport.sh,v $ +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# System V runlevel style invoke script for the LiveSupport Scheduler +# This script is only used in the LiveSupport development environment +#------------------------------------------------------------------------------- + + +#------------------------------------------------------------------------------- +# Determine directories, files +#------------------------------------------------------------------------------- +reldir=`dirname $0`/.. +basedir=`cd $reldir; pwd;` +bindir=$basedir/bin +etcdir=$basedir/etc +libdir=$basedir/lib +tmpdir=$basedir/tmp + + +#------------------------------------------------------------------------------- +# Set up the environment +#------------------------------------------------------------------------------- +export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH +gLiveSupport_exe=$bindir/gLiveSupport +config_file=$etcdir/gLiveSupport.xml + +echo "using configuration file: $config_file"; + +$gLiveSupport_exe -c $config_file diff --git a/livesupport/products/scheduler/etc/odbcinst_debian_template b/livesupport/products/scheduler/etc/odbcinst_debian_template new file mode 100644 index 000000000..fcca8bcdd --- /dev/null +++ b/livesupport/products/scheduler/etc/odbcinst_debian_template @@ -0,0 +1,5 @@ +[PostgreSQL] +Description = PostgreSQL driver +Driver = /usr/lib/odbc/psqlodbc.so +Setup = /usr/lib/odbc/libodbcpsqlS.so +