[28388] in Source-Commits
evolution-wrapper commit: Stop configuring Evolution
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Aug 12 15:36:57 2014
Date: Tue, 12 Aug 2014 15:36:50 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201408121936.s7CJao1P008970@drugstore.mit.edu>
To: source-commits@MIT.EDU
https://github.com/mit-athena/evolution-wrapper/commit/eda61358c978dd2ed03b168695d04355e957d747
commit eda61358c978dd2ed03b168695d04355e957d747
Author: Jonathan Reed <jdreed@mit.edu>
Date: Tue Aug 12 12:44:08 2014 -0400
Stop configuring Evolution
Evolution hasn't supported gconf in a while, and its migration
script behaves poorly, so we should stop supporting it.
Speaking of Evolution behaving poorly, also disable spam
filtering if spamassassin is not installed.
debian/changelog | 6 ++
evolution.debathena | 209 +++++++--------------------------------------------
2 files changed, 34 insertions(+), 181 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 163e0f2..f3105ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+debathena-evolution-wrapper (10.0.15) unstable; urgency=low
+
+ * Give up on Evolution (Trac: #1228)
+
+ -- Jonathan Reed <jdreed@mit.edu> Tue, 12 Aug 2014 12:44:04 -0400
+
debathena-evolution-wrapper (10.0.14) unstable; urgency=low
* Add git-buildpackage configuration
diff --git a/evolution.debathena b/evolution.debathena
index 3688b28..11a1a2d 100755
--- a/evolution.debathena
+++ b/evolution.debathena
@@ -1,181 +1,28 @@
-#!/usr/bin/perl
-
-# Evolution wrapper script for Athena
-
-# Performs the following Evolution customizations:
-# * Ensures $HOME/.evolution is private when created.
-# * Performs Hesiod lookup of user inbox.
-# * Pre-configures Evolution for MIT mail on first invocation.
-
-use strict;
-use Gnome2::GConf;
-use File::Basename;
-use File::Path;
-
-sub edit_state_file();
-sub create_initial_state_file();
-
-# Ensure $HOME/.evolution is private when created.
-my $homedir = $ENV{"HOME"};
-if ($homedir && ! -e "$homedir/.evolution") {
- if (mkdir("$homedir/.evolution")) {
- system("fs sa $homedir/.evolution system:anyuser none 2>/dev/null");
- }
-}
-
-# Pick server to use
-my $user = $ENV{"ATHENA_USER"} || $ENV{"USER"} || getpwuid($<);
-my $server = "$user.mail.mit.edu";
-
-# Determine the authentication method to use for the IMAP server.
-# For a Cyrus PO server account we use GSSAPI.
-# For an Exchange account (or anything else), use password for now.
-# (Ideally some day we will use GSSAPI everywhere).
-my $auth = "";
-my ($real_server) = gethostbyname($server);
-if ($real_server =~ /po\d+\.mail\.mit\.edu/i) {
- $auth = ";auth=GSSAPI";
-}
-
-# Regular expression for the server names we recognize when updating
-# the IMAP account setting. We also convert Athena 9.4-style Hesiod
-# specifications (although it should be unusual to see one due to
-# debathena-gconf2-config).
-my $serverRE = "($user" . '\.mail\.mit\.edu)|(po\d+\.mit\.edu)|((imap\.)?exchange\.mit\.edu)|(_hesiod)';
-my $old_server = "";
-
-my $client = Gnome2::GConf::Client->get_default;
-
-# Set the initial homedir to something other than null
-unless ($client->get("/apps/evolution/shell/file_chooser_folder")) {
- $client->set_string("/apps/evolution/shell/file_chooser_folder",
- "file://" . $homedir);
-}
-
-my $accounts = $client->get_list("/apps/evolution/mail/accounts");
-
-if ($accounts && @$accounts) {
- # Update the server with the value from Hesiod.
- my $change = 0;
- foreach (@$accounts) {
- my $old = $_;
- if (/name="MIT mail"/) {
- # Remember the old server name.
- if (m%imap://$user(?:;[^\@]*)?\@([^/]+)/%i) {
- $old_server = $1;
- }
-
- # Update the server name (and corresponding auth method).
- s%(imap://$user)(\;[^\@]*)?\@($serverRE)%$1$auth\@$server%i;
-
- # Make sure we always use SSL.
- unless (m%imap://[^/]*/[^<]*;use_ssl=always[^<]*%i) {
- # First clear any other SSL setting.
- s%(imap://[^/]*/[^<]*);use_ssl=[^;<]*([^<]*)%$1$2%i;
- s%(imap://[^/]*/)([^<]*)%$1;use_ssl=always$2%i;
- }
- }
- $change = 1 if ($_ ne $old);
- }
-
- if ($change) {
- # We need to update the account settings.
- $client->set_list("/apps/evolution/mail/accounts", "string",
- $accounts);
- if ($old_server ne $server) {
- # Edit the folder state file -- the URI of the saved
- # selected folder may point at the old server.
- edit_state_file();
- }
- }
-} else {
- # Pre-configuration.
- $client->set_string("/apps/evolution/calendar/display/timezone",
- "America/New_York");
-
- ($_, $_, $_, $_, $_, $_, my $gecos) = getpwuid($<);
- my @fields = split(",", $gecos);
- my $name = $fields[0];
- my $home = $ENV{"HOME"};
- my $local = "mbox:$home/.evolution/mail/local";
- my $a = '<?xml version="1.0"?>' . "\n";
- $a .= '<account name="MIT mail" uid="mitinitial" enabled="true">';
- $a .= '<identity>';
- $a .= "<name>$name</name>";
- $a .= "<addr-spec>$user\@mit.edu</addr-spec>";
- $a .= '</identity>';
- $a .= '<source save-passwd="false">';
- $a .= "<url>imap://$user$auth\@$server/;use_ssl=always</url>";
- $a .= '</source>';
- $a .= '<transport save-passwd="false">';
- $a .= "<url>smtp://$user;auth=GSSAPI\@outgoing.mit.edu/;use_ssl=always";
- $a .= '</url>';
- $a .= '</transport>';
- $a .= "<drafts-folder>$local#Drafts</drafts-folder>";
- $a .= "<sent-folder>$local#Sent</sent-folder>";
- $a .= '</account>' . "\n";
- $accounts = [ $a ];
- $client->set_list("/apps/evolution/mail/accounts", "string", $accounts);
- $client->set_string("/apps/evolution/mail/default_account", "mitinitial");
- create_initial_state_file();
-}
-
-exec("/usr/bin/evolution.debathena-orig", @ARGV);
-
-# Edit the existing folder tree state file, to update any URI referring to
-# the old server.
-sub edit_state_file() {
- return unless $old_server;
- my $file = "$homedir/.evolution/mail/config/folder-tree-expand-state.xml";
- open(OLD, "<$file") or return;
- my $newfile = $file . ".debathena-new";
- unless (open(NEW, ">$newfile")) {
- warn "Cannot open $newfile: $!\n";
- close OLD;
- return;
- }
- my $changed = 0;
- # Loop to copy and edit the file, replacing the old IMAP server
- # name with the new.
- while (<OLD>) {
- my $old = $_;
- s%(imap://$user)(;[^\@]*)?\@($old_server)%$1\@$server%i;
- print NEW;
- $changed = 1 if ($_ ne $old);
- }
- close NEW;
- close OLD;
- # If we have changed the file, move the new one into place.
- # Otherwise, just delete the copy.
- if ($changed) {
- unless (rename($newfile, $file)) {
- warn "Cannot rename $newfile to $file: $!\n";
- # Nuke the old file to be safe.
- unlink $file;
- }
- } else {
- unlink $newfile;
- }
-}
-
-# Create the initial folder tree state file, to expand and select the
-# MIT INBOX.
-sub create_initial_state_file() {
- my $file = "$homedir/.evolution/mail/config/folder-tree-expand-state.xml";
-
- mkpath(dirname($file), 0, 0700);
- unless (open(OUT, ">$file")) {
- warn "Cannot open $file: $!\n";
- return;
- }
- print OUT "<?xml version=\"1.0\"?>\n";
- print OUT "<tree-state>\n";
- print OUT " <node name=\"local\" expand=\"true\"/>\n";
- print OUT " <node name=\"vfolder\" expand=\"false\"/>\n";
- print OUT " <node name=\"mitinitial\" expand=\"true\">\n";
- print OUT " <node name=\"INBOX\" expand=\"true\"/>\n";
- print OUT " </node>\n";
- print OUT " <selected uri=\"imap://$user\@$server/INBOX\"/>\n";
- print OUT "</tree-state>\n";
- close OUT;
-}
+#!/bin/sh
+
+flagfile="$HOME/.config/debathena/evolution-desupport"
+
+msgtxt="Due to incompatible upstream changes, Debathena no longer
+automatically configures Evolution to connect to the MIT e-mail
+servers.
+Existing Evolution users are strongly encouraged to migrate to
+Thunderbird or OWA for graphical e-mail. New users are discouraged
+from using Evolution.
+
+Evolution may be removed completely in future releases.
+
+(This message will only be displayed once.)"
+
+if ! [ -e "$flagfile" ]; then
+ zenity --info --no-wrap --title "Evolution De-supported" --text "$msgtxt"
+ mkdir -p "$(dirname "$flagfile")"
+ touch "$flagfile"
+ # Disable junk filtering if spamassassin is not installed, because
+ # Evolution is too incompetent to check for this.
+ if hash gsettings > /dev/null 2>&1 && \
+ ! [ -x /usr/bin/spamassassin ]; then
+ gsettings set org.gnome.evolution.mail junk-check-incoming false
+ fi
+fi
+
+exec evolution.debathena-orig "$@"