Added extra error checking in bbb-conf

This commit is contained in:
Sebastian 2010-06-30 15:28:54 -04:00
parent 3c8333f8c1
commit bffd3a60f5

View File

@ -30,7 +30,7 @@
# 2010-03-02 JRT Added trunk checkout options / fixed bbb-apps instructions
# 2010-04-02 FFD Updated for 0.64
# 2010-06-21 SEB Cleaned up some code / Updated for 0.70
# 2010-06-25 SEB Added ability to change the security salt
# 2010-06-30 SEB Added some extra errorchecking
#set -x
@ -38,7 +38,7 @@
# This ensures that we checkout the 0.63 release of BigBlueButton
# Note that this can be overridden with the --trunk option
#
RELEASE="-r 4130"
RELEASE="-r 4126"
#
# SVNPROTO is http if read-only, or https if you specify a Google code username
@ -67,7 +67,7 @@ PLATFORM=$(get_platform)
is_redhat() {
if [ "$PLATFORM" == "redhat" ]; then
echo "yes"
ECHO "Yes"
fi
}
@ -135,7 +135,7 @@ need_root() {
}
usage() {
echo "BigBlueButton Server Utility - Version 0.70"
echo "BigBlueButton Server Utility - Version 0.64"
echo
echo "$0 [options]"
echo
@ -143,7 +143,6 @@ usage() {
echo " --version Display BigBlueButton version (packages)"
echo " --setip <host> Set IP/hostname for BigBlueButton"
echo " --conference [konference|meetme] Switch conference module in Asterisk"
echo " --salt <salt> Change the security salt in bigbluebutton.properties"
echo
echo "Monitoring:"
echo " --check Check configuration files and processes for problems"
@ -158,10 +157,11 @@ usage() {
if [ "$(is_vm)" ]; then
echo "Development:"
echo " --setup-samba Setup samba share for development (VM only)"
echo " --checkout Checkout BigBlueButton from github "
echo " --setup-dev [client|web|apps] Setup development environment "
echo " --setup-dev [bbb-web|bbb-client|bbb-apps] "
echo " --reset-dev Reset environment back to using packages"
echo " --trunk Checkout trunk instead of last release"
echo " --svn-username [user] Your Google code username if you want to "
echo " commit from the checked out code"
fi
echo
}
@ -186,11 +186,6 @@ change_var_value () {
check_and_backup $1
sed -i "s<^[[:blank:]#]*\(${2}\).*<\1=\"${3}\"<" $1
}
# same as change_var_value but without quotes
change_var_salt() {
check_and_backup $1
sed -i "s<^[[:blank:]#]*\(${2}\).*<\1="${3}"<" $1
}
# comment lines matching $2 ($1 is the file)
comment () {
check_and_backup $1
@ -300,13 +295,6 @@ while [ $# -gt 0 ]; do
continue
fi
if [ "$1" = "--checkout" -o "$1" = "-checkout" ]; then
echo "# Request to checkout BigBlueButton"
CHECKOUT="1"
shift; shift
continue
fi
#
# all other parameters requires at least 1 argument
#
@ -332,17 +320,27 @@ while [ $# -gt 0 ]; do
continue
fi
if [ "$1" = "--svn-username" -o "$1" = "-svn-username" ]; then
SVNUSERNAME="--username ${2}"
SVNPROTO="https"
shift; shift
continue
fi
if [ "$1" = "--trunk" -o "$1" = "-trunk" ]; then
# replace the value for for RELEASE because we don't want
# a particular release
RELEASE=""
shift
continue
fi
if [ "$1" = "--conference" -o "$1" = "-conference" ]; then
CONFERENCE="${2}"
shift; shift
continue
fi
if [ "$1" = "--salt" -o "$1" = "-salt" ]; then
SALT="${2}"
shift; shift
continue
fi
usage
exit 1
@ -369,13 +367,6 @@ fi
# Setup samba
#
if [ $SALT ]; then
need_root
# echo $SALT;
change_var_salt /var/lib/$TOMCAT/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties beans.dynamicConferenceService.securitySalt $SALT
echo "Changed the security salt to $SALT";
fi
if [ $SAMBA ]; then
check_root
@ -427,83 +418,36 @@ fi
# Setup the development environemnt.
#
if [ $CHECKOUT ]; then
check_root
# This is a step towards setting up a development environment on a non-BigBlueButton VM
which git
if [ $? != 0 ]; then
echo "# Installing git and ant"
sudo apt-get install git ant -y --force-yes
fi
BBBSRCGIT="~/dev/source/bigbluebutton"
if [ -d $BBBSRCGIT ]; then
echo "# "
echo "**** ERROR: ${BBBSRCGIT} exists. ***"
echo "**** ERROR: You have already checked-out bigbluebutton. Please delete ${BBBSRCGIT} and try again. ***"
echo "# "
exit 1
fi
if [ ! -d ~/dev ]; then
echo "# Creating dev directory"
mkdir ~/dev
fi
echo "# Changing to the dev directory"
cd ~/dev
if [ ! -d ~/dev/source ]; then
echo "# Creating source directory"
mkdir ~/dev/source
fi
echo "# Changing to the dev directory"
cd ~/dev/source
echo "# "
echo "# Checking out READ-ONLY code from github."
echo "# "
echo "# "
git clone git://github.com/bigbluebutton/bigbluebutton.git
echo "# "
echo "# "
echo "# Checked out READ-ONLY code from github. "
echo "# "
echo " You can now run 'bbb-conf --setup-dev [client|web|apps]' to setup dev environment "
echo "# "
fi
if [ $SETUPDEV ]; then
check_root
if [ ! -d ~/dev/source/bigbluebutton ]; then
echo "# "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
# This is a step towards setting up a development environment on a non-BigBlueButton VM
which svn
if [ $? != 0 ]; then
sudo apt-get install subversion ant -y --force-yes
fi
if [ $SETUPDEV == "web" ]; then
BBBWEBHOME=~/dev/source/bigbluebutton/bigbluebutton-web
if [ ! -d $BBBWEBHOME ]; then
echo "# "
echo "*** ERROR: Cannot find ${BBBWEBHOME} "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
if [ ! -d ~/dev ]; then
mkdir ~/dev
fi
if [ $SETUPDEV == "bbb-web" ]; then
if [ ! -d ~/dev/bbb-web ]; then
echo "# Setting up ~/dev/bbb-web"
echo " svn checkout ${SVNPROTO}://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-web bbb-web ${RELEASE} ${SVNUSERNAME}"
cd ~/dev
svn checkout ${SVNPROTO}://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-web bbb-web $RELEASE $SVNUSERNAME
IP=$(ifconfig | grep -v '127.0.0.1' | grep -m 1 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
echo "# Copying the bigbluebutton.properites in /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties to ~/.grails/bigbluebutton-config.properties"
mkdir -p ~/.grails
cp /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties ~/.grails/bigbluebutton-config.properties
echo "# Copying the bbb_api_conf.jsp into /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties to ${BBBWEBHOME}/web-app/demo"
cp /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp ${BBBWEBHOME}/web-app/demo
echo "# Copying the bbb_api_conf.jsp into /var/lib/${TOMCAT}/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties to ~/dev/bbb-web/web-app/demo"
cp /var/lib/${TOMCAT}/webapps/bigbluebutton/demo/bbb_api_conf.jsp ~/dev/bbb-web/web-app/demo
echo "# Enabling $USER to write to /var/bigbluebutton to upload slides"
sudo chmod -R ugo+rwx /var/bigbluebutton
@ -511,90 +455,87 @@ if [ $SETUPDEV ]; then
echo "# Enabling $USER to write to /var/log/bigbluebutton to write log files"
sudo chmod -R ugo+rwx /var/log/bigbluebutton
echo "# Copying bbb-common-message-0.64.jar into ${BBBWEBHOME}/lib"
echo "# Copying bbb-common-message-0.64.jar into ~/dev/bbb-web/lib"
if [ -f $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.64.jar ]; then
cp /usr/share/red5/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.64.jar ${BBBWEBHOME}/lib
cp /usr/share/red5/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.64.jar ~/dev/bbb-web/lib
fi
echo "
# Done. To run your local build of bbb-web:
sudo /etc/init.d/${TOMCAT} stop
cd ${BBBWEBHOME}
cd ~/dev/bbb-web
ant
"
fi
if [ $SETUPDEV == "client" ]; then
BBBCLIENTHOME=~/dev/source/bigbluebutton/bigbluebutton-client
if [ ! -d $BBBCLIENTHOME ]; then
echo "# "
echo "*** ERROR: Cannot find ${BBBCLIENTHOME} "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
fi
if [ $SETUPDEV == "bbb-client" ]; then
if [ ! -d ~/dev/bbb-client ]; then
echo "# Setting up ~/dev/bbb-client"
echo " svn checkout ${SVNPROTO}://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-client bbb-client ${RELEASE} ${SVNUSERNAME}"
cd ~/dev
svn checkout ${SVNPROTO}://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-client bbb-client $RELEASE $SVNUSERNAME
#
# Setup the directories so we can point /etc/nginx/sites-available/bigbluebutton to this
# local copy of the client
#
if [ ! -d $BBBCLIENTHOME/bin ]; then
mkdir -p $BBBCLIENTHOME/bin
if [ ! -d ~/dev/bbb-client/bin ]; then
mkdir -p ~/dev/bbb-client/bin
fi
if [ ! -d $BBBCLIENTHOME/conf ]; then
mkdir -p $BBBCLIENTHOME/bin/conf
if [ ! -d ~/dev/bbb-client/bin/conf ]; then
mkdir -p ~/dev/bbb-client/bin/conf
fi
if [ ! -h $BBBCLIENTHOME/client ]; then
ln -s $BBBCLIENTHOME/bin $BBBCLIENTHOME/client
if [ ! -h ~/dev/bbb-client/client ]; then
ln -s ~/dev/bbb-client/bin ~/dev/bbb-client/client
fi
echo "Modifying /etc/nginx/sites-available/bigbluebutton to point to your local copy of bbb-client"
sudo sed -i "s/\/var\/www\/bigbluebutton;/\/home\/firstuser\/dev\/source\/bigbluebutton\/bigbluebutton-client;/g" \
sudo sed -i "s/\/var\/www\/bigbluebutton;/\/home\/firstuser\/dev\/bbb-client;/g" \
/etc/nginx/sites-available/bigbluebutton
sudo /etc/init.d/nginx restart
echo "# Copying /var/www/bigbluebutton/client/conf/config.xml to ${BBBCLIENTHOME}/bin/conf/config.xml"
cp /var/www/bigbluebutton/client/conf/config.xml $BBBCLIENTHOME/bin/conf/config.xml
echo "# Copying /var/www/bigbluebutton/client/conf/config.xml to ~/dev/bbb-client/bin/conf/config.xml"
cp /var/www/bigbluebutton/client/conf/config.xml ~/dev/bbb-client/bin/conf/config.xml
cd $BBBCLIENTHOME
cd bbb-client
echo "
# Done. To build your local build of bbb-client:
cd ${BBBCLIENTHOME}
cd ~/dev/bbb-client
ant
# The nginx server now loads the BigBlueButton Flash client from
# ${BBBCLIENTHOME}.
# /home/firstuser/dev/bbb-client.
"
fi
if [ $SETUPDEV == "apps" ]; then
BBBAPPSHOME=~/dev/source/bigbluebutton/bigbluebutton-apps
if [ ! -d $BBBAPPSHOME ]; then
echo "# "
echo "*** ERROR: Cannot find ${BBBAPPSHOME} "
echo "*** ERROR: You haven't checked-out BigBlueButton source yet. Please run 'bbb-conf --checkout' first. "
echo "# "
exit 1
fi
if [ $SETUPDEV == "bbb-apps" ]; then
if [ ! -d ~/dev/bbb-apps ]; then
echo "# Setting up ~/dev/bbb-apps:"
echo " svn checkout ${SVNPROTO}://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-apps bbb-apps ${RELEASE} ${SVNUSERNAME}"
cd ~/dev
svn checkout ${SVNPROTO}://bigbluebutton.googlecode.com/svn/trunk/bigbluebutton-apps bbb-apps $RELEASE $SVNUSERNAME
echo "# Checking if ~/dev/repo/bbb-common-message-0.64.jar is present"
if [ ! -f ~/dev/repo/bbb-common-message-0.64.jar ]; then
echo "# Copying bbb-common-message-0.64.jar into ${BBBAPPSHOME}"
echo "# Copying bbb-common-message-0.64.jar into ~/dev/repo/"
if [ -f $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.64.jar ]; then
if [ ! -d ~/dev/repo ]; then
mkdir -p ~/dev/repo
fi
cp /usr/share/red5/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.64.jar ~/dev/repo/
else
echo "# $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/lib/bbb-common-message-0.64.jar does NOT exist!"
fi
fi
fi
#
# We're going to make it easier to deploy by giving write access to others to
@ -625,7 +566,7 @@ red5.home = $RED5_DIRECTORY
# Done. To run your local build of bbb-apps:
sudo /etc/init.d/red5 stop
cd ${BBBAPPSHOME}
cd ~/dev/bbb-apps
gradle war deploy
cd $RED5_DIRECTORY
sudo -u red5 ./red5.sh
@ -743,6 +684,29 @@ $RED5_DIRECTORY/webapps/sip/WEB-INF/bigbluebutton-sip.properties"
fi
done
LOGG_FILES="$RED5_DIRECTORY/log/sip.log \
$RED5_DIRECTORY/log/video.log \
$RED5_DIRECTORY/log/bigbluebutton.log \
$RED5_DIRECTORY/log/deskshare.log"
for file in $LOGG_FILES ; do
if [ -a $file ]; then
if cat $file | tail -n1 | grep -q "Starting up context"; then
echo "BigBlueButton did not start up correctly"
fi
else
echo "File" $file "not found"
fi
done
# check if sip.log has warnings where the user is not registered
if cat /usr/share/red5/log/sip.log | tail -n1 | grep -q "Call request for default but not registered"; then
echo "The User is not registered in SIP. Audio might not be working correctly."
fi
#
# Check that tomcat6 started properly and has created log files
#
@ -1060,18 +1024,18 @@ if [ $CONFERENCE ]; then
#
# update /etc/asterisk/bbb_extensions.conf
sudo sed -i "s/^exten => _XXXX.,n,Konference(\${EXTEN},H)/; exten => _XXXX.,n,Konference(\${EXTEN},H)/g" \
sudo sed -i "s/^exten => _XXXX.,n,Konference(\${EXTEN},H)/# exten => _XXXX.,n,Konference(\${EXTEN},H)/g" \
/etc/asterisk/bbb_extensions.conf
sudo sed -i "s/;[ ]*exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/g" \
sudo sed -i "s/#[ ]*exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/g" \
/etc/asterisk/bbb_extensions.conf
#
# update /etc/asterisk/bbb_extensions.conf
sudo sed -i "s/; exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
sudo sed -i "s/# exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
/etc/asterisk/bbb_extensions.conf
sudo sed -i "s/^exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/; exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
sudo sed -i "s/^exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/# exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
/etc/asterisk/bbb_extensions.conf
fi
@ -1084,17 +1048,17 @@ if [ $CONFERENCE ]; then
#
# update /etc/asterisk/bbb_extensions.conf
sudo sed -i "s/;[ ]*exten => _XXXX.,n,Konference(\${EXTEN},H)/exten => _XXXX.,n,Konference(\${EXTEN},H)/g" \
sudo sed -i "s/#[ ]*exten => _XXXX.,n,Konference(\${EXTEN},H)/exten => _XXXX.,n,Konference(\${EXTEN},H)/g" \
/etc/asterisk/bbb_extensions.conf
sudo sed -i "s/^exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/; exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/g" \
sudo sed -i "s/^exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/# exten => _XXXX.,n,MeetMe(\${EXTEN},cdMsT)/g" \
/etc/asterisk/bbb_extensions.conf
sudo sed -i "s/^exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/; exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
sudo sed -i "s/^exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/# exten => _XXXX.,n,MeetMe(\${CONFERENCE_FOUND},cdMsT)/g" \
/etc/asterisk/bbb_extensions.conf
sudo sed -i "s/; exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
sudo sed -i "s/# exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/exten => _XXXX.,n,Konference(\${CONFERENCE_FOUND},H)/g" \
/etc/asterisk/bbb_extensions.conf
fi