CC-1024 Update installation/build for webapp-only

CC-1695  	 Remove Campcaster Studio and make install easier

Moved Desktop images to the wiki
Moved everything in /bin to /install
Included ui_browser.php from index.php instead of redirect.
Added Input.php
This commit is contained in:
paul.baranowski 2010-10-01 14:41:08 -04:00
parent 8973b0b8d0
commit dab1af1577
34 changed files with 206 additions and 68 deletions

83
install/autogen.sh Executable file
View file

@ -0,0 +1,83 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Run this to set up the build system: configure, makefiles, etc.
# (based on the version in enlightenment's cvs)
#-------------------------------------------------------------------------------
package="Campcaster"
# 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
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have automake 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
# copy over install-sh, as it's going to be missed by autoconf
cp -f ${bindir}/install-sh ${tmpdir}
cp -f ${configure_ac} ${tmpdir}
echo " aclocal"
aclocal
echo " autoconf -I ${tmpdir} -o ${configure} ${configure_ac}"
autoconf -I ${tmpdir} -o ${configure} ${configure_ac}

253
install/createDebianPackages.sh Executable file
View file

@ -0,0 +1,253 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script creates Debian packages from Campcaster 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 "Campcaster debian source package creation script";
echo "parameters";
echo "";
echo " -d, --directory Place to look for the campcaster 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 " From package_x.y-z_i386.deb, this is x.y";
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 Campcaster.";
echo "";
echo "Using the following parameters:";
echo "";
echo " tarball directory: $directory";
echo " maintainer: $maintainer";
echo " package version: $version";
echo " output directory: $outdir";
echo ""
#-------------------------------------------------------------------------------
# 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 "Executable $1 found...";
return 0;
else
echo "Executable $1 not found...";
return 1;
fi
}
#-------------------------------------------------------------------------------
# Check for executables needed by this script
#-------------------------------------------------------------------------------
echo "Checking for tools used by this script...";
check_exe "tar" || exit 1;
check_exe "dpkg-source" || exit 1;
check_exe "sed" || exit 1;
#-------------------------------------------------------------------------------
# More definitions
#-------------------------------------------------------------------------------
tarball=$directory/campcaster-$version.tar.bz2
tarball_libs=$directory/campcaster-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
packageName=campcaster-$version
packageNameOrig=$packageName.orig
workdir=$tmpdir/debianize
replace_sed_string="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 campcaster-$version.orig
tar xfj $tarball
tar xfj $tarball_libs
mv $packageName $packageNameOrig
# untar again, and leave it as campcaster-$version
tar xfj $tarball
tar xfj $tarball_libs
#-------------------------------------------------------------------------------
# Debianize the campcaster-$version sources
#-------------------------------------------------------------------------------
echo "Debianizing sources...";
cp -pPR $etcdir/debian $packageName
# customize the control file, with the maintainer name
cat $etcdir/debian/control | sed -e "$replace_sed_string" \
> $packageName/debian/control
# get rid of the remnants of the subversion system
rm -rf `find $packageName -name .svn -type d`
#-------------------------------------------------------------------------------
# Create a debianized source package.
#-------------------------------------------------------------------------------
echo "Creating debian source package...";
dpkg-source -b $packageName $packageNameOrig
#-------------------------------------------------------------------------------
# Copy the resulting files to the target directory
#-------------------------------------------------------------------------------
echo "Moving debian source package files to target directory...";
mv -f campcaster_$version* $outdir
#-------------------------------------------------------------------------------
# Clean up
#-------------------------------------------------------------------------------
echo "Cleaning up...";
cd $basedir
rm -rf $workdir
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

211
install/createHubTarball.sh Executable file
View file

@ -0,0 +1,211 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Author : $Author: fgerlits $
# Version : $Revision: 2292 $
#-------------------------------------------------------------------------------
# This script creates a distribution tarball for Campcaster network hub.
# (campcaster-hub-<version>.tar.bz2)
#
# Invoke as:
# ./bin/createHubTarball.sh -v <version.number>
#
# To get usage help, try the -h option
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
#reldir=`dirname $0`/..
reldir=`pwd`
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster network hub tar package creator.";
echo "parameters";
echo "";
echo " -d, --directory Place the tarball in the specified directory.";
echo " [default: current directory]";
echo " -v, --version The version number of the created package.";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o d:v:h -l lspath:,output:,version:,help -n $CMD -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
-d|--directory)
directory=$2;
shift; shift;;
-v|--version)
version=$2;
shift; shift;;
-h|--help)
printUsage;
exit 0;;
--)
shift;
break;;
*)
echo "Unrecognized option $1.";
printUsage;
exit 1;
esac
done
if [ "x$directory" == "x" ]; then
directory=`pwd`;
fi
if [ "x$version" == "x" ]; then
echo "Required parameter version not specified.";
printUsage;
exit 1;
fi
echo "Creating Campcaster network hub tar.gz package.";
echo "";
echo "Using the following installation parameters:";
echo "";
echo " LS directory: $lspath";
echo " output directory: $directory";
echo ""
#-------------------------------------------------------------------------------
# Check if there are generated files, and bail out if so
#-------------------------------------------------------------------------------
if [ -f $basedir/Makefile ]; then
echo "ERROR: make sure to run this script on a freshly checked-out copy";
echo " of Campcaster, with NO generated files!";
exit 1;
fi
#-------------------------------------------------------------------------------
# More definitions
#-------------------------------------------------------------------------------
tarball=$directory/campcaster-hub-$version.tar.bz2
tmpreldir=campcaster-hub-$version
ls_tmpdir=$tmpdir/$tmpreldir
src_tmpdir=$ls_tmpdir/src
tools_tmpdir=$src_tmpdir/tools
modules_tmpdir=$src_tmpdir/modules
products_tmpdir=$src_tmpdir/products
bin_tmpdir=$ls_tmpdir/bin
doc_tmpdir=$ls_tmpdir/doc
etc_tmpdir=$ls_tmpdir/etc
tmp_tmpdir=$ls_tmpdir/tmp
#-------------------------------------------------------------------------------
# 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 "Executable $1 found...";
return 0;
else
echo "Executable $1 not found...";
return 1;
fi
}
COMMENT='
#-------------------------------------------------------------------------------
# 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 "tar" || exit 1;
check_exe "bzip2" || exit 1;
#-------------------------------------------------------------------------------
# Create the directories again
#-------------------------------------------------------------------------------
echo "Creating tmp directories and copying files ..."
mkdir -p $ls_tmpdir
mkdir -p $src_tmpdir
mkdir -p $modules_tmpdir
mkdir -p $tools_tmpdir
mkdir -p $bin_tmpdir
mkdir -p $etc_tmpdir/apache
#-------------------------------------------------------------------------------
# Copy the modules and tools
#-------------------------------------------------------------------------------
#cp -pPR $modules_dir/* $modules_tmpdir
for it in alib getid3 storageServer storageAdmin; do
cp -pPR $modules_dir/$it $modules_tmpdir
done
for it in pear; do
cp -pPR $toolsdir/$it $tools_tmpdir
done
for it in preInstall.sh hubSetup.sh; do
cp -pPR $bindir/$it $bin_tmpdir
done
cp -pPR $etcdir/apache/* $etc_tmpdir/apache
for it in pg_hba.conf; do
cp -pPR $etcdir/$it $etc_tmpdir
done
#-------------------------------------------------------------------------------
# Copy additional files
#-------------------------------------------------------------------------------
#cp -pPR $bindir $ls_tmpdir
#cp -pPR $etcdir $ls_tmpdir
cp -pPR README INSTALL CREDITS configure $ls_tmpdir
#-------------------------------------------------------------------------------
# Get rid of the remnants of the subversion system
#-------------------------------------------------------------------------------
# Paul Baranowski: you dont need to do this when you export from SVN.
#rm -rf `find $ls_tmpdir -name .svn -type d`
#-------------------------------------------------------------------------------
# Create the tarball
#-------------------------------------------------------------------------------
echo "Creating $tarball ...";
cd $tmpdir
tar cjf $tarball $tmpreldir
cd $basedir
rm -rf $ls_tmpdir
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

269
install/dist.sh Executable file
View file

@ -0,0 +1,269 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script creates a distribution tarball for Campcaster.
# Creates two tarballs:
# campcaster-<version>.tar.bz2 - the Campcaster source files
# campcaster-libraries-<version>.tar.bz2 - dependent libraries
#
# Invoke as:
# ./bin/dist.sh -v <version.number>
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster install script.";
echo "parameters";
echo "";
echo " -d, --directory Place the tarballs in the specified directory.";
echo " [default: the parent of the 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
d=`cd $directory; pwd`
directory=$d
echo "Creating tarballs for Campcaster.";
echo "";
echo "Using the following parameters:";
echo "";
echo " output directory: $directory";
echo " package version number: $version";
echo ""
#-------------------------------------------------------------------------------
# Check if there are generated files, and bail out if so
#-------------------------------------------------------------------------------
if [ -f $basedir/Makefile ]; then
echo "ERROR: make sure to run this script on a freshly checked-out copy";
echo " of Campcaster, with NO generated files!";
exit 1;
fi
#-------------------------------------------------------------------------------
# More definitions
#-------------------------------------------------------------------------------
tarball=$directory/campcaster-$version.tar.bz2
tarball_libs=$directory/campcaster-libraries-$version.tar.bz2
ls_tmpdir=$tmpdir/campcaster-$version
src_tmpdir=$ls_tmpdir/src
tools_tmpdir=$src_tmpdir/tools
modules_tmpdir=$src_tmpdir/modules
products_tmpdir=$src_tmpdir/products
doc_tmpdir=$ls_tmpdir/doc
etc_tmpdir=$ls_tmpdir/etc
tmp_tmpdir=$ls_tmpdir/tmp
libodbcxx_dir=$toolsdir/libodbc++
libodbcxx_version=libodbc++-0.2.5
libodbcxx_tmpdir=$tools_tmpdir/libodbc++
xmlrpcxx_dir=$toolsdir/xmlrpc++
xmlrpcxx_version=xmlrpc++-20040713
xmlrpcxx_tmpdir=$tools_tmpdir/xmlrpc++
taglib_dir=$toolsdir/taglib
taglib_version=taglib-1.5
taglib_tmpdir=$tools_tmpdir/taglib
pear_dir=$toolsdir/pear
pear_tmpdir=$tools_tmpdir/pear
#-------------------------------------------------------------------------------
# Create the sources tarball first
#-------------------------------------------------------------------------------
echo "Creating $tarball...";
#-------------------------------------------------------------------------------
# Create the directories again
#-------------------------------------------------------------------------------
mkdir -p $ls_tmpdir
mkdir -p $ls_tmpdir/usr
mkdir -p $tmp_tmpdir
mkdir -p $src_tmpdir
mkdir -p $modules_tmpdir
mkdir -p $products_tmpdir
#-------------------------------------------------------------------------------
# Copy the modules and products
#-------------------------------------------------------------------------------
cp -pPR $modules_dir/* $modules_tmpdir
cp -pPR $products_dir/* $products_tmpdir
#-------------------------------------------------------------------------------
# Copy additional files
#-------------------------------------------------------------------------------
cp -pPR $bindir $ls_tmpdir
cp -pPR $docdir $ls_tmpdir
cp -pPR $etcdir $ls_tmpdir
cp -pPR README INSTALL CREDITS configure $ls_tmpdir
#-------------------------------------------------------------------------------
# Get rid of the remnants of the subversion system
#-------------------------------------------------------------------------------
rm -rf `find $ls_tmpdir -name .svn -type d`
#-------------------------------------------------------------------------------
# Create the main configure script
#-------------------------------------------------------------------------------
cd $tmpdir/campcaster-$version
./bin/autogen.sh
cd $basedir
#-------------------------------------------------------------------------------
# Create the tarball
#-------------------------------------------------------------------------------
cd $tmpdir
tar cfj $tarball campcaster-$version
cd $basedir
#-------------------------------------------------------------------------------
# Create the libraries tarball second
#-------------------------------------------------------------------------------
echo "Creating $tarball_libs...";
#-------------------------------------------------------------------------------
# Create temprorary directory structure again
#-------------------------------------------------------------------------------
rm -rf $ls_tmpdir
mkdir -p $ls_tmpdir
mkdir -p $tools_tmpdir
#-------------------------------------------------------------------------------
# Copy the tools sources
#-------------------------------------------------------------------------------
mkdir -p $cxxunit_tmpdir
cp -pPR $cxxunit_dir/$cxxunit_version $cxxunit_tmpdir
mkdir -p $libodbcxx_tmpdir
cp -pPR $libodbcxx_dir/$libodbcxx_version $libodbcxx_tmpdir
mkdir -p $xmlrpcxx_tmpdir
cp -pPR $xmlrpcxx_dir/$xmlrpcxx_version $xmlrpcxx_tmpdir
mkdir -p $taglib_tmpdir
cp -pPR $taglib_dir/$taglib_version $taglib_tmpdir
mkdir -p $pear_tmpdir
cp -pPR $pear_dir/* $pear_tmpdir
#-------------------------------------------------------------------------------
# Get rid of the remnants of the subversion system
#-------------------------------------------------------------------------------
rm -rf `find $ls_tmpdir -name .svn -type d`
#-------------------------------------------------------------------------------
# Create the libraries tarball
#-------------------------------------------------------------------------------
cd $tmpdir
tar cfj $tarball_libs campcaster-$version
cd $basedir
#-------------------------------------------------------------------------------
# Clean up
#-------------------------------------------------------------------------------
rm -rf $ls_tmpdir
#-------------------------------------------------------------------------------
# We're done
#-------------------------------------------------------------------------------
echo "Done."

87
install/gen_coverage_data.sh Executable file
View file

@ -0,0 +1,87 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script generates code coverage data for all modules
#-------------------------------------------------------------------------------
module="Campcaster"
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
docdir=$basedir/doc
srcdir=$basedir/src
tmpdir=$basedir/tmp
modules_dir=$srcdir/modules
products_dir=$srcdir/products
usrdir=`cd $basedir/usr; pwd;`
coverage_report_dir=$docdir/coverage
core_coverage_file=$modules_dir/core/tmp/coverage.info
authentication_coverage_file=$modules_dir/authentication/tmp/coverage.info
db_coverage_file=$modules_dir/db/tmp/coverage.info
storageClient_coverage_file=$modules_dir/storageClient/tmp/coverage.info
eventScheduler_coverage_file=$modules_dir/eventScheduler/tmp/coverage.info
schedulerClient_coverage_file=$modules_dir/schedulerClient/tmp/coverage.info
playlistExecutor_coverage_file=$modules_dir/playlistExecutor/tmp/coverage.info
scheduler_coverage_file=$products_dir/scheduler/tmp/coverage.info
coverage_file=$tmpdir/coverage.info
lcov=$usrdir/bin/lcov
genhtml=$usrdir/bin/genhtml
#-------------------------------------------------------------------------------
# Execute the coverage tests one by one
#-------------------------------------------------------------------------------
$modules_dir/core/bin/gen_coverage_data.sh
$modules_dir/authentication/bin/gen_coverage_data.sh
$modules_dir/db/bin/gen_coverage_data.sh
$modules_dir/storageClient/bin/gen_coverage_data.sh
$modules_dir/eventScheduler/bin/gen_coverage_data.sh
$modules_dir/schedulerClient/bin/gen_coverage_data.sh
$modules_dir/playlistExecutor/bin/gen_coverage_data.sh
$products_dir/scheduler/bin/gen_coverage_data.sh
#-------------------------------------------------------------------------------
# Gather all the coverage information into one file
# remove references to the tmp directories, and replace them with the module
# directories themselves. this way the source files are found easlity by lcov
#-------------------------------------------------------------------------------
echo "" > $coverage_file
cat $core_coverage_file | sed -e "s/core\/tmp\//core\//g" >> $coverage_file
cat $authentication_coverage_file | sed -e "s/authentication\/tmp\//authentication\//g" >> $coverage_file
cat $db_coverage_file | sed -e "s/db\/tmp\//db\//g" >> $coverage_file
cat $storageClient_coverage_file | sed -e "s/storageClient\/tmp\//storageClient\//g" >> $coverage_file
cat $eventScheduler_coverage_file | sed -e "s/eventScheduler\/tmp\//eventScheduler\//g" >> $coverage_file
cat $schedulerClient_coverage_file | sed -e "s/schedulerClient\/tmp\//schedulerClient\//g" >> $coverage_file
cat $playlistExecutor_coverage_file | sed -e "s/playlistExecutor\/tmp\//playlistExecutor\//g" >> $coverage_file
cat $scheduler_coverage_file | sed -e "s/scheduler\/tmp\//scheduler\//g" >> $coverage_file
rm -rf $coverage_report_dir
mkdir -p $coverage_report_dir
$genhtml -t "$module" -o $coverage_report_dir $coverage_file

480
install/hubSetup.sh Executable file
View file

@ -0,0 +1,480 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# Author : $Author: fgerlits $
# Version : $Revision: 2292 $
# Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/bin/postInstallStation.sh $
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script makes installation steps for the Campcaster network hub.
#
# Invoke as:
# ./bin/hubSetup.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
srcdir=$basedir/src
tools_dir=$srcdir/tools
modules_dir=$srcdir/modules
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster network hub install script.";
echo "parameters";
echo "";
echo " -d, --directory The installation directory, required.";
echo " -n, --hostname The remotely accessible hostname [default `hostname -f`].";
echo " -D, --database The name of the Campcaster database.";
echo " [default: CampcasterHub]";
echo " -g, --apache-group The group the apache daemon runs as.";
echo " [default: www-data]";
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: campcaster]";
echo " -w, --dbpassword The database user password.";
echo " [default: campcaster]";
echo " -p, --postgresql-dir The postgresql data directory, containing";
echo " pg_hba.conf [default: /etc/postgresql]";
echo " -i, --postgresql-init-script The name of the postgresql init";
echo " script [default: /etc/init.d/postgresql]";
echo " -P, --skip-postgresql Don't modify posgresql configuration.";
echo " -A, --skip-apache Don't modify apache configuration.";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o Ad:D:g:hi:n:p:Pr:s:u:w: -l apache-group:,database:,dbserver:,dbuser:,dbpassword:,directory:,help,hostname:,postgresql-dir:,postgresql-init-script:,skip-apache,skip-postgresql,www-root: -n $CMD -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
-S|--skip-apache)
skip_apache="yes";
shift;;
-d|--directory)
installdir=$2;
shift; shift;;
-D|--database)
database=$2;
shift; shift;;
-g|--apache-group)
apache_group=$2;
shift; shift;;
-h|--help)
printUsage;
exit 0;;
-i|--postgresql-init-script)
postgresql_init_script=$2;
shift; shift;;
-n|--hostname)
hostname=$2;
shift; shift;;
-p|--postgresql-dir)
postgresql_dir=$2;
shift; shift;;
-P|--skip-postgresql)
skip_postgresql="yes";
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$dbserver" == "x" ]; then
dbserver=localhost;
fi
if [ "x$database" == "x" ]; then
database=CampcasterHub;
fi
if [ "x$dbuser" == "x" ]; then
dbuser=campcaster;
fi
if [ "x$dbpassword" == "x" ]; then
dbpassword=campcaster;
fi
if [ "x$apache_group" == "x" ]; then
apache_group=www-data;
fi
if [ "x$postgresql_dir" == "x" ]; then
postgresql_dir=/etc/postgresql;
fi
if [ "x$postgresql_init_script" == "x" ]; then
postgresql_init_script=/etc/init.d/postgresql;
fi
if [ "x$www_root" == "x" ]; then
www_root=/var/www;
fi
if [ "x$hostname" == "x" ]; then
hostname=`hostname -f`
fi
www_port=80
echo "Installing Campcaster network hub.";
echo "";
echo "Using the following installation parameters:";
echo "";
echo " installation directory: $installdir";
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 " postgresql data directory: $postgresql_dir";
echo " postgresql init script: $postgresql_init_script";
echo " hostname: $hostname";
echo " www port: $www_port";
echo ""
#-------------------------------------------------------------------------------
# The details of installation
#-------------------------------------------------------------------------------
ls_dbserver=$dbserver
ls_dbuser=$dbuser
ls_dbpassword=$dbpassword
ls_database=$database
postgres_user=postgres
install_bin=$installdir/bin
install_etc=$installdir/etc
install_lib=$installdir/lib
install_usr=$installdir/usr
install_var_ls=$installdir/var/Campcaster
url_prefix=campcaster_hub
#-------------------------------------------------------------------------------
# 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 "Executable $1 found...";
return 0;
else
echo "Executable $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 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;
#-------------------------------------------------------------------------------
# Install the new pg_hba.conf file
#-------------------------------------------------------------------------------
if [ "$skip_postgresql" != "yes" ]; then
echo "Modifying postgresql access permissions...";
pg_config_dir=$postgresql_dir
pg_config_file=pg_hba.conf
pg_config_file_saved=pg_hba.conf.before-campcaster
if [ -f $pg_config_dir/$pg_config_file ] ; then
mv -vf $pg_config_dir/$pg_config_file $pg_config_dir/$pg_config_file_saved ;
fi
cp -v $etcdir/$pg_config_file $pg_config_dir/$pg_config_file
chown root:$postgres_user $pg_config_dir/$pg_config_file
# don't use restart for the init script, as it might return prematurely
# and in the later call to psql we wouldn't be able to connect
${postgresql_init_script} stop
${postgresql_init_script} start
fi
#-------------------------------------------------------------------------------
# Configuring Apache
#-------------------------------------------------------------------------------
if [ "$skip_apache" != "yes" ]; then
echo "Configuring apache ..."
CONFFILE=90_php_campcaster.conf
AP_DDIR_FOUND=no
for APACHE_DDIR in \
/etc/apache/conf.d /etc/apache2/conf.d /etc/apache2/conf/modules.d \
/etc/httpd/conf.d /etc/apache2/modules.d
do
echo -n "$APACHE_DDIR "
if [ -d $APACHE_DDIR ]; then
echo "Y"
AP_DDIR_FOUND=yes
cp -v $basedir/etc/apache/$CONFFILE $APACHE_DDIR
break
else
echo "N"
fi
done
if [ "$AP_DDIR_FOUND" != "yes" ]; then
echo "###############################"
echo " Could not configure Apache"
echo " include following file into apache config manually:"
echo " $basedir/etc/apache/$CONFFILE"
echo "###############################"
else
echo "done"
echo "Restarting apache...";
AP_SCR_FOUND=no
for APACHE_SCRIPT in apache apache2 httpd ; do
echo -n "$APACHE_SCRIPT "
if [ -x /etc/init.d/$APACHE_SCRIPT ]; then
echo "Y"
AP_SCR_FOUND=yes
/etc/init.d/$APACHE_SCRIPT restart
else
echo "N"
fi
done
if [ "$AP_SCR_FOUND" != "yes" ]; then
echo "###############################"
echo " Could not reload Apache"
echo " please reload apache manually"
echo "###############################"
fi
echo "done"
fi
fi
#-------------------------------------------------------------------------------
# Create the necessary database user and database itself
#-------------------------------------------------------------------------------
echo "Creating database user '$ls_dbuser' and database '$ls_database' ...";
# 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 $ls_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
#-------------------------------------------------------------------------------
# Configuring modules
#-------------------------------------------------------------------------------
echo "Configuring modules ...";
cd $tools_dir/pear && ./configure --prefix=$installdir
cd $modules_dir/alib && ./configure --prefix=$installdir
cd $modules_dir/getid3 && ./configure --prefix=$installdir
#cd $modules_dir/htmlUI && ./configure --prefix=$installdir \
# --with-apache-group=$apache_group \
# --with-www-docroot=$www_root \
# --with-storage-server=$installdir/var/Campcaster/storageServer
cd $modules_dir/storageAdmin && ./configure --prefix=$installdir \
--with-storage-server=$installdir/var/Campcaster/storageServer \
--with-phppart-dir=$installdir/var/Campcaster/storageAdmin
cd $modules_dir/storageServer && \
./configure --prefix=$installdir \
--with-apache-group=$apache_group \
--with-hostname=$hostname \
--with-www-docroot=$www_root \
--with-www-port=$www_port \
--with-database-server=$dbserver \
--with-database=$database \
--with-database-user=$dbuser \
--with-database-password=$dbpassword \
--with-init-database=no \
--with-url-prefix=$url_prefix
#-------------------------------------------------------------------------------
# Install
#-------------------------------------------------------------------------------
echo "Installing modules ...";
mkdir -p $installdir
#$tools_dir/pear/bin/install.sh -d $installdir || exit 1
make -C $tools_dir/pear install
make -C $modules_dir/alib install
make -C $modules_dir/getid3 install
make -C $modules_dir/storageServer install
make -C $modules_dir/storageAdmin install
mkdir -p $install_var_ls/storageServer/var/tests
for it in ex1.mp3 ex2.wav; do
cp $modules_dir/storageServer/var/tests/$it \
$install_var_ls/storageServer/var/tests
done
#-------------------------------------------------------------------------------
# Create symlinks
#-------------------------------------------------------------------------------
echo "Creating symlinks...";
# create symlink for the PHP pages in apache's document root
webentry=$www_root/$url_prefix
rm -f $webentry
ln -vs $install_var_ls $webentry
#-------------------------------------------------------------------------------
# Setup directory permissions
#-------------------------------------------------------------------------------
echo "Setting up directory permissions..."
chgrp $apache_group $install_var_ls/storageServer/var/stor
chgrp $apache_group $install_var_ls/storageServer/var/access
chgrp $apache_group $install_var_ls/storageServer/var/trans
chgrp $apache_group $install_var_ls/storageServer/var/stor/buffer
chmod g+sw $install_var_ls/storageServer/var/stor
chmod g+sw $install_var_ls/storageServer/var/access
chmod g+sw $install_var_ls/storageServer/var/trans
chmod g+sw $install_var_ls/storageServer/var/stor/buffer
#chgrp $apache_group $install_var_ls/htmlUI/var/templates_c
#chgrp $apache_group $install_var_ls/htmlUI/var/html/img
#chmod g+sw $install_var_ls/htmlUI/var/templates_c
#chmod g+sw $install_var_ls/htmlUI/var/html/img
#-------------------------------------------------------------------------------
# Initialize the database
#-------------------------------------------------------------------------------
echo "Initializing database...";
# create PHP-related database tables
cd $install_var_ls/storageServer/var/install
php -q install.php || exit 1;
cd -
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."
exit

323
install/install-sh Executable file
View file

@ -0,0 +1,323 @@
#!/bin/bash
# install - install a program, script, or datafile
scriptversion=2005-02-02.21
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

22
install/install.py Normal file
View file

@ -0,0 +1,22 @@
// install dir
// DB server
// Database name
// DB user
// DB password
// Apache group
// postgres dir
// postgres init script
// Web root
Save this stuff to config file
Run install.php
Create/adjust directories
Move config values to INI file
// Setup dir structure (can it be setup that way in the first place?)
// Check that the exe's exist
// check apache group exists
// install pg_hba.conf
// create database
//

84
install/nightlyBuild.sh Executable file
View file

@ -0,0 +1,84 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script generates the nightly builds and logs.
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=${basedir}/bin
tmpdir=${basedir}/tmp
logdir=${basedir}/tmp
cd ${basedir}
#-------------------------------------------------------------------------------
# Update the source from the repository.
#-------------------------------------------------------------------------------
mv -f ${logdir}/nightlySvnUpdate.log ${logdir}/nightlySvnUpdate.log~
svn update &> ${logdir}/nightlySvnUpdate.log
ls -l ${logdir}/nightlySvnUpdate.log >> ${logdir}/nightlySvnUpdate.log
#-------------------------------------------------------------------------------
# Generate the documentation.
#-------------------------------------------------------------------------------
mv -f ${logdir}/nightlyMakeDoxygen.log ${logdir}/nightlyMakeDoxygen.log~
make doxygen &> ${logdir}/nightlyMakeDoxygen.log
ls -l ${logdir}/nightlyMakeDoxygen.log >> ${logdir}/nightlyMakeDoxygen.log
#-------------------------------------------------------------------------------
# Recompile the code.
#-------------------------------------------------------------------------------
mv -f ${logdir}/nightlyMakeRecompile.log ${logdir}/nightlyMakeRecompile.log~
make recompile &> ${logdir}/nightlyMakeRecompile.log
ls -l ${logdir}/nightlyMakeRecompile.log >> ${logdir}/nightlyMakeRecompile.log
#-------------------------------------------------------------------------------
# Run the unit tests.
#-------------------------------------------------------------------------------
mv -f ${logdir}/nightlyMakeCheck.log ${logdir}/nightlyMakeCheck.log~
make check &> ${logdir}/nightlyMakeCheck.log
ls -l ${logdir}/nightlyMakeCheck.log >> ${logdir}/nightlyMakeCheck.log
#-------------------------------------------------------------------------------
# Generate the test results report.
#-------------------------------------------------------------------------------
mv -f ${logdir}/nightlyMakeTestResults.log ${logdir}/nightlyMakeTestResults.log~
make testresults &> ${logdir}/nightlyMakeTestResults.log
ls -l ${logdir}/nightlyMakeTestResults.log >> ${logdir}/nightlyMakeTestResults.log
#-------------------------------------------------------------------------------
# Generate the flawfinder report.
#-------------------------------------------------------------------------------
mv -f ${logdir}/nightlyMakeFlawfinder.log ${logdir}/nightlyMakeFlawfinder.log~
make flawfinder &> ${logdir}/nightlyMakeFlawfinder.log
ls -l ${logdir}/nightlyMakeFlawfinder.log >> ${logdir}/nightlyMakeFlawfinder.log

443
install/postInstallStation.sh Executable file
View file

@ -0,0 +1,443 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script makes post-installation steps for the Campcaster Station.
#
# Invoke as:
# ./bin/postInstallStation.sh
#
# To get usage help, try the -h option
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster Station post-install script.";
echo "parameters";
echo "";
echo " -d, --directory The installation directory, required.";
echo " -D, --database The name of the Campcaster database.";
echo " [default: Campcaster]";
echo " -g, --apache-group The group the apache daemon runs as.";
echo " [default: apache]";
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: campcaster]";
echo " -w, --dbpassword The database user password.";
echo " [default: campcaster]";
echo " -p, --postgresql-dir The postgresql data directory, containing";
echo " pg_hba.conf [default: /etc/postgresql]";
echo " -i, --postgresql-init-script The name of the postgresql init";
echo " script [default: /etc/init.d/postgresql]";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o d:D:g:hi:p:r:s:u:w: -l apache-group:,database:,dbserver:,dbuser:,dbpassword:,directory:,help,postgresql-dir:,postgresql-init-script:,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|--help)
printUsage;
exit 0;;
-i|--postgresql-init-script)
postgresql_init_script=$2;
shift; shift;;
-p|--postgresql-dir)
postgresql_dir=$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$dbserver" == "x" ]; then
dbserver=localhost;
fi
if [ "x$database" == "x" ]; then
database=Campcaster;
fi
if [ "x$dbuser" == "x" ]; then
dbuser=campcaster;
fi
if [ "x$dbpassword" == "x" ]; then
dbpassword=campcaster;
fi
if [ "x$apache_group" == "x" ]; then
apache_group=apache;
fi
if [ "x$postgresql_dir" == "x" ]; then
postgresql_dir=/etc/postgresql;
fi
if [ "x$postgresql_init_script" == "x" ]; then
postgresql_init_script=/etc/init.d/postgresql;
fi
if [ "x$www_root" == "x" ]; then
www_root=/var/www;
fi
echo "Making post-install steps for Campcaster Station.";
echo "";
echo "Using the following installation parameters:";
echo "";
echo " installation directory: $installdir";
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 " postgresql data directory: $postgresql_dir";
echo " postgresql init script: $postgresql_init_script";
echo ""
#-------------------------------------------------------------------------------
# The details of installation
#-------------------------------------------------------------------------------
ls_dbserver=$dbserver
ls_dbuser=$dbuser
ls_dbpassword=$dbpassword
ls_database=$database
postgres_user=postgres
install_bin=$installdir/bin
install_etc=$installdir/etc
install_lib=$installdir/lib
install_usr=$installdir/usr
install_var=$installdir/var
install_var_ls=$install_var/Campcaster
#-------------------------------------------------------------------------------
# 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 "Executable $1 found...";
return 0;
else
echo "Executable $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 "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;
#-------------------------------------------------------------------------------
# Install the new pg_hba.conf file
#-------------------------------------------------------------------------------
echo "Modifying postgresql access permissions...";
pg_config_dir=$postgresql_dir
pg_config_file=pg_hba.conf
pg_config_file_saved=pg_hba.conf.before-campcaster
if [ -f $pg_config_dir/$pg_config_file ] ; then
mv -f $pg_config_dir/$pg_config_file $pg_config_dir/$pg_config_file_saved ;
fi
cp $install_etc/$pg_config_file $pg_config_dir/$pg_config_file
chown root:$postgres_user $pg_config_dir/$pg_config_file
# don't use restart for the init script, as it might return prematurely
# and in the later call to psql we wouldn't be able to connect
${postgresql_init_script} stop
${postgresql_init_script} start
#-------------------------------------------------------------------------------
# Create the necessary database user and database itself
#-------------------------------------------------------------------------------
${install_bin}/createDatabase.sh --database=${ls_database} \
--dbuser=${ls_dbuser} \
--dbpassword=${ls_dbpassword} \
--dbserver=${ls_dbserver}
#-------------------------------------------------------------------------------
# Create the ODBC data source and driver
#-------------------------------------------------------------------------------
${install_bin}/createOdbcDataSource.sh --database=${ls_database} \
--dbserver=${ls_dbserver}
#-------------------------------------------------------------------------------
# Check whether the storage server directory has been replaced with a mount
# point for an NFS share.
#-------------------------------------------------------------------------------
storagedir=$installdir/var/storageServer
storage_is_local=yes
if [ "`mount | grep -o \"on $storagedir \"`" = "on $storagedir " ]; then
storage_is_local=no
fi
#-------------------------------------------------------------------------------
# Setup directory permissions
#-------------------------------------------------------------------------------
echo "Setting up directory permissions..."
if [ "$storage_is_local" = "yes" ]; then
chgrp $apache_group $install_var_ls/storageServer/var/stor
chgrp $apache_group $install_var_ls/storageServer/var/access
chgrp $apache_group $install_var_ls/storageServer/var/trans
chgrp $apache_group $install_var_ls/storageServer/var/stor/buffer
chmod g+sw $install_var_ls/storageServer/var/stor
chmod g+sw $install_var_ls/storageServer/var/access
chmod g+sw $install_var_ls/storageServer/var/trans
chmod g+sw $install_var_ls/storageServer/var/stor/buffer
fi
chgrp $apache_group $install_var_ls/htmlUI/var/templates_c
chgrp $apache_group $install_var_ls/htmlUI/var/html/img
chmod g+sw $install_var_ls/htmlUI/var/templates_c
chmod g+sw $install_var_ls/htmlUI/var/html/img
#-------------------------------------------------------------------------------
# Configuring Apache
#-------------------------------------------------------------------------------
echo "Configuring apache ..."
CONFFILE=90_php_campcaster.conf
AP_DDIR_FOUND=no
for APACHE_DDIR in \
/etc/apache/conf.d /etc/apache2/conf.d /etc/apache2/conf/modules.d \
/etc/httpd/conf.d
do
echo -n "$APACHE_DDIR "
if [ -d $APACHE_DDIR ]; then
echo "Y"
AP_DDIR_FOUND=yes
cp $basedir/etc/apache/$CONFFILE $APACHE_DDIR
break
else
echo "N"
fi
done
if [ "$AP_DDIR_FOUND" != "yes" ]; then
echo "###############################"
echo " Could not configure Apache"
echo " include following file into apache config manually:"
echo " $basedir/etc/apache/$CONFFILE"
echo "###############################"
fi
echo "done"
echo "Restarting apache...";
AP_SCR_FOUND=no
for APACHE_SCRIPT in apache apache2 httpd ; do
echo -n "$APACHE_SCRIPT "
if [ -x /etc/init.d/$APACHE_SCRIPT ]; then
echo "Y"
AP_SCR_FOUND=yes
/etc/init.d/$APACHE_SCRIPT restart
break
else
echo "N"
fi
done
if [ "$AP_SCR_FOUND" != "yes" ]; then
echo "###############################"
echo " Could not reload Apache"
echo " please reload apache manually"
echo "###############################"
fi
echo "done"
#-------------------------------------------------------------------------------
# Create symlinks
#-------------------------------------------------------------------------------
echo "Creating symlinks...";
# create symlink for the PHP pages in apache's document root
rm -f $www_root/campcaster
ln -s $install_var_ls $www_root/campcaster
#-------------------------------------------------------------------------------
# Initialize the database
#-------------------------------------------------------------------------------
echo "Initializing database...";
if [ "$storage_is_local" = "yes" ]; then
# create PHP-related database tables
cd $install_var_ls/storageServer/var/install
# workaround for #2059; restore to "exit 1" after the ticket is closed
php -q install.php || exit 1;
#php -q install.php || true
cd -
fi
# workaround for ticket #2059; restore to "exit 1" after the ticket is closed
php -q install.php || exit 1;
#php -q install.php || true
cd -
# create scheduler-related database tables
cd $installdir
./bin/campcaster-scheduler.sh install || exit 1;
cd -
#-------------------------------------------------------------------------------
# Generate a random password for the scheduler's access to the storage
#-------------------------------------------------------------------------------
if [ "$storage_is_local" = "yes" ]; then
grep -q 'ls_scheduler_storage_pass' $install_etc/campcaster-scheduler.xml
if [ $? = 0 ]; then
SCHEDULER_STORAGE_PASS=`pwgen -N1 -c -n -s`
php -q $install_var_ls/storageServer/var/install/campcaster-user.php \
--addupdate scheduler ${SCHEDULER_STORAGE_PASS}
sed -i -e "s/ls_scheduler_storage_pass/${SCHEDULER_STORAGE_PASS}/" \
$install_etc/campcaster-scheduler.xml
fi
fi
#-------------------------------------------------------------------------------
# Initialize the twitter cron
#-------------------------------------------------------------------------------
echo "Initializing twitter cron...";
cd $install_var_ls/htmlUI/var/install
# workaround for #2059; restore to "exit 1" after the ticket is closed
php -q install.php || exit 1;
#php -q install.php || true
cd -
# We need the scheduler password here too
sed -i -e "s/change_me/${SCHEDULER_STORAGE_PASS}/" \
$install_var_ls/htmlUI/var/html/ui_twitterCron.php
#-------------------------------------------------------------------------------
# Update the database, if necessary
#-------------------------------------------------------------------------------
if [ "$storage_is_local" = "yes" ]; then
php -q $install_var_ls/storageServer/var/install/upgrade/upgrade.php
fi
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

268
install/postUninstall.sh Executable file
View file

@ -0,0 +1,268 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script makes post-uninstallation steps for Campcaster.
#
# 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 "Campcaster post-uninstall script.";
echo "parameters";
echo "";
echo " -d, --directory The installation directory, required.";
echo " -D, --database The name of the Campcaster database.";
echo " [default: Campcaster]";
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: campcaster]";
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=Campcaster;
fi
if [ "x$dbuser" == "x" ]; then
dbuser=campcaster;
fi
if [ "x$www_root" == "x" ]; then
www_root=/var/www
fi
echo "Making post-uninstall steps for Campcaster.";
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 "Executable $1 found...";
return 0;
else
echo "Executable $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/campcaster
#-------------------------------------------------------------------------------
# Check whether the storage server directory has been replaced with a mount
# point for an NFS share.
#-------------------------------------------------------------------------------
storagedir=$installdir/var/storageServer
storage_is_local=yes
if [ "`mount | grep -o \"on $storagedir \"`" = "on $storagedir " ]; then
storage_is_local=no
fi
#-------------------------------------------------------------------------------
# Delete data files
#-------------------------------------------------------------------------------
echo "Deleting data files...";
rm -rf $installdir/var/htmlUI/var/html/img/*
rm -rf $installdir/var/htmlUI/var/templates_c/*
if [ "$storage_is_local" = "yes" ]; then
rm -rf $installdir/var/storageServer/var/stor/*
rm -rf $installdir/var/storageServer/var/access/*
rm -rf $installdir/var/storageServer/var/trans/*
fi
#-------------------------------------------------------------------------------
# Remove the ODBC data source and driver
#-------------------------------------------------------------------------------
echo "Removing ODBC data source and driver...";
echo "Removing Campcaster 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."

149
install/preInstall.sh Executable file
View file

@ -0,0 +1,149 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script makes pre-install steps and checks for Campcaster.
#
# 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
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster 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 Campcaster.";
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 "Executable $1 found...";
return 0;
else
echo "Executable $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 "odbcinst" || exit 1;
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

View file

@ -0,0 +1,121 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# A script to set up the development environment for Campcaster
#
# Invoke as:
# ./bin/setupDevelopmentEnvironment.sh
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster development environment setup 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
#-------------------------------------------------------------------------------
# Create the configure script
#-------------------------------------------------------------------------------
rm -rf $tmpdir/configure
$bindir/autogen.sh || exit 1
$basedir/configure --prefix=$usrdir \
--with-www-docroot=$usrdir/var \
--with-apache-group=$apache_group \
--enable-debug || exit 1
#-------------------------------------------------------------------------------
# Compile everything at once, including the tools
#-------------------------------------------------------------------------------
make -C $basedir all || exit 1
#-------------------------------------------------------------------------------
# User setup
#-------------------------------------------------------------------------------
#echo "Setting up user settings..."
$bindir/user_setup.sh --apache-group=$apache_group || exit 1
#-------------------------------------------------------------------------------
# We're done
#-------------------------------------------------------------------------------
echo "Done."

View file

@ -0,0 +1,208 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# A script to set up the development environment for Campcaster
#
# Invoke as:
# ./bin/setupDevelopmentEnvironmentAndLog.sh
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
tmpdir=$basedir/tmp
logdir=$basedir/tmp
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster development environment setup script.";
echo "parameters";
echo "";
echo " -g, --apache-group The group the apache daemon runs as.";
echo " [default: www-data]";
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=www-data;
fi
#------------------------------------------------------------------------------
# All steps are being logged
#------------------------------------------------------------------------------
echo "";
echo "The compile process will be started. All steps are being logged in";
echo "$logdir ";
echo "";
#------------------------------------------------------------------------------
# Cleaning the setup
#------------------------------------------------------------------------------
mv -f $logdir/make_modprod_distclean_setup.log \
$logdir/make_modprod_distclean_setup.log~
make -C $basedir modprod_distclean \
> $logdir/make_modprod_distclean_setup.log 2>&1
ls -l $logdir/make_modprod_distclean_setup.log \
>> $logdir/make_modprod_distclean_setup.log
#-------------------------------------------------------------------------------
# Create the configure script, using setup parameters
#-------------------------------------------------------------------------------
# --prefix=$usrdir --with-www-docroot=$usrdir/var =/var/www
# --with-hostname=localhost --with-apache-group=$apache_group
# --enable-debug --with-configure-apache=no =yes
#
# --with-create-database=no =yes --with-create-odbc-data-source=no =yes
# --with-init-database=no =yes --with-database=Campcaster-name
# --with-database-user=test --with-database-password=test
#
# --with-station-audio-out=default
# --with-studio-audio-out=default
# --with-studio-audio-cue=default
#
rm -rf $tmpdir/configure
echo "Now Configure ... Development Environment";
mv -f $logdir/configure_development_environment.log \
$logdir/configure_development_environment.log~
$bindir/autogen.sh \
> $logdir/configure_development_environment.log 2>&1
$basedir/configure --prefix=$usrdir --enable-debug \
--with-hostname=localhost \
--with-www-docroot=$usrdir/var \
--with-apache-group=$apache_group \
>> $logdir/configure_development_environment.log 2>&1
ls -l $logdir/configure_development_environment.log \
>> $logdir/configure_development_environment.log
echo "";
echo "Configure is done, the configure_development_environment.log is created";
echo "";
#-------------------------------------------------------------------------------
# Compile step by step
#-------------------------------------------------------------------------------
echo "Now Compiling ... Tools";
mv -f $logdir/make_install_tools_setup.log \
$logdir/make_install_tools_setup.log~
make -C $basedir tools_setup \
> $logdir/make_install_tools_setup.log 2>&1
ls -l $logdir/make_install_tools_setup.log \
>> $logdir/make_install_tools_setup.log
echo "Done Tools Setup, the make_install_tools_setup.log is created";
echo "";
echo "Now Compiling ... Doxytag";
mv -f $logdir/make_doxytag_setup.log \
$logdir/make_doxytag_setup.log~
make -C $basedir doxytag_setup \
> $logdir/make_doxytag_setup.log 2>&1
ls -l $logdir/make_doxytag_setup.log \
>> $logdir/make_doxytag_setup.log
echo "Done Doxytag Setup, the make_doxytag_setup.log is created";
echo "";
echo "Now Configure ... Modules ... Products";
mv -f $logdir/make_configure_modules_setup.log \
$logdir/make_configure_modules_setup.log~
make -C $basedir modules_setup \
> $logdir/make_configure_modules_setup.log 2>&1
ls -l $logdir/make_configure_modules_setup.log \
>> $logdir/make_configure_modules_setup.log
echo "Configure Modules is done, the make_configure_modules_setup.log is created";
mv -f $logdir/make_configure_products_setup.log \
$logdir/make_configure_products_setup.log~
make -C $basedir products_setup \
> $logdir/make_configure_products_setup.log 2>&1
ls -l $logdir/make_configure_products_setup.log \
>> $logdir/make_configure_products_setup.log
echo "Configure Products is done, the make_configure_products_setup.log is created";
echo "";
echo "Now Compiling ... Modules ... Products";
mv -f $logdir/make_compile_setup.log \
$logdir/make_compile_setup.log~
make -C $basedir compile \
> $logdir/make_compile_setup.log 2>&1
ls -l $logdir/make_compile_setup.log \
>> $logdir/make_compile_setup.log
echo "Compiling is done, the make_compile_setup.log is created";
echo "";
#-------------------------------------------------------------------------------
# User setup
#-------------------------------------------------------------------------------
echo "Setting up user settings ...";
$bindir/user_setup.sh --apache-group=$apache_group || exit 1
#-------------------------------------------------------------------------------
# Checking what we have done
#-------------------------------------------------------------------------------
echo "Now Checking ...";
mv -f $logdir/make_check_setup.log \
$logdir/make_check_setup.log~
make -C $basedir check \
> $logdir/make_check_setup.log 2>&1
ls -l $logdir/make_check_setup.log \
>> $logdir/make_check_setup.log
echo "Checking is be done, the make_check_setup.log is created";
echo "";
#-------------------------------------------------------------------------------
# We're done
#-------------------------------------------------------------------------------
echo "Done."

44
install/svnUpdate.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.campware.org/
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script runs cvs to update the Campcaster source code.
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
tmpdir=$basedir/tmp
logdir=$basedir/tmp
echo "";
echo "The Campcaster source code will be updated now ... and logged in";
echo "$logdir";
echo "";
cd $bindir/..
svn update >& $logdir/svn_update.log
ls -l $logdir/svn_update.log >> $logdir/svn_update.log
cat $logdir/svn_update.log
echo "";
echo "The svn update is done, svn_update.log is created";

78
install/test_setup_db.sh Executable file
View file

@ -0,0 +1,78 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script sets up the test database for Campcaster
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
scheduler_dir=${products_dir}/scheduler
scheduler_bindir=${scheduler_dir}/bin
usrdir=`cd $basedir/usr; pwd;`
installlog=/tmp/campcaster_install.log
#-------------------------------------------------------------------------------
# The details of the setup
#-------------------------------------------------------------------------------
ls_database=Campcaster-test
ls_dbuser=test
ls_dbpassword=test
ls_dbserver=localhost
#-------------------------------------------------------------------------------
# Create the necessary database user and database itself
#-------------------------------------------------------------------------------
${scheduler_bindir}/createDatabase.sh --database=${ls_database} \
--dbuser=${ls_dbuser} \
--dbpassword=${ls_dbpassword} \
--dbserver=${ls_dbserver}
#-------------------------------------------------------------------------------
# Create the ODBC data source and driver
#-------------------------------------------------------------------------------
${scheduler_bindir}/createOdbcDataSource.sh --database=${ls_database} \
--dbserver=${ls_dbserver}
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

236
install/updateStudioConfig.sh Executable file
View file

@ -0,0 +1,236 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script updates the configuration file of Campcaster Studio.
#
# Invoke as:
# ./bin/updateStudioConfig.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 "Campcaster Studio 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 " -o, --output-device The audio device of live-mode broadcast";
echo " [default: default]";
echo " -c, --cue-device The audio device of preview listening";
echo " [default: default]";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o d:H:hp:P:c:o: -l directory:,host:,help,port:,scheduler-port:,cue-device:,output-device: -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;;
-o|--output-device)
output_alsa_device=$2;
shift; shift;;
-c|--cue-device)
cue_alsa_device=$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$output_alsa_device" == "x" ]; then
output_alsa_device="default";
fi
if [ "x$cue_alsa_device" == "x" ]; then
cue_alsa_device="default";
fi
echo "Making post-install steps for Campcaster Studio.";
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 " live broadcast device: $output_alsa_device";
echo " preview device: $cue_alsa_device";
echo ""
#-------------------------------------------------------------------------------
# The details of installation
#-------------------------------------------------------------------------------
ls_php_host=$hostname
ls_php_port=$http_port
ls_php_urlPrefix=campcaster
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
ls_output_alsa_device=$output_alsa_device
ls_cue_alsa_device=$cue_alsa_device
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
install_var_s=`echo $install_var | 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"`
ls_output_alsa_device_s=`echo $ls_output_alsa_device | sed -e "s/\//\\\\\\\\\//g"`
ls_cue_alsa_device_s=`echo $ls_cue_alsa_device | sed -e "s/\//\\\\\\\\\//g"`
replace_sed_string="s/ls_var_dir/$install_var_s/; \
s/ls_php_urlPrefix/$ls_php_urlPrefix_s/; \
s/ls_php_host/$ls_php_host/; \
s/ls_php_port/$ls_php_port/; \
s/ls_alib_xmlRpcPrefix/$ls_alib_xmlRpcPrefix_s/; \
s/ls_audio_output_device/$ls_output_alsa_device_s/; \
s/ls_audio_cue_device/$ls_cue_alsa_device_s/; \
s/ls_scheduler_host/$ls_scheduler_host/; \
s/ls_scheduler_port/$ls_scheduler_port/; \
s/ls_scheduler_xmlRpcPrefix/$ls_scheduler_xmlRpcPrefix_s/;"
#-------------------------------------------------------------------------------
# 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 "Executable $1 found...";
return 0;
else
echo "Executable $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..."
# customize the Campcaster Studio config file
cat $install_etc/campcaster-studio.xml.template \
| sed -e "$replace_sed_string" \
> $install_etc/campcaster-studio.xml
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

View file

@ -0,0 +1,134 @@
CREATE SEQUENCE file_id_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1000000
CACHE 1;
ALTER TABLE ls_files
ALTER COLUMN id
SET DEFAULT NEXTVAL('file_id_seq');
DROP TABLE ls_struct CASCADE;
DROP TABLE ls_tree CASCADE;
DROP TABLE ls_classes CASCADE;
DROP TABLE ls_cmemb CASCADE;
DROP SEQUENCE ls_struct_id_seq_seq;
DROP SEQUENCE ls_tree_id_seq_seq;
DROP TABLE as_tree CASCADE;
DROP TABLE as_struct CASCADE;
DROP TABLE as_classes CASCADE;
DROP TABLE as_cmemb CASCADE;
DROP SEQUENCE as_struct_id_seq_seq;
DROP SEQUENCE as_tree_id_seq_seq;
ALTER TABLE cc_files
ADD COLUMN track_title character varying(512);
ALTER TABLE cc_files
ADD COLUMN artist_name character varying(512);
ALTER TABLE cc_files
ADD COLUMN bit_rate character varying(32);
ALTER TABLE cc_files
ADD COLUMN sample_rate character varying(32);
ALTER TABLE cc_files
ADD COLUMN format character varying(128);
ALTER TABLE cc_files
ADD COLUMN length character (16);
ALTER TABLE cc_files
ADD COLUMN album_title character varying(512);
ALTER TABLE cc_files
ADD COLUMN genre character varying(64);
ALTER TABLE cc_files
ADD COLUMN comments text;
ALTER TABLE cc_files
ADD COLUMN "year" character varying(16);
ALTER TABLE cc_files
ADD COLUMN track_number integer;
ALTER TABLE cc_files
ADD COLUMN channels integer;
ALTER TABLE cc_files
ADD COLUMN url character varying(1024);
ALTER TABLE cc_files
ADD COLUMN bpm character varying(8);
ALTER TABLE cc_files
ADD COLUMN rating character varying(8);
ALTER TABLE cc_files
ADD COLUMN encoded_by character varying(255);
ALTER TABLE cc_files
ADD COLUMN disc_number character varying(8);
ALTER TABLE cc_files
ADD COLUMN mood character varying(64);
ALTER TABLE cc_files
ADD COLUMN label character varying(512);
ALTER TABLE cc_files
ADD COLUMN composer character varying(512);
ALTER TABLE cc_files
ADD COLUMN encoder character varying(64);
ALTER TABLE cc_files
ADD COLUMN checksum character varying(256);
ALTER TABLE cc_files
ADD COLUMN lyrics text;
ALTER TABLE cc_files
ADD COLUMN orchestra character varying(512);
ALTER TABLE cc_files
ADD COLUMN conductor character varying(512);
ALTER TABLE cc_files
ADD COLUMN lyricist character varying(512);
ALTER TABLE cc_files
ADD COLUMN original_lyricist character varying(512);
ALTER TABLE cc_files
ADD COLUMN radio_station_name character varying(512);
ALTER TABLE cc_files
ADD COLUMN info_url character varying(512);
ALTER TABLE cc_files
ADD COLUMN artist_url character varying(512);
ALTER TABLE cc_files
ADD COLUMN audio_source_url character varying(512);
ALTER TABLE cc_files
ADD COLUMN radio_station_url character varying(512);
ALTER TABLE cc_files
ADD COLUMN buy_this_url character varying(512);
ALTER TABLE cc_files
ADD COLUMN isrc_number character varying(512);
ALTER TABLE cc_files
ADD COLUMN catalog_number character varying(512);
ALTER TABLE cc_files
ADD COLUMN original_artist character varying(512);
ALTER TABLE cc_files
ADD COLUMN copyright character varying(512);
ALTER TABLE cc_files
ADD COLUMN report_datetime character varying(32);
ALTER TABLE cc_files
ADD COLUMN report_location character varying(512);
ALTER TABLE cc_files
ADD COLUMN report_organization character varying(512);
ALTER TABLE cc_files
ADD COLUMN subject character varying(512);
ALTER TABLE cc_files
ADD COLUMN contributor character varying(512);
ALTER TABLE cc_files
ADD COLUMN language character varying(512);
ALTER TABLE cc_schedule RENAME playlist TO playlist_id;
ALTER TABLE cc_schedule ALTER playlist_id TYPE integer;
ALTER TABLE cc_schedule ADD COLUMN group_id integer;
ALTER TABLE cc_schedule ADD COLUMN file_id integer;
ALTER TABLE cc_schedule
ADD COLUMN clip_length time without time zone DEFAULT '00:00:00.000000';
ALTER TABLE cc_schedule
ADD COLUMN fade_in time without time zone DEFAULT '00:00:00.000';
ALTER TABLE cc_schedule
ADD COLUMN fade_out time without time zone DEFAULT '00:00:00.000';
ALTER TABLE cc_schedule
ADD COLUMN cue_in time without time zone DEFAULT '00:00:00.000';
ALTER TABLE cc_schedule
ADD COLUMN cue_out time without time zone DEFAULT '00:00:00.000';
ALTER TABLE cc_schedule ADD CONSTRAINT unique_id UNIQUE (id);
CREATE SEQUENCE schedule_group_id_seq;
DROP TABLE cc_mdata CASCADE;

352
install/user_setup.sh Executable file
View file

@ -0,0 +1,352 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script configures the environment for a developer.
#
# Invoke as:
# ./bin/user_setup.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
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
scheduler_dir=$products_dir/scheduler
scheduler_bin_dir=$scheduler_dir/bin
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster local user settings setup 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
scheduler_base_port=3344
user=`whoami`
# force localhost always
hostname=localhost
http_port=80
scheduler_port=`expr $scheduler_base_port + $UID`
scheduler_storage_pass=change_me
dbserver=localhost
database=Campcaster-$user
dbuser=test
dbpassword=test
homedir=$HOME
configdir=$homedir/.campcaster
htmldir=$homedir/public_html
output_device=default
cue_device=default
echo "Configuring Campcaster development environment for user $user.";
echo "";
echo "Using the following installation parameters:";
echo "";
echo " host name: $hostname";
echo " web server port: $http_port";
echo " scheduler port: $scheduler_port";
echo " storage password for the scheduler: $scheduler_storage_pass";
echo " database server: $dbserver";
echo " database: $database";
echo " database user: $dbuser";
echo " database user password: $dbpassword";
echo " apache daemon group: $apache_group";
echo " home directory: $homedir";
echo " configuration directory: $configdir";
echo " web base directory: $htmldir";
echo " output audio device: $output_device";
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,";
echo "and that the current user is a member of this group.";
exit 1;
fi
rm -f $group_tmp_file;
#-------------------------------------------------------------------------------
# The details of installation
#-------------------------------------------------------------------------------
installdir=$usrdir
ls_php_host=$hostname
ls_php_port=$http_port
ls_php_urlPrefix=~$user/campcaster
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
ls_tmp_dir=$installdir/tmp
ls_scheduler_daemon_command="$scheduler_bin_dir/campcaster-scheduler_devenv.sh"
ls_audio_output_device=$output_device
ls_audio_cue_device=$cue_device
# 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"`
ls_tmp_dir_s=`echo $ls_tmp_dir | sed -e "s/\//\\\\\\\\\//g"`
ls_scheduler_daemon_command_s=`echo $ls_scheduler_daemon_command | \
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_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/; \
s/ls_audio_output_device/$ls_audio_output_device/; \
s/ls_audio_cue_device/$ls_audio_cue_device/; \
s/ls_tmp_dir/$ls_tmp_dir_s/; \
s/ls_scheduler_daemon_command/$ls_scheduler_daemon_command_s/; \
s/ls_scheduler_storage_pass/$scheduler_storage_pass/;"
echo
echo $replace_sed_string
echo
#-------------------------------------------------------------------------------
# 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 "Executable $1 found...";
return 0;
else
echo "Executable $1 not found...";
return 1;
fi
}
#-------------------------------------------------------------------------------
# Check for required tools
#-------------------------------------------------------------------------------
echo "Checking for required tools..."
check_exe "sed" || exit 1;
check_exe "php" || exit 1;
#-------------------------------------------------------------------------------
# Customize the configuration files with the appropriate values
#-------------------------------------------------------------------------------
echo "Customizing configuration files..."
mkdir -p $configdir
cat $modules_dir/storageServer/var/conf_only.php.template \
| sed -e "$replace_sed_string" \
> $configdir/storageServer.conf.php
#cat $modules_dir/authentication/etc/webAuthentication.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/webAuthentication.xml
#
#cat $modules_dir/db/etc/connectionManagerFactory.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/connectionManagerFactory.xml
#
#cat $modules_dir/db/etc/simpleConnectionManager.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/simpleConnectionManager.xml
#
#cat $modules_dir/schedulerClient/etc/schedulerClientFactory.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/schedulerClientFactory.xml
#
#cat $modules_dir/schedulerClient/etc/schedulerDaemonXmlRpcClient.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/schedulerDaemonXmlRpcClient.xml
#
#cat $modules_dir/storageClient/etc/webAuthenticationClient.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/webAuthenticationClient.xml
#
#cat $modules_dir/storageClient/etc/webStorage.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/webStorage.xml
#
#cat $products_dir/scheduler/etc/campcaster-scheduler.xml.template \
# | sed -e "$replace_sed_string" \
# > $configdir/campcaster-scheduler.xml
#
#cat $products_dir/gLiveSupport/etc/campcaster-studio.xml.user-template \
# | sed -e "$replace_sed_string" \
# > $configdir/campcaster-studio.xml
#
#cat $products_dir/gLiveSupport/etc/authenticationClient.xml.user-template \
# | sed -e "$replace_sed_string" \
# > $configdir/authenticationClient.xml
#
#cat $products_dir/gLiveSupport/etc/storageClient.xml.user-template \
# | sed -e "$replace_sed_string" \
# > $configdir/storageClient.xml
#-------------------------------------------------------------------------------
# Create the public html directory, and links to the PHP directories
#-------------------------------------------------------------------------------
echo "Creating public HTML directory and links to web interfaces..."
mkdir -p $htmldir
rm -f $htmldir/campcaster
ln -s $modules_dir $htmldir/campcaster
#-------------------------------------------------------------------------------
# Setup storageServer
#-------------------------------------------------------------------------------
echo "Setting up storageServer..."
make -C $modules_dir/storageServer storage || exit 1
#-------------------------------------------------------------------------------
# Setup directory permissions
#-------------------------------------------------------------------------------
echo "Setting up directory permissions..."
chgrp $apache_group $modules_dir/storageServer/var/stor
chgrp $apache_group $modules_dir/storageServer/var/access
chgrp $apache_group $modules_dir/storageServer/var/trans
chgrp $apache_group $modules_dir/storageServer/var/stor/buffer
chmod g+sw $modules_dir/storageServer/var/stor
chmod g+sw $modules_dir/storageServer/var/access
chmod g+sw $modules_dir/storageServer/var/trans
chmod g+sw $modules_dir/storageServer/var/stor/buffer
chgrp $apache_group $modules_dir/htmlUI/var/templates_c
chgrp $apache_group $modules_dir/htmlUI/var/html/img
chmod g+sw $modules_dir/htmlUI/var/templates_c
chmod g+sw $modules_dir/htmlUI/var/html/img
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/index.php
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/htmlUI/index.php
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/htmlUI/var/index.php
cp $modules_dir/htmlUI/var/redirect.php $modules_dir/htmlUI/var/html/index.php
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "";
echo "The HTML user interface for the Campcaster development environment";
echo "for user $user is available at:";
echo "http://$ls_php_host:$ls_php_port/$ls_php_urlPrefix/htmlUI/var";
echo "";
echo "Done."

135
install/user_setup_db.sh Executable file
View file

@ -0,0 +1,135 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.campware.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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.
#
# Campcaster 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 Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script sets up the development environment for a user.
#
# Invoke as:
# ./bin/user_setup_root.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
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
scheduler_dir=${products_dir}/scheduler
scheduler_bindir=${scheduler_dir}/bin
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster user database setup script.";
echo "parameters:";
echo "";
echo " -u, --user The user to set up the environment for.";
echo " Required parameter.";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o hu: -l help,user: -n $CMD -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
-h|--help)
printUsage;
exit 0;;
-u|--user)
user=$2;
shift; shift;;
--)
shift;
break;;
*)
echo "Unrecognized option $1.";
printUsage;
exit 1;
esac
done
if [ "x$user" == "x" ]; then
echo "Required parameter user missing.";
printUsage;
exit 1;
fi
echo "Creating the Campcaster user database";
echo "for user: $user.";
echo ""
#-------------------------------------------------------------------------------
# The details of installation
#-------------------------------------------------------------------------------
postgres_user=postgres
ls_database=Campcaster-$user
ls_dbuser=test
ls_dbpassword=test
ls_dbserver=localhost
#-------------------------------------------------------------------------------
# Create the necessary database user and database itself
#-------------------------------------------------------------------------------
${scheduler_bindir}/createDatabase.sh --database=${ls_database} \
--dbuser=${ls_dbuser} \
--dbpassword=${ls_dbpassword} \
--dbserver=${ls_dbserver}
#-------------------------------------------------------------------------------
# Create the ODBC data source and driver
#-------------------------------------------------------------------------------
${scheduler_bindir}/createOdbcDataSource.sh --database=${ls_database} \
--dbserver=${ls_dbserver}
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."