#1844 archiveServer install script stuff
This commit is contained in:
parent
e82eabeccb
commit
56d250f21e
|
@ -0,0 +1,485 @@
|
|||
#!/bin/bash
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (c) 2004 Media Development Loan Fund
|
||||
#
|
||||
# This file is part of the LiveSupport project.
|
||||
# http://livesupport.campware.org/
|
||||
# To report bugs, send an e-mail to bugs@campware.org
|
||||
#
|
||||
# LiveSupport is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# LiveSupport is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with LiveSupport; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Author : $Author: 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 LiveSupport network hub.
|
||||
#
|
||||
# Invoke as:
|
||||
# ./bin/archiveServerSetup.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
|
||||
toolsdir=$srcdir/tools
|
||||
modules_dir=$srcdir/modules
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Print the usage information for this script.
|
||||
#-------------------------------------------------------------------------------
|
||||
printUsage()
|
||||
{
|
||||
echo "LiveSupport network hub install script.";
|
||||
echo "parameters";
|
||||
echo "";
|
||||
echo " -d, --directory The installation directory, required.";
|
||||
echo " -D, --database The name of the LiveSupport database.";
|
||||
echo " [default: LiveSupport]";
|
||||
echo " -g, --apache-group The group the apache daemon runs as.";
|
||||
echo " [default: 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: livesupport]";
|
||||
echo " -w, --dbpassword The database user password.";
|
||||
echo " [default: livesupport]";
|
||||
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=LiveSupportHub;
|
||||
fi
|
||||
|
||||
if [ "x$dbuser" == "x" ]; then
|
||||
dbuser=livesupport;
|
||||
fi
|
||||
|
||||
if [ "x$dbpassword" == "x" ]; then
|
||||
dbpassword=livesupport;
|
||||
fi
|
||||
|
||||
if [ "x$apache_group" == "x" ]; then
|
||||
apache_group=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
|
||||
|
||||
hostname=`hostname -f`
|
||||
www_port=80
|
||||
|
||||
echo "Installing LiveSupport network hub (archiveServer).";
|
||||
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/LiveSupport
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Function to check for the existence of an executable on the PATH
|
||||
#
|
||||
# @param $1 the name of the exectuable
|
||||
# @return 0 if the executable exists on the PATH, non-0 otherwise
|
||||
#-------------------------------------------------------------------------------
|
||||
check_exe() {
|
||||
if [ -x "`which $1 2> /dev/null`" ]; then
|
||||
echo "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 "pear" || 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-livesupport
|
||||
|
||||
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
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Configuring Apache
|
||||
#-------------------------------------------------------------------------------
|
||||
echo "Configuring apache ..."
|
||||
CONFFILE=90_php_livesupport.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
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# 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 $modules_dir/alib && ./configure --prefix=$installdir
|
||||
cd $modules_dir/archiveServer && \
|
||||
./configure --prefix=$installdir \
|
||||
--with-hostname=$hostname \
|
||||
--with-www-port=$www_port \
|
||||
--with-database-server=$dbserver \
|
||||
--with-database=$database \
|
||||
--with-database-user=$dbuser \
|
||||
--with-database-password=$dbpassword
|
||||
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/LiveSupport/storageServer
|
||||
cd $modules_dir/storageAdmin && ./configure --prefix=$installdir \
|
||||
--with-storage-server=$installdir/var/LiveSupport/storageServer \
|
||||
--with-phppart-dir=$installdir/var/LiveSupport/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
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Install
|
||||
#-------------------------------------------------------------------------------
|
||||
echo "Installing modules ...";
|
||||
|
||||
make -C $modules_dir/alib install
|
||||
make -C $modules_dir/getid3 install
|
||||
make -C $modules_dir/storageServer install
|
||||
make -C $modules_dir/storageAdmin install
|
||||
make -C $modules_dir/archiveServer 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
|
||||
rm -f $www_root/livesupport
|
||||
ln -vs $install_var_ls $www_root/livesupport
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Install PEAR packages (locally in the LiveSupport)
|
||||
# only if necessary
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ -f $toolsdir/pear/bin/install.sh ]; then
|
||||
$toolsdir/pear/bin/install.sh -d $installdir || exit 1;
|
||||
fi
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Setup directory permissions
|
||||
#-------------------------------------------------------------------------------
|
||||
echo "Setting up directory permissions..."
|
||||
|
||||
chgrp $apache_group $install_var_ls/archiveServer/var/stor
|
||||
chgrp $apache_group $install_var_ls/archiveServer/var/access
|
||||
chgrp $apache_group $install_var_ls/archiveServer/var/trans
|
||||
chgrp $apache_group $install_var_ls/archiveServer/var/stor/buffer
|
||||
|
||||
chmod g+sw $install_var_ls/archiveServer/var/stor
|
||||
chmod g+sw $install_var_ls/archiveServer/var/access
|
||||
chmod g+sw $install_var_ls/archiveServer/var/trans
|
||||
chmod g+sw $install_var_ls/archiveServer/var/stor/buffer
|
||||
|
||||
#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/archiveServer/var/install
|
||||
php -q install.php || exit 1;
|
||||
cd -
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Say goodbye
|
||||
#-------------------------------------------------------------------------------
|
||||
echo "Done."
|
||||
|
||||
|
||||
exit
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
#!/bin/bash
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (c) 2004 Media Development Loan Fund
|
||||
#
|
||||
# This file is part of the LiveSupport project.
|
||||
# http://livesupport.campware.org/
|
||||
# To report bugs, send an e-mail to bugs@campware.org
|
||||
#
|
||||
# LiveSupport is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# LiveSupport is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with LiveSupport; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Author : $Author: fgerlits $
|
||||
# Version : $Revision: 2292 $
|
||||
# Location : $URL: svn+ssh://tomash@code.campware.org/home/svn/repo/livesupport/trunk/livesupport/bin/postInstallStation.sh $
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# This script creates a distribution tarball for livesupport network hub.
|
||||
# (livesupport-aserver-<version>.tar.bz2)
|
||||
#
|
||||
# Invoke as:
|
||||
# ./bin/makeArchiveServerTar.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 "LiveSupport 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 LiveSupport 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 LiveSupport, with NO generated files!";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# More definitions
|
||||
#-------------------------------------------------------------------------------
|
||||
tarball=$directory/livesupport-aserver-$version.tar.bz2
|
||||
|
||||
ls_tmpdir=$tmpdir/livesupport-$version
|
||||
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 archiveServer; 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 archiveServerSetup.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 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 livesupport-$version
|
||||
cd $basedir
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Say goodbye
|
||||
#-------------------------------------------------------------------------------
|
||||
echo "Done."
|
||||
|
|
@ -98,10 +98,13 @@ REPLACE_SED_STRING="s/ls_lib_dir/${USR_LIB_DIR_S}/; \
|
|||
s/ls_dbpassword/${DB_PASSWORD}/; \
|
||||
s/ls_dbserver/${DB_SERVER}/; \
|
||||
s/ls_database/${DATABASE}/; \
|
||||
s/ls_storageUrlPath/\/${PHP_URL_PREFIX_S}\/storageServer\/var/; \
|
||||
s/ls_storageUrlPath/\/${PHP_URL_PREFIX_S}\/archiveServer\/var/; \
|
||||
s/ls_php_host/${HOSTNAME}/; \
|
||||
s/ls_php_port/${WWW_PORT}/; \
|
||||
s/ls_archiveUrlPath/\/${PHP_URL_PREFIX_S}\/archiveServer\/var/;"
|
||||
# explanation: on archive side, archive have the storage role =>
|
||||
# ls_storageUrlPath shouldn't be replaced by string ending with
|
||||
# 'storageServer/var'
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
|
|
@ -66,7 +66,7 @@ if(PEAR::isError($dbc)){
|
|||
}
|
||||
|
||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$gb =& new Archive($dbc, $config);
|
||||
$gb =& new Archive($dbc, $config, TRUE);
|
||||
$tr =& new Transport($gb);
|
||||
|
||||
echo "# archiveServer step 2:\n# trying uninstall ...\n";
|
||||
|
|
|
@ -54,7 +54,7 @@ if(PEAR::isError($dbc)){
|
|||
|
||||
echo "#ArchiveServer uninstall:\n";
|
||||
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
$gb = &new Archive($dbc, $config);
|
||||
$gb = &new Archive($dbc, $config, TRUE);
|
||||
$tr = &new Transport($gb);
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ if($pars[0] == '-s'){
|
|||
}else{
|
||||
$serverPath = 'http://localhost:80/livesupportArchiveServer/xmlrpc/xrArchive.php';
|
||||
}
|
||||
$serverPath = "http://localhost:80/~tomash/livesupport/archiveServer/var/xmlrpc/xrArchive.php";
|
||||
|
||||
$url = parse_url($serverPath);
|
||||
$client = new XML_RPC_Client($url['path'], $url['host']);
|
||||
|
|
|
@ -881,7 +881,7 @@ class Transport
|
|||
$localfile = escapeshellarg($row['localfile']);
|
||||
$url = escapeshellarg($row['url']);
|
||||
$command =
|
||||
"curl -s -C $size --max-time {$this->upTrMaxTime}".
|
||||
"curl -f -s -C $size --max-time {$this->upTrMaxTime}".
|
||||
" --speed-time {$this->upTrSpeedTime}".
|
||||
" --speed-limit {$this->upTrSpeedLimit}".
|
||||
" --connect-timeout {$this->upTrConnectTimeout}".
|
||||
|
@ -895,6 +895,8 @@ class Transport
|
|||
$res = system($command, $status);
|
||||
// status 18 - Partial file. Only a part of the file was transported.
|
||||
if($status == 0 || $status == 18){
|
||||
// status 28 - timeout
|
||||
// if($status == 0 || $status == 18 || $status == 28){
|
||||
$check = $this->uploadCheck($row['pdtoken']);
|
||||
if(PEAR::isError($check)) return $check;
|
||||
// test checksum
|
||||
|
|
Loading…
Reference in New Issue