PLC_RT_IP=$( gethostbyname $PLC_RT_HOST )
fi
+function check_rt_password ()
+{
+ if [[ -z "$PLC_RT_DBPASSWORD" || "$PLC_RT_DBPASSWORD" = "None" ]] ; then
+ # NOTE: this provides a simpler string than uuidgen
+ PLC_RT_DBPASSWORD=$( uuidgen | md5sum - | awk '{print $1}' )
+ plc-config --category=plc_rt --variable=dbpassword --value="$PLC_RT_DBPASSWORD" --save=$local_config $local_config
+ service plc reload
+ CREATED="true"
+ fi
+}
+
# NOTE: code duplicated from monitor.functions to allow package to be separate
# from it.
function check_pg_hba ()
# TODO: need a better approach for this.
for f in $PLCRTPATH/conf.d/*.pl ; do
- update_config PLC_RT_HOSTNAME $PLC_RT_HOST $f
+ mkdir -p /etc/rt3/conf.d
+ if [ $f -nt /etc/rt3/conf.d/`basename $f` ] ; then
+ tmp_file=$(mktemp)
+ cp $f $tmp_file
+ update_config PLC_RT_HOSTNAME $PLC_RT_HOST $tmp_file
+
+ cp $tmp_file /etc/rt3/conf.d/`basename $f`
+ rm -f $tmp_file
+ fi
done
# TODO: need a better approach for this.
update_config RT_DB_NAME $RT3_DB_NAME $tmp_siteconfig
update_config RT_DB_USER $RT3_DB_USER $tmp_siteconfig
- update_config RT_DB_PASSWORD $PLC_MONITOR_DBPASSWORD $tmp_siteconfig
+ update_config RT_DB_PASSWORD $PLC_RT_DBPASSWORD $tmp_siteconfig
# setup initialdata
update_config PLC_RT_HOSTNAME $PLC_RT_HOST $tmp_initialdata
USER=$RT3_DB_USER
CONF=$PGDATA/pg_hba.conf.d/${NAME}.conf
PATTERN="host all postgres 127.0.0.1/32 trust"
- PATTERN="host all postgres $PLC_RT_IP/32 trust"
+ if ! grep -q "$PATTERN" $CONF ; then
+ #### SETUP ACCESS from postgres user to run init for the first time.
+ echo "$PATTERN" >> $CONF
+ WROTE_PG_CONFIG="true"
+ fi
+ PATTERN="host all postgres $PLC_RT_IP/32 trust"
if ! grep -q "$PATTERN" $CONF ; then
#### SETUP ACCESS from postgres user to run init for the first time.
echo "$PATTERN" >> $CONF
{
if [ ! -f /etc/rt3/setup.finished ] ; then
/usr/sbin/rt-setup-database --action init --dba postgres
- for f in $PLCRTPATH/conf.d/*.pl ; do
+ for f in /etc/rt3/conf.d/*.pl ; do
/usr/sbin/rt-setup-database --action insert --dba postgres --datafile $f
done
MESSAGE=$"Bootstrap RT (please wait...)"
dialog "$MESSAGE"
+ check_rt_password
check_pg_hba $RT3_DB_NAME $RT3_DB_USER
#check_user_and_db $RT3_DB_NAME $RT3_DB_USER
check_rt_siteconfig
dropuser -U postgres $RT3_DB_USER
rm -f /etc/rt3/RT_SiteConfig.pm
rm -f /etc/rt3/initialdata
+ rm -f /etc/rt3/conf.d/*.pl
rm -f $PGDATA/pg_hba.conf.d/${RT3_DB_NAME}.conf
sed -i -e "s/.*mailgate.*//g" /etc/aliases
fi
if ! grep '<category id="plc_rt">' /etc/planetlab/default_config.xml ; then
- sed -i 's|<category id="plc_net">| <category id="plc_rt">\n <name>RT Configuration</name>\n <description>RT</description>\n <variablelist>\n <variable id="enabled" type="boolean">\n <name>Enabled</name>\n <value>false</value>\n <description>Enable on this machine.</description>\n </variable>\n <variable id="host" type="hostname">\n <name>Hostname</name>\n <value>localhost.localdomain</value>\n <description>The fully qualified hostname.</description>\n </variable>\n <variable id="ip" type="ip">\n <name>IP Address</name>\n <value/>\n <description>The IP address of the RT server.</description>\n </variable>\n <variable id="web_user" type="string">\n <name>username</name>\n <value>root</value>\n <description>The user name for RT access.</description>\n </variable>\n <variable id="web_password" type="password">\n <name>password</name>\n <value>password</value>\n <description>password to the rt user.</description>\n </variable>\n </variablelist>\n </category>\n <category id="plc_net">|' /etc/planetlab/default_config.xml
+ sed -i 's|<category id="plc_net">| <category id="plc_rt">\n <name>RT Configuration</name>\n <description>RT</description>\n <variablelist>\n <variable id="enabled" type="boolean">\n <name>Enabled</name>\n <value>false</value>\n <description>Enable on this machine.</description>\n </variable>\n <variable id="host" type="hostname">\n <name>Hostname</name>\n <value>localhost.localdomain</value>\n <description>The fully qualified hostname.</description>\n </variable>\n <variable id="ip" type="ip">\n <name>IP Address</name>\n <value/>\n <description>The IP address of the RT server.</description>\n </variable>\n <variable id="web_user" type="string">\n <name>username</name>\n <value>root</value>\n <description>The user name for RT access.</description>\n </variable>\n <variable id="web_password" type="password">\n <name>password</name>\n <value>password</value>\n <description>password to the rt user.</description>\n </variable>\n
+<variable id="dbpassword" type="password">\n <name>Database Password</name>\n <value></value>\n <description>Password to use when accessing the RT database.</description>\n </variable>\n </variablelist>\n </category>\n <category id="plc_net">|' /etc/planetlab/default_config.xml
fi
mkdir -p /etc/planetlab/configs
--save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
plc-config --category plc_rt --variable web_password --value password \
--save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
+plc-config --category plc_rt --variable dbpassword --value "" \
+ --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
-
+# NOTE: not sure why these aren't setup by the rt package...
mkdir -p /var/log/rt3
touch /var/log/rt3/rt.log
chown apache.apache /var/log/rt3/rt.log
+cp /usr/share/rt3/html/NoAuth/images/bplogo.gif /var/www/html/misc/logo.gif
+
%changelog
* Sat Jul 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - PLCRT-1.0-3
- renamed getpersons.py to accept a given 'role'