cleaned up the postInstallStation.sh script

This commit is contained in:
fgerlits 2005-08-13 17:00:09 +00:00
parent fd7471a7e8
commit f2b3f3ce86
2 changed files with 30 additions and 95 deletions

View file

@ -22,7 +22,7 @@
# #
# #
# Author : $Author: fgerlits $ # Author : $Author: fgerlits $
# Version : $Revision: 1.6 $ # Version : $Revision: 1.7 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/postInstallStation.sh,v $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/bin/postInstallStation.sh,v $
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -33,8 +33,6 @@
# #
# To get usage help, try the -h option # To get usage help, try the -h option
# #
# TODO: Most of the command line options and variables are unnecessary;
# figure out which ones, and remove them.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -43,10 +41,6 @@
reldir=`dirname $0`/.. reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;` basedir=`cd $reldir; pwd;`
bindir=$basedir/bin bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
tmpdir=$basedir/tmp
usrdir=$basedir/usr
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -61,12 +55,7 @@ printUsage()
echo " -D, --database The name of the LiveSupport database."; echo " -D, --database The name of the LiveSupport database.";
echo " [default: LiveSupport]"; echo " [default: LiveSupport]";
echo " -g, --apache-group The group the apache daemon runs as."; echo " -g, --apache-group The group the apache daemon runs as.";
echo " [default: apache]"; echo " [default: www-data]";
echo " -H, --host The fully qualified host name of the system";
echo " [default: guess].";
echo " -p, --port The port of the apache web server [default: 80]"
echo " -P, --scheduler-port The port of the scheduler daemon to install"
echo " [default: 3344]";
echo " -r, --www-root The root directory for web documents served"; echo " -r, --www-root The root directory for web documents served";
echo " by apache [default: /var/www]"; echo " by apache [default: /var/www]";
echo " -s, --dbserver The name of the database server host."; echo " -s, --dbserver The name of the database server host.";
@ -75,8 +64,6 @@ printUsage()
echo " database. [default: livesupport]"; echo " database. [default: livesupport]";
echo " -w, --dbpassword The database user password."; echo " -w, --dbpassword The database user password.";
echo " [default: livesupport]"; echo " [default: livesupport]";
echo " -o, --output-device The audio device of broadcast";
echo " [default: plughw:0,0]";
echo " -h, --help Print this message and exit."; echo " -h, --help Print this message and exit.";
echo ""; echo "";
} }
@ -100,18 +87,9 @@ while true; do
-g|--apache-group) -g|--apache-group)
apache_group=$2; apache_group=$2;
shift; shift;; shift; shift;;
-H|--host)
hostname=$2;
shift; shift;;
-h|--help) -h|--help)
printUsage; printUsage;
exit 0;; exit 0;;
-p|--port)
http_port=$2;
shift; shift;;
-P|--scheduler-port)
scheduler_port=$2;
shift; shift;;
-r|--www-root) -r|--www-root)
www_root=$2; www_root=$2;
shift; shift;; shift; shift;;
@ -124,9 +102,6 @@ while true; do
-w|--dbpassword) -w|--dbpassword)
dbpassword=$2; dbpassword=$2;
shift; shift;; shift; shift;;
-o|--output-device)
output_alsa_device=$2;
shift; shift;;
--) --)
shift; shift;
break;; break;;
@ -143,18 +118,6 @@ if [ "x$installdir" == "x" ]; then
exit 1; exit 1;
fi fi
if [ "x$hostname" == "x" ]; then
hostname=`hostname -f`;
fi
if [ "x$http_port" == "x" ]; then
http_port=80;
fi
if [ "x$scheduler_port" == "x" ]; then
scheduler_port=3344;
fi
if [ "x$dbserver" == "x" ]; then if [ "x$dbserver" == "x" ]; then
dbserver=localhost; dbserver=localhost;
fi fi
@ -172,15 +135,11 @@ if [ "x$dbpassword" == "x" ]; then
fi fi
if [ "x$apache_group" == "x" ]; then if [ "x$apache_group" == "x" ]; then
apache_group=apache; apache_group=www-data;
fi fi
if [ "x$www_root" == "x" ]; then if [ "x$www_root" == "x" ]; then
www_root=/var/www www_root=/var/www;
fi
if [ "x$output_alsa_device" == "x" ]; then
output_alsa_device="plughw:0,0";
fi fi
echo "Making post-install steps for the LiveSupport scheduler."; echo "Making post-install steps for the LiveSupport scheduler.";
@ -188,49 +147,29 @@ echo "";
echo "Using the following installation parameters:"; echo "Using the following installation parameters:";
echo ""; echo "";
echo " installation directory: $installdir"; echo " installation directory: $installdir";
echo " host name: $hostname";
echo " web server port: $http_port";
echo " scheduler port: $scheduler_port";
echo " database server: $dbserver"; echo " database server: $dbserver";
echo " database: $database"; echo " database: $database";
echo " database user: $dbuser"; echo " database user: $dbuser";
echo " database user password: $dbpassword"; echo " database user password: $dbpassword";
echo " apache daemon group: $apache_group"; echo " apache daemon group: $apache_group";
echo " apache document root: $www_root"; echo " apache document root: $www_root";
echo " broadcast device: $output_alsa_device";
echo "" echo ""
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# The details of installation # The details of installation
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ls_php_host=$hostname
ls_php_port=$http_port
ls_php_urlPrefix=livesupport
ls_alib_xmlRpcPrefix="xmlrpc/xrLocStor.php"
ls_storage_xmlRpcPrefix="xmlrpc/xrLocStor.php"
ls_dbserver=$dbserver ls_dbserver=$dbserver
ls_dbuser=$dbuser ls_dbuser=$dbuser
ls_dbpassword=$dbpassword ls_dbpassword=$dbpassword
ls_database=$database ls_database=$database
ls_scheduler_host=$hostname
ls_scheduler_port=$scheduler_port
ls_scheduler_urlPrefix=
ls_scheduler_xmlRpcPrefix=RC2
ls_output_alsa_device=$output_alsa_device
postgres_user=postgres postgres_user=postgres
install_bin=$installdir/bin install_bin=$installdir/bin
install_etc=$installdir/etc install_etc=$installdir/etc
install_lib=$installdir/lib install_lib=$installdir/lib
install_tmp=$installdir/tmp
install_usr=$installdir/usr install_usr=$installdir/usr
install_var=$installdir/var install_var_ls=$install_var/LiveSupport
install_varls=$install_var/LiveSupport
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -299,7 +238,7 @@ if [ -f $pg_config_dir/$pg_config_file ] ; then
mv -f $pg_config_dir/$pg_config_file $pg_config_dir/$pg_config_file_saved ; mv -f $pg_config_dir/$pg_config_file $pg_config_dir/$pg_config_file_saved ;
fi fi
cp $install_etc/$pg_config_file $pg_config_dir/$pg_config_file cp $install_etc/$pg_config_file $pg_config_dir/$pg_config_file
chown root:postgres $pg_config_dir/$pg_config_file chown root:$postgres_user $pg_config_dir/$pg_config_file
/etc/init.d/postgresql restart /etc/init.d/postgresql restart
@ -327,7 +266,7 @@ else
echo "remote database $ls_dbserver."; echo "remote database $ls_dbserver.";
echo "Make sure to create database user $ls_dbuser with password"; echo "Make sure to create database user $ls_dbuser with password";
echo "$ls_dbpassword on database server at $ls_dbserver."; echo "$ls_dbpassword on database server at $ls_dbserver.";
echo "Also create a database called $ld_database, owned by this user."; echo "Also create a database called $ls_database, owned by this user.";
echo ""; echo "";
echo "The easiest way to achieve this is by issuing the following SQL"; echo "The easiest way to achieve this is by issuing the following SQL";
echo "commands to PostgreSQL:"; echo "commands to PostgreSQL:";
@ -373,31 +312,31 @@ $install_usr/lib/pear/bin/install.sh -d $installdir || exit 1;
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
echo "Setting up directory permissions..." echo "Setting up directory permissions..."
chgrp $apache_group $install_varls/archiveServer/var/stor chgrp $apache_group $install_var_ls/archiveServer/var/stor
chgrp $apache_group $install_varls/archiveServer/var/access chgrp $apache_group $install_var_ls/archiveServer/var/access
chgrp $apache_group $install_varls/archiveServer/var/trans chgrp $apache_group $install_var_ls/archiveServer/var/trans
chgrp $apache_group $install_varls/archiveServer/var/stor/buffer chgrp $apache_group $install_var_ls/archiveServer/var/stor/buffer
chmod g+sw $install_varls/archiveServer/var/stor chmod g+sw $install_var_ls/archiveServer/var/stor
chmod g+sw $install_varls/archiveServer/var/access chmod g+sw $install_var_ls/archiveServer/var/access
chmod g+sw $install_varls/archiveServer/var/trans chmod g+sw $install_var_ls/archiveServer/var/trans
chmod g+sw $install_varls/archiveServer/var/stor/buffer chmod g+sw $install_var_ls/archiveServer/var/stor/buffer
chgrp $apache_group $install_varls/storageServer/var/stor chgrp $apache_group $install_var_ls/storageServer/var/stor
chgrp $apache_group $install_varls/storageServer/var/access chgrp $apache_group $install_var_ls/storageServer/var/access
chgrp $apache_group $install_varls/storageServer/var/trans chgrp $apache_group $install_var_ls/storageServer/var/trans
chgrp $apache_group $install_varls/storageServer/var/stor/buffer chgrp $apache_group $install_var_ls/storageServer/var/stor/buffer
chmod g+sw $install_varls/storageServer/var/stor chmod g+sw $install_var_ls/storageServer/var/stor
chmod g+sw $install_varls/storageServer/var/access chmod g+sw $install_var_ls/storageServer/var/access
chmod g+sw $install_varls/storageServer/var/trans chmod g+sw $install_var_ls/storageServer/var/trans
chmod g+sw $install_varls/storageServer/var/stor/buffer chmod g+sw $install_var_ls/storageServer/var/stor/buffer
chgrp $apache_group $install_varls/htmlUI/var/templates_c chgrp $apache_group $install_var_ls/htmlUI/var/templates_c
chgrp $apache_group $install_varls/htmlUI/var/html/img chgrp $apache_group $install_var_ls/htmlUI/var/html/img
chmod g+sw $install_varls/htmlUI/var/templates_c chmod g+sw $install_var_ls/htmlUI/var/templates_c
chmod g+sw $install_varls/htmlUI/var/html/img chmod g+sw $install_var_ls/htmlUI/var/html/img
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Configuring Apache # Configuring Apache
@ -454,7 +393,7 @@ echo "Creating symlinks...";
# create symlink for the PHP pages in apache's document root # create symlink for the PHP pages in apache's document root
rm -f $www_root/livesupport rm -f $www_root/livesupport
ln -s $install_varls $www_root/livesupport ln -s $install_var_ls $www_root/livesupport
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -463,7 +402,7 @@ ln -s $install_varls $www_root/livesupport
echo "Initializing database..."; echo "Initializing database...";
# create PHP-related database tables # create PHP-related database tables
cd $install_varls/storageServer/var/install cd $install_var_ls/storageServer/var/install
php -q install.php || exit 1; php -q install.php || exit 1;
cd - cd -

View file

@ -18,8 +18,6 @@ set -e
# #
installdir=/opt/livesupport installdir=/opt/livesupport
apache_group=www-data
apache_docroot=/var/www
case "$1" in case "$1" in
configure) configure)
@ -27,9 +25,7 @@ case "$1" in
cp -f $installdir/etc/odbcinst_debian_template \ cp -f $installdir/etc/odbcinst_debian_template \
$installdir/etc/odbcinst_template $installdir/etc/odbcinst_template
# do post-installation configuration # do post-installation configuration
$installdir/bin/postInstallStation.sh --directory $installdir \ $installdir/bin/postInstallStation.sh --directory $installdir
--apache-group $apache_group \
--www-root $apache_docroot
# register and start the livesupport scheduler daemon # register and start the livesupport scheduler daemon
cp -f $installdir/bin/livesupport-station /etc/init.d cp -f $installdir/bin/livesupport-station /etc/init.d