bbb-conf now supports redhat as well as ubuntu

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@3687 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Islam El-Ashi 2010-02-08 21:22:16 +00:00
parent bee9f0838c
commit 271a52b009

View File

@ -36,9 +36,51 @@
# #
RELEASE="-r 3489" RELEASE="-r 3489"
get_platform() {
x=$(cat /proc/version | grep "Red Hat")
if [ "$x" != "" ]; then
echo "redhat"
else
echo "ubuntu"
fi
}
PLATFORM=$(get_platform)
is_redhat() {
if [ "$PLATFORM" == "redhat" ]; then
echo "yes"
fi
}
is_ubuntu() {
if [ "$PLATFORM" == "ubuntu" ]; then
echo "yes"
fi
}
is_vm() {
if [ -f /home/firstuser/.profile ]; then
echo $(cat /home/firstuser/.profile | grep BigBlueButton)
fi
}
if [ $(is_redhat) ]; then
RED5_DIRECTORY="/opt/red5"
ACTIVEMQ_DIRECTORY="/opt/activemq"
TOMCAT6_LOGS="/var/log/tomcat6"
else
if [ $(is_ubuntu) ]; then
RED5_DIRECTORY="/usr/share/red5"
ACTIVEMQ_DIRECTORY="/usr/share/activemq"
TOMCAT6_LOGS="/var/lib/tomcat6/logs"
fi
fi
print_header() { print_header() {
if [ ! $HEADER ]; then if [ ! $HEADER ]; then
echo echo
echo "** Potential Problems **" echo "** Potential Problems **"
HEADER=1 HEADER=1
fi fi
@ -73,9 +115,11 @@ usage() {
echo " --check Check current settings" echo " --check Check current settings"
echo " --conference [konference|meetme] Switch conference module in Asterisk" echo " --conference [konference|meetme] Switch conference module in Asterisk"
echo " --debug Check the log files for errors" echo " --debug Check the log files for errors"
echo " --setup-samba Setup samba share for development (VM only)" if [ $(is_vm) ]; then
echo " --setup-dev [bbb-web|bbb-client|bbb-apps] " echo " --setup-samba Setup samba share for development (VM only)"
echo " --reset-dev Reset environment back to using packages" echo " --setup-dev [bbb-web|bbb-client|bbb-apps] "
echo " --reset-dev Reset environment back to using packages"
fi
echo " --watch Watch log files for error messages every 2 seconds" echo " --watch Watch log files for error messages every 2 seconds"
echo " --zip Zip up log files for reporting an error" echo " --zip Zip up log files for reporting an error"
echo echo
@ -217,10 +261,14 @@ done
# Version # Version
# #
if [ $VERSION ]; then if [ $VERSION ]; then
if [ $(is_redhat) ]; then
echo echo "$(yum list installed | grep bbb-conf)"
dpkg -l | grep bbb else
if [ $(is_ubuntu) ]; then
echo
dpkg -l | grep bbb
fi
fi
exit 0 exit 0
fi fi
@ -387,9 +435,9 @@ if [ $SETUPDEV ]; then
# #
# We're going to make it easier to deploy by giving write access to others to # We're going to make it easier to deploy by giving write access to others to
# /usr/share/red5/webapps # $RED5_DIRECTORY/webapps
# #
sudo chmod o+w /usr/share/red5/webapps sudo chmod o+w $RED5_DIRECTORY/webapps
# #
# Let's remove the existing bbb-apps # Let's remove the existing bbb-apps
@ -402,7 +450,7 @@ if [ $SETUPDEV ]; then
echo "# echo "#
# Override the default properties for bbb-apps # Override the default properties for bbb-apps
# #
red5.home = /usr/share/red5 red5.home = $RED5_DIRECTORY
" > ~/.bbb-apps-build.properties " > ~/.bbb-apps-build.properties
fi fi
@ -416,11 +464,11 @@ red5.home = /usr/share/red5
sudo /etc/init.d/red5 stop sudo /etc/init.d/red5 stop
cd ~/dev/bbb-apps cd ~/dev/bbb-apps
ant deploy ant deploy
sudo -u red5 /usr/share/red5/red5.sh sudo -u red5 $RED5_DIRECTORY/red5.sh
# To restore the packaged version of bbb-apps: # To restore the packaged version of bbb-apps:
rm -rf /usr/share/red5/webapps/bigbluebutton rm -rf $RED5_DIRECTORY/webapps/bigbluebutton
sudo apt-get install bbb-apps sudo apt-get install bbb-apps
sudo /etc/init.d/red5 start sudo /etc/init.d/red5 start
" "
@ -445,8 +493,7 @@ check_state() {
# #
# Check for potential problems # Check for potential problems
# #
if ! ps aux | grep "$ACTIVEMQ_DIRECTORY" > /dev/null; then
if ! ps aux | grep '[/]usr/share/activemq' > /dev/null; then
print_header print_header
echo " activeMQ: -- not running --" echo " activeMQ: -- not running --"
fi fi
@ -489,15 +536,15 @@ check_state() {
DIRECTORIES="bigbluebutton sip video" DIRECTORIES="bigbluebutton sip video"
for dir in $DIRECTORIES ; do for dir in $DIRECTORIES ; do
if [ ! -d /usr/share/red5/webapps/$dir ]; then if [ ! -d $RED5_DIRECTORY/webapps/$dir ]; then
echo " missing red5 app: /usr/share/red5/webapps/$dir " echo " missing red5 app: $RED5_DIRECTORY/webapps/$dir "
fi fi
done done
RED5_LOG_FILES="bigbluebutton oflademo red5 sip video" RED5_LOG_FILES="bigbluebutton red5 sip video"
for file in $RED5_LOG_FILES ; do for file in $RED5_LOG_FILES ; do
if [ ! -f /usr/share/red5/log/$file.log ]; then if [ ! -f $RED5_DIRECTORY/log/$file.log ]; then
echo " missing red5 log: /usr/share/red5/log/$file.demo" echo " missing red5 log: $RED5_DIRECTORY/log/$file.demo"
fi fi
done done
@ -514,9 +561,9 @@ check_state() {
# #
# Look for properties with no values set # Look for properties with no values set
# #
CONFIG_FILES="/usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties \ CONFIG_FILES="$RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties \
/var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties \ /var/lib/tomcat6/webapps/bigbluebutton/WEB-INF/classes/bigbluebutton.properties \
/usr/share/red5/webapps/sip/WEB-INF/bigbluebutton-sip.properties" $RED5_DIRECTORY/webapps/sip/WEB-INF/bigbluebutton-sip.properties"
for file in $CONFIG_FILES ; do for file in $CONFIG_FILES ; do
if grep -q "^[^=]*=[ ]*$" $file; then if grep -q "^[^=]*=[ ]*$" $file; then
@ -527,16 +574,16 @@ check_state() {
# #
# Check that tomcat6 started properly and has created log files # Check that tomcat6 started properly and has created log files
# #
if [ -z "$(ls -A /var/lib/tomcat6/logs)" ]; then if [ -z "$(ls -A $TOMCAT6_LOGS)" ]; then
echo " empty directory: /var/lib/tomcat6/logs contains no logs" echo " empty directory: $TOMCAT6_LOGS contains no logs"
fi fi
# #
# Check that bigbluebutton in red5 has started propertly # Check that bigbluebutton in red5 has started propertly
# #
BIGBLUEBUTTON_RED5_LOG=$(stat -c%s /usr/share/red5/log/bigbluebutton.log) BIGBLUEBUTTON_RED5_LOG=$(stat -c%s $RED5_DIRECTORY/log/bigbluebutton.log)
if [ $BIGBLUEBUTTON_RED5_LOG -lt 100 ]; then if [ $BIGBLUEBUTTON_RED5_LOG -lt 100 ]; then
echo " bigbluebutton failed to start: /usr/share/red5/log/bigbluebutton.log (red5)" echo " bigbluebutton failed to start: $RED5_DIRECTORY/log/bigbluebutton.log (red5)"
fi fi
HOST_IP=$(ifconfig | grep -v '127.0.0.1' | grep -m 1 'inet addr:' | cut -d: -f2 | awk '{ print $1}') HOST_IP=$(ifconfig | grep -v '127.0.0.1' | grep -m 1 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
@ -593,7 +640,7 @@ if [ $CHECK ]; then
fi fi
if ps aux | grep '[/]usr/sbin/asterisk' > /dev/null; then if ps aux | grep '[/]usr/sbin/asterisk' > /dev/null; then
CONFERENCING_MODULE=$(cat /usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties | sed -n '/asterisk.application/{s/.*=[ ]*//g;p}') CONFERENCING_MODULE=$(cat $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties | sed -n '/asterisk.application/{s/.*=[ ]*//g;p}')
echo echo
echo "/etc/asterisk/bbb_extensions.conf (asterisk)" echo "/etc/asterisk/bbb_extensions.conf (asterisk)"
echo " conference module: $CONFERENCING_MODULE" echo " conference module: $CONFERENCING_MODULE"
@ -620,8 +667,8 @@ if [ $ZIP ]; then
touch /tmp/empty touch /tmp/empty
tar cf /tmp/$LOG_FILE.tar /tmp/empty > /dev/null 2>&1 tar cf /tmp/$LOG_FILE.tar /tmp/empty > /dev/null 2>&1
tar rf /tmp/$LOG_FILE.tar /usr/share/red5/log > /dev/null 2>&1 tar rf /tmp/$LOG_FILE.tar $RED5_DIRECTORY/log > /dev/null 2>&1
tar rf /tmp/$LOG_FILE.tar /var/lib/tomcat6/logs > /dev/null 2>&1 tar rf /tmp/$LOG_FILE.tar $TOMCAT6_LOGS > /dev/null 2>&1
tar rf /tmp/$LOG_FILE.tar /var/log/bigbluebutton/* > /dev/null 2>&1 tar rf /tmp/$LOG_FILE.tar /var/log/bigbluebutton/* > /dev/null 2>&1
tar rf /tmp/$LOG_FILE.tar /var/log/nginx/error.log > /dev/null 2>&1 tar rf /tmp/$LOG_FILE.tar /var/log/nginx/error.log > /dev/null 2>&1
tar rf /tmp/$LOG_FILE.tar /var/log/syslog > /dev/null 2>&1 tar rf /tmp/$LOG_FILE.tar /var/log/syslog > /dev/null 2>&1
@ -644,18 +691,18 @@ if [ $DEBUG ]; then
# #
rm -rf /tmp/t rm -rf /tmp/t
grep ERROR /usr/share/red5/log/* > /tmp/t grep ERROR $RED5_DIRECTORY/log/* > /tmp/t
if [ -s /tmp/t ]; then if [ -s /tmp/t ]; then
echo " -- ERRORS found in /usr/share/red5/log/* -- " echo " -- ERRORS found in $RED5_DIRECTORY/log/* -- "
cat /tmp/t cat /tmp/t
echo echo
fi fi
rm -rf /tmp/t rm -rf /tmp/t
grep Exception /usr/share/red5/log/* > /tmp/t grep Exception $RED5_DIRECTORY/log/* > /tmp/t
if [ -s /tmp/t ]; then if [ -s /tmp/t ]; then
echo " -- Exceptions found in /usr/share/red5/log/* -- " echo " -- Exceptions found in $RED5_DIRECTORY/log/* -- "
cat /tmp/t cat /tmp/t
echo echo
fi fi
@ -669,9 +716,9 @@ if [ $DEBUG ]; then
fi fi
rm -rf /tmp/t rm -rf /tmp/t
sudo grep Exception /var/lib/tomcat6/logs/* > /tmp/t sudo grep Exception $TOMCAT6_LOGS/* > /tmp/t
if [ -s /tmp/t ]; then if [ -s /tmp/t ]; then
echo " -- Exceptions found in /var/lib/tomcat6/logs/ -- " echo " -- Exceptions found in $TOMCAT6_LOGS/ -- "
cat /tmp/t cat /tmp/t
echo echo
fi fi
@ -799,8 +846,8 @@ fi
if [ $CONFERENCE ]; then if [ $CONFERENCE ]; then
need_root need_root
if [ ! -f /usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml ]; then if [ ! -f $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml ]; then
echo "Error: Unable to find /usr/share/red5/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml" echo "Error: Unable to find $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bbb-voice-app.xml"
exit 1 exit 1
fi fi
@ -816,15 +863,16 @@ if [ $CONFERENCE ]; then
CONFERENCE=app_konference CONFERENCE=app_konference
else else
echo "Error: Valid options for --conference are: meetme, konference" echo "Error: Valid options for --conference are: meetme, konference"
exit 1
fi fi
fi fi
if [ $CONFERENCE = "meetme" ]; then if [ $CONFERENCE = "meetme" ]; then
# #
# update /usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties # update $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
# #
sudo sed -i "s/asterisk.application[ ]*=.*/asterisk.application=meetme/g" \ sudo sed -i "s/asterisk.application[ ]*=.*/asterisk.application=meetme/g" \
/usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
# #
# update /etc/asterisk/bbb_extensions.conf # update /etc/asterisk/bbb_extensions.conf
@ -845,10 +893,10 @@ if [ $CONFERENCE ]; then
if [ $CONFERENCE = "app_konference" ]; then if [ $CONFERENCE = "app_konference" ]; then
# #
# update /usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties # update $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
# #
sudo sed -i "s/asterisk.application[ ]*=.*/asterisk.application=konference/g" \ sudo sed -i "s/asterisk.application[ ]*=.*/asterisk.application=konference/g" \
/usr/share/red5/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties $RED5_DIRECTORY/webapps/bigbluebutton/WEB-INF/bigbluebutton.properties
# #
# update /etc/asterisk/bbb_extensions.conf # update /etc/asterisk/bbb_extensions.conf
@ -866,7 +914,7 @@ if [ $CONFERENCE ]; then
/etc/asterisk/bbb_extensions.conf /etc/asterisk/bbb_extensions.conf
fi fi
echo "Swtiching to $CONFERENCE ... " echo "Switching to $CONFERENCE ... "
sudo /etc/init.d/asterisk restart sudo /etc/init.d/asterisk restart
sudo /etc/init.d/red5 restart sudo /etc/init.d/red5 restart
fi fi
@ -891,8 +939,8 @@ if [ $CLEAN ]; then
rm -f /var/log/asterisk/event* rm -f /var/log/asterisk/event*
rm -f /var/log/asterisk/messages* rm -f /var/log/asterisk/messages*
rm -f /var/log/asterisk/queue* rm -f /var/log/asterisk/queue*
rm -rf /usr/share/red5/log/* rm -rf $RED5_DIRECTORY/log/*
rm -rf /var/lib/tomcat6/logs/* rm -rf $TOMCAT6_LOGS/*
rm -rf /var/log/nginx/* rm -rf /var/log/nginx/*
mv /var/log/syslog /tmp/syslog.$$ mv /var/log/syslog /tmp/syslog.$$
echo "" > /var/log/syslog echo "" > /var/log/syslog