#!/bin/sh # # Copyright (C) 2005 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # # Sets up Evolution for the current user, based on prototype data. # # Extracts username and full name of current user from the passwd database. # # Loads prototype data from /etc/gconf/evolution-gconf-tools/prototype-data.xml # (a boilerplate data for connecting to Exchange servers is provided there) # # FIXME: use $HOSTNAME ? export prefix=/usr/local # The file from which to load configuration data: CONFIGURATION_FILE=${prefix}/etc/gconf/evolution-gconf-tools/configuration # Load the configuration file: source $CONFIGURATION_FILE # The file from which to load the prototype data: EVOLUTION_PROTOTYPE_XML=${prefix}/etc/gconf/evolution-gconf-tools/prototype-data.xml # The file in which to store the results: EVOLUTION_XML_RESULT=`mktemp /tmp/evolution-gconf-data.xml.XXXXXXXXXXXXXX` || exit 1 # FIXME: generalize the server? # Lookup the username # For the case where a username is in the form DOMAIN\USERNAME; extract USERNAME: export PERSONALIZE_USERNAME=`getent passwd "$USER" | cut -d: -f1|awk -F\\\\ '{print $NF}'` || exit 1 GECOS_DATA=`getent passwd "$USER" | cut -d: -f5` # Lookup the user's GECOS name, extracting everything before the first comma: export PERSONALIZE_FULLNAME=`echo $GECOS_DATA | awk -F\\, '{print $1}'` || exit 1 export PERSONALIZE_SERVERNAME=$SERVER_NAME export PERSONALIZE_EMAILDOMAIN=$EMAIL_DOMAIN # Output a summary of the data so far: echo "Generating Evolution configuration data" echo " User name: " $PERSONALIZE_USERNAME echo "User's GECOS data: " $GECOS_DATA echo " User's real name: " $PERSONALIZE_FULLNAME echo " Server name: " $PERSONALIZE_SERVERNAME echo " Email domain: " $PERSONALIZE_EMAILDOMAIN # Personalize the data: { cat $EVOLUTION_PROTOTYPE_XML | evolution-gconf-personalize > $EVOLUTION_XML_RESULT ; } || exit 1 # Load it into GConf, assuming that the daemon is already running: gconftool-2 --load $EVOLUTION_XML_RESULT || exit 1 #cat $EVOLUTION_XML_RESULT | evolution-gconf-log