clockwerk-tools – Rev 1

Subversion Repositories:
Rev:
#!/bin/bash
###########################################################################
##  Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3      ##
##  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  ##
##  rights of fair usage, the disclaimer and warranty conditions.        ##
###########################################################################

OPENSIM_PATH=/srv/opensim/
pushd ./
cd $OPENSIM_PATH

dialog --msgbox "This tool will configure the Clockwerk." 10 70

# Set hostname
HOSTNAME=`cat /etc/hostname`
TMP=`date +%s | sha1sum | awk '{ print $1 }'`
dialog --inputbox "The Clockwerk uses IP addresses during its boot cycle. This option allows you to override the IP address with a hostname. If you do have an externally reachable fully-qualified hostname, please enter it here: " 10 70 $HOSTNAME 2> $TMP
if [ $? == "0" ]; then
  cat $TMP > /etc/hostname
fi
rm $TMP 2>/dev/null
# Set Vivox
dialog --yesno "The Clockwerk can be configured to support voice via Vivox (http://support.vivox.com/opensim/). If you wish to configure voice, you need to visit the Vivox website and request a username and a password. if you have received the settings from Vivox, would you like to configure voice now?" 10 70
if [ $? == "0" ]; then
  USERNAME=`cat OpenSim.ini | grep vivox_admin_user | awk -F"[ \t]*[=][ \t]*" '{ print $2 }'`
  if [ ! -z $USERNAME ]; then 
    TMP=`date +%s | sha1sum | awk '{ print $1 }'`
    dialog --inputbox "Please enter your Vivox admin user: " 10 70 $USERNAME 2> $TMP
    if [ $? == "0" ]; then 
      USERNAME=`cat $TMP`
      sed -i "s/vivox_admin_user *=.*/vivox_admin_user = $USERNAME/g" \
              OpenSim.ini;
    fi
    rm $TMP 2>/dev/null
  fi
  PASSWORD=`cat OpenSim.ini | grep vivox_admin_password | awk -F"[ \t]*[=][ \t]*" '{ print $2 }'`
  if [ ! -z $PASSWORD ]; then
    TMP=`date +%s | sha1sum | awk '{ print $1 }'`
    dialog --inputbox "Please enter your Vivox admin passsword: " 10 70 $PASSWORD 2> $TMP
    if [ $? == "0" ]; then
      PASSWORD=`cat $TMP`
      sed -i "s/vivox_admin_password *=.*/vivox_admin_password = $PASSWORD/g" \
              OpenSim.ini;
    fi
    rm $TMP 2>/dev/null
  fi
fi
rm $TMP 2>/dev/null
popd