#! /bin/bash -e #Source debconf library . /usr/share/debconf/confmodule #check if this is run because of abort #if [ "$1" != "abort-upgrade" ]&&[ "$1" != "abort-remove" ]&&[ "$1" != "abort-deconfigure" ]; then if [ "$1" = "configure" ]; then db_input critical red5-openmeetings/mysqladmin || true db_input critical red5-openmeetings/mysqladminpass || true db_input critical red5-openmeetings/mysqlsvr || true db_input critical red5-openmeetings/mysqlusr || true db_input critical red5-openmeetings/mysqlpwd || true db_input critical red5-openmeetings/dbname || true db_input critical red5-openmeetings/userrun || true db_input critical red5-openmeetings/grouprun || true db_go db_get red5-openmeetings/mysqladmin MYSQL_ADMIN=$RET db_get red5-openmeetings/mysqladminpass MYSQL_ADMIN_PASS=$RET db_get red5-openmeetings/mysqlusr MYSQL_USER=$RET db_get red5-openmeetings/mysqlpwd MYSQL_PASS=$RET db_get red5-openmeetings/dbname MYSQL_DATABASE=$RET db_get red5-openmeetings/userrun RUN_USER=$RET db_get red5-openmeetings/grouprun RUN_GROUP=$RET MYSQL_RESULT=`mysql -u$MYSQL_ADMIN -p$MYSQL_ADMIN_PASS -e "create database $MYSQL_DATABASE default character set utf8;" 2>/dev/null 1>/dev/null`$?||true if [ $MYSQL_RESULT -ne 0 ]; then echo "Could not create the database $MYSQL_DATABASE, perhaps the administrator (root) name or password was wrong" echo "Please create the database mannually with the following information" echo "Database = $MYSQL_DATABASE" fi MYSQL_RESULT=`mysql -u$MYSQL_ADMIN -p$MYSQL_ADMIN_PASS -e "grant all privileges on $MYSQL_DATABASE.* to '$MYSQL_USER'@'localhost' identified by '$MYSQL_PASS';" 2>/dev/null 1>/dev/null`$?||true if [ $MYSQL_RESULT -ne 0 ]; then echo "Could not create the database user $MYSQL_USER, perhaps the administrator (root) name or password was wrong" echo "Please create the database user mannually with the following information" echo "Database user= $MYSQL_USER" echo "Database users password = $MYSQL_PASS" fi sed -i 's|RUN_USER=.*$|RUN_USER='$RUN_USER'|' /etc/red5-openmeetings/red5-openmeetings.conf sed -i 's|RUN_USER=.*$|RUN_USER='$RUN_USER'|' /etc/red5-openmeetings/red5-openmeetings-oo.conf sed -i 's|RUN_GROUP=.*$|RUN_GROUP='$RUN_GROUP'|' /etc/red5-openmeetings/red5-openmeetings.conf sed -i 's|RUN_GROUP=.*$|RUN_GROUP='$RUN_GROUP'|' /etc/red5-openmeetings/red5-openmeetings-oo.conf chown -R $RUN_USER:$RUN_GROUP /usr/share/red5-openmeetings sed -i -r 's|jdbc:mysql:\/\/[^\/]*?\/|jdbc:mysql:\/\/'$MYSQL_SERVER'\/|' /usr/share/red5-openmeetings/webapps/openmeetings/conf/hibernate.cfg.xml sed -i -r 's|:\/\/'$MYSQL_SERVER'\/[^\?]*?\?|:\/\/'$MYSQL_SERVER'\/'$MYSQL_DATABASE'\?|' /usr/share/red5-openmeetings/webapps/openmeetings/conf/hibernate.cfg.xml sed -i -r 's|connection.username\">[^<]*?<|connection.username\">'$MYSQL_USER'<|' /usr/share/red5-openmeetings/webapps/openmeetings/conf/hibernate.cfg.xml sed -i -r 's|connection.password\">[^<]*?<|connection.password\">'$MYSQL_PASS'<|' /usr/share/red5-openmeetings/webapps/openmeetings/conf/hibernate.cfg.xml touch /usr/share/red5-openmeetings/postinst.done update-rc.d red5-openmeetings-oo defaults update-rc.d red5-openmeetings defaults echo "Openmeetings was successfully configured." echo "Please start with the command: \"/etc/init.d/red5-openmeetings start\" " echo "And then go to http://:5080/openmeetings/install to complete the installation process" else echo $1 echo "Reconfiguration is not supported yet. Please reinstall the software." fi