# HG changeset patch # User Pascal Volk # Date 1228775006 0 # Node ID 0d303d15549eea69a781294b0690ebc02e8fb470 # Parent bc41dfcef0ad915ccca987b1b381d8c68ab70f2f * 'VirtualMailManager/VirtualMailManager.py' * 'VirtualMailManager/Config.py' - Added support for variable "vmm.cfg" location in /root:/usr/local/etc:/etc * 'man/de/man5/vmm.cfg.5' * 'man/man5/vmm.cfg.5' * 'po/de.po' * 'po/vmm.pot' - updated * 'upgrade.sh' - removed obsolete parts * 'update_config_0.4.x-0.5.py' * 'update_tables_0.4.x-0.5.pgsql' - removed from repository (after release cleanup) diff -r bc41dfcef0ad -r 0d303d15549e VirtualMailManager/Config.py --- a/VirtualMailManager/Config.py Wed Nov 26 23:50:04 2008 +0000 +++ b/VirtualMailManager/Config.py Mon Dec 08 22:23:26 2008 +0000 @@ -96,6 +96,8 @@ def check(self): if not self.__chkSections(): errmsg = StringIO() + errmsg.write(_("Using configuration file: %s\n") %\ + self.__cfgFileName) for k,v in self.__missing.items(): if v[0] is True: errmsg.write(_(u"missing section: %s\n") % k) @@ -129,6 +131,7 @@ except ValueError: self.set('config', 'done', 'False') self.__changes = True + print _(u"Using configuration file: %s\n" % self.__cfgFileName) for s in sections: if s != 'config': print _(u'* Config section: »%s«') % s diff -r bc41dfcef0ad -r 0d303d15549e VirtualMailManager/VirtualMailManager.py --- a/VirtualMailManager/VirtualMailManager.py Wed Nov 26 23:50:04 2008 +0000 +++ b/VirtualMailManager/VirtualMailManager.py Mon Dec 08 22:23:26 2008 +0000 @@ -46,7 +46,7 @@ """Creates a new VirtualMailManager instance. Throws a VMMNotRootException if your uid is greater 0. """ - self.__cfgFileName = '/usr/local/etc/vmm.cfg' + self.__cfgFileName = '' self.__permWarnMsg = _(u"fix permissions for »%(cfgFileName)s«\n\ `chmod 0600 %(cfgFileName)s` would be great.") % {'cfgFileName': self.__cfgFileName} @@ -67,11 +67,19 @@ if not sys.argv[1] in ['cf', 'configure']: self.__chkenv() + def __findCfgFile(self): + for path in ['/root', '/usr/local/etc', '/etc']: + if os.path.isfile(path+'/vmm.cfg'): + self.__cfgFileName = path+'/vmm.cfg' + break + if not len(self.__cfgFileName): + raise VMMException( + _(u"No »vmm.cfg« found in: /root:/usr/local/etc:/etc"), + ERR.CONF_NOFILE) + def __chkCfgFile(self): """Checks the configuration file, returns bool""" - if not os.path.isfile(self.__cfgFileName): - raise VMMException(_(u"The file »%s« does not exists.") % - self.__cfgFileName, ERR.CONF_NOFILE) + self.__findCfgFile() fstat = os.stat(self.__cfgFileName) fmode = int(oct(fstat.st_mode & 0777)) if fmode % 100 and fstat.st_uid != fstat.st_gid \ diff -r bc41dfcef0ad -r 0d303d15549e man/de/man5/vmm.cfg.5 --- a/man/de/man5/vmm.cfg.5 Wed Nov 26 23:50:04 2008 +0000 +++ b/man/de/man5/vmm.cfg.5 Mon Dec 08 22:23:26 2008 +0000 @@ -1,12 +1,11 @@ .\" $Id$ -.TH vmm.cfg 5 "15 Sep 2008" "Pascal Volk" +.TH vmm.cfg 5 "08 Dez 2008" "Pascal Volk" .SH NAME vmm.cfg \- Konfigurationsdatei für vmm .SH SYNOPSIS -/usr/local/etc/vmm.cfg +vmm.cfg .SH BESCHREIBUNG -\fBvmm\fR(1) liest Konfigurationsparameter aus der Datei -\fI/usr/local/etc/vmm.cfg\fP. +\fBvmm\fR(1) liest Konfigurationsparameter aus der Datei \fIvmm.cfg\fP. .br Die Konfigurationsdatei ist in mehrere Abschnitte unterteilt. Jeder Abschnitt wird mit dem, in eckigen Klammern '[' und ']' eingefassten, Namen des Abschnitts @@ -38,7 +37,25 @@ .I String eine Folge von Buchstaben und Zahlen. .br -Zum Beispiel: '\fBWort\fP', '\fBHallo Welt\fP', oder '\fB/usr/bin/strings\fP' +Zum Beispiel: '\fBWort\fP', '\fBHallo Welt\fP', oder '\fB/usr/bin/strings\fP' +.SS SUCH REIHENFOLGE +Standardmäßig sucht vmm die \fIvmm.cfg\fP in folgenden Verzeichnissen, in dieser +Reihenfolge: +.RS +.PD 0 +.TP +.I +/root +.TP +.I +/usr/local/etc +.TP +.I +/etc +.PD +.RE +.PP +Die zuerst gefundene Datei wird verwendet. .\" ----- .SH DATABASE ABSCHNITT Der \fBdatabase\fP-Abschnitt wird verwendet, um die für den Datenbankzugriff @@ -237,7 +254,7 @@ done = true .\" ----- .SH DATEIEN -/usr/local/etc/vmm.cfg +vmm.cfg .SH SIEHE AUCH vmm(1), Programm für die Kommandozeile, um E-Mail-Domains, -Konten und -Aliase zu verwalten. diff -r bc41dfcef0ad -r 0d303d15549e man/man5/vmm.cfg.5 --- a/man/man5/vmm.cfg.5 Wed Nov 26 23:50:04 2008 +0000 +++ b/man/man5/vmm.cfg.5 Mon Dec 08 22:23:26 2008 +0000 @@ -1,11 +1,11 @@ .\" $Id$ -.TH vmm.cfg 5 "15 Sep 2008" "Pascal Volk" +.TH vmm.cfg 5 "08 Dec 2008" "Pascal Volk" .SH NAME vmm.cfg \- configuration file for vmm .SH SYNOPSIS -/usr/local/etc/vmm.cfg +vmm.cfg .SH DESCRIPTION -\fBvmm\fR(1) reads configuration data from \fI/usr/local/etc/vmm.cfg\fP. +\fBvmm\fR(1) reads configuration data from \fIvmm.cfg\fP. .br The configuration file is split in multiple sections. A section starts with the section name, enclosed in square brackets '[' and ']' (e.g. \fB[database]\fP), @@ -33,6 +33,24 @@ .I String a sequence of characters and numbers. For example '\fBword\fP', '\fBhello world\fP', or '\fB/usr/bin/strings\fP' +.SS SEARCH ORDER +By default vmm looks for \fIvmm.cfg\fP in the following directories in the +order listed: +.RS +.PD 0 +.TP +.I +/root +.TP +.I +/usr/local/etc +.TP +.I +/etc +.PD +.RE +.PP +The first match it finds will be used. .\" ----- .SH DATABASE SECTION The \fBdatabase\fP section is used to specify some options required to @@ -220,7 +238,7 @@ done = true .\" ----- .SH FILES -/usr/local/etc/vmm.cfg +vmm.cfg .SH SEE ALSO vmm(1), command line tool to manage email domains/accounts/aliases .SH AUTHOR diff -r bc41dfcef0ad -r 0d303d15549e po/de.po --- a/po/de.po Wed Nov 26 23:50:04 2008 +0000 +++ b/po/de.po Mon Dec 08 22:23:26 2008 +0000 @@ -6,8 +6,8 @@ msgstr "" "Project-Id-Version: vmm 0.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-05 05:20+0200\n" -"PO-Revision-Date: 2008-10-05 05:23+0200\n" +"POT-Creation-Date: 2008-12-08 19:24+0100\n" +"PO-Revision-Date: 2008-12-08 19:39+0100\n" "Last-Translator: Pascal Volk \n" "Language-Team: German\n" "MIME-Version: 1.0\n" @@ -147,22 +147,27 @@ msgstr "" "Die Alias-Domain »%(alias)s« ist bereits der Domain »%(domain)s« zugeordnet." -#: VirtualMailManager/Config.py:101 +#: VirtualMailManager/Config.py:99 VirtualMailManager/Config.py:134 +#, python-format +msgid "Using configuration file: %s\n" +msgstr "Verwende Konfigurationsdatei: %s\n" + +#: VirtualMailManager/Config.py:103 #, python-format msgid "missing section: %s\n" msgstr "Fehlender Abschnitt: %s\n" -#: VirtualMailManager/Config.py:103 +#: VirtualMailManager/Config.py:105 #, python-format msgid "missing options in section %s:\n" msgstr "Fehlende Optionen im Abschnitt %s:\n" -#: VirtualMailManager/Config.py:134 +#: VirtualMailManager/Config.py:137 #, python-format msgid "* Config section: »%s«" msgstr "* Konfigurations Abschnitt: »%s«" -#: VirtualMailManager/Config.py:137 +#: VirtualMailManager/Config.py:140 #, python-format msgid "Enter new value for option %(opt)s [%(val)s]: " msgstr "Neuer Wert für Option %(opt)s [%(val)s]: " @@ -282,12 +287,11 @@ "Sie sind nicht root.\n" "\tAuf Wiedersehen.\n" -#: VirtualMailManager/VirtualMailManager.py:73 -#, python-format -msgid "The file »%s« does not exists." -msgstr "Die Datei »%s« existiert nicht." +#: VirtualMailManager/VirtualMailManager.py:77 +msgid "No »vmm.cfg« found in: /root:/usr/local/etc:/etc" +msgstr "Keine »vmm.cfg gefunden in: /root:/usr/local/etc:/etc«" -#: VirtualMailManager/VirtualMailManager.py:92 +#: VirtualMailManager/VirtualMailManager.py:100 #, python-format msgid "" "»%s« is not a directory.\n" @@ -296,7 +300,7 @@ "»%s« ist kein Verzeichnis.\n" "(vmm.cfg: Abschnitt \"domdir\", Option \"base\")" -#: VirtualMailManager/VirtualMailManager.py:97 +#: VirtualMailManager/VirtualMailManager.py:105 #, python-format msgid "" "»%(binary)s« doesn't exists.\n" @@ -305,7 +309,7 @@ "»%(binary)s« existiert nicht.\n" "(vmm.cfg: Abschnitt \"bin\", Option \"%(option)s\")" -#: VirtualMailManager/VirtualMailManager.py:101 +#: VirtualMailManager/VirtualMailManager.py:109 #, python-format msgid "" "»%(binary)s« is not executable.\n" @@ -314,54 +318,54 @@ "»%(binary)s« ist nicht ausführbar.\n" "(vmm.cfg: Abschnitt \"bin\", Option \"%(option)s\")" -#: VirtualMailManager/VirtualMailManager.py:158 +#: VirtualMailManager/VirtualMailManager.py:166 msgid "The domain name is too long." msgstr "Der Domain-Name ist zu lang." -#: VirtualMailManager/VirtualMailManager.py:161 +#: VirtualMailManager/VirtualMailManager.py:169 #, python-format msgid "The domain name »%s« is invalid." msgstr "Der Domain-Name »%s« ist ungültig." -#: VirtualMailManager/VirtualMailManager.py:201 +#: VirtualMailManager/VirtualMailManager.py:209 msgid "Enter new password: " msgstr "Neues Passwort eingeben: " -#: VirtualMailManager/VirtualMailManager.py:202 +#: VirtualMailManager/VirtualMailManager.py:210 msgid "Retype new password: " msgstr "Neues Passwort wiederholen: " -#: VirtualMailManager/VirtualMailManager.py:204 +#: VirtualMailManager/VirtualMailManager.py:212 msgid "Sorry, passwords do not match" msgstr "Entschuldigung, die Passwörter stimmen nicht überein" -#: VirtualMailManager/VirtualMailManager.py:208 +#: VirtualMailManager/VirtualMailManager.py:216 msgid "Sorry, empty passwords are not permitted" msgstr "Entschuldigung, leere Passwörter sind nicht zulässig" -#: VirtualMailManager/VirtualMailManager.py:256 -#: VirtualMailManager/VirtualMailManager.py:343 +#: VirtualMailManager/VirtualMailManager.py:264 +#: VirtualMailManager/VirtualMailManager.py:351 #, python-format msgid "No such directory: %s" msgstr "Verzeichnis nicht gefunden: %s" -#: VirtualMailManager/VirtualMailManager.py:331 +#: VirtualMailManager/VirtualMailManager.py:339 msgid "Found \"..\" in home directory path." msgstr "\"..\" im Pfad zum Benutzerverzeichnis entdeckt." -#: VirtualMailManager/VirtualMailManager.py:339 +#: VirtualMailManager/VirtualMailManager.py:347 msgid "Owner/group mismatch in home directory detected." msgstr "Benutzerverzeichnis gehört dem/der falschen Benutzer/Gruppe." -#: VirtualMailManager/VirtualMailManager.py:354 +#: VirtualMailManager/VirtualMailManager.py:362 msgid "FATAL: \"..\" in domain directory path detected." msgstr "FATAL: \"..\" im Pfad zum Domain-Verzeichnis entdeckt." -#: VirtualMailManager/VirtualMailManager.py:360 +#: VirtualMailManager/VirtualMailManager.py:368 msgid "FATAL: group mismatch in domain directory detected" msgstr "FATAL: Domain-Verzeichnis gehört der falschen Gruppe" -#: VirtualMailManager/VirtualMailManager.py:447 +#: VirtualMailManager/VirtualMailManager.py:455 #, python-format msgid "" "Configurtion error: \"%s\"\n" @@ -370,25 +374,25 @@ "Konfigurations Fehler: \"%s\"\n" "(im Abschnitt \"connfig\", Option \"done\") Siehe auch: vmm.cfg(5)\n" -#: VirtualMailManager/VirtualMailManager.py:467 +#: VirtualMailManager/VirtualMailManager.py:475 #, python-format msgid "Invalid section: '%s'" msgstr "Ungültiger Abschnitt: '%s'" -#: VirtualMailManager/VirtualMailManager.py:477 +#: VirtualMailManager/VirtualMailManager.py:485 #, python-format msgid "Invalid argument: '%s'" msgstr "Ungültiges Argument: '%s'" -#: VirtualMailManager/VirtualMailManager.py:487 -#: VirtualMailManager/VirtualMailManager.py:506 -#: VirtualMailManager/VirtualMailManager.py:614 -#: VirtualMailManager/VirtualMailManager.py:645 +#: VirtualMailManager/VirtualMailManager.py:495 +#: VirtualMailManager/VirtualMailManager.py:514 +#: VirtualMailManager/VirtualMailManager.py:622 +#: VirtualMailManager/VirtualMailManager.py:653 #, python-format msgid "Invalid argument: »%s«" msgstr "Ungültiges Argument: »%s«" -#: VirtualMailManager/VirtualMailManager.py:510 +#: VirtualMailManager/VirtualMailManager.py:518 msgid "" "The keyword »detailed« is deprecated and will be removed in a future " "release.\n" @@ -398,17 +402,17 @@ " Version entfernt werden.\n" " Verwenden Sie bitte das Schlüsselwort »full«, um alle Details zu erhalten." -#: VirtualMailManager/VirtualMailManager.py:584 +#: VirtualMailManager/VirtualMailManager.py:592 #, python-format msgid "The pattern »%s« contains invalid characters." msgstr "Das Muster »%s« enthält ungültige Zeichen." -#: VirtualMailManager/VirtualMailManager.py:609 +#: VirtualMailManager/VirtualMailManager.py:617 #, python-format msgid "The destination account/alias »%s« doesn't exists yet." msgstr "Der Ziel-Account/-Alias »%s« existiert noch nicht." -#: VirtualMailManager/VirtualMailManager.py:626 +#: VirtualMailManager/VirtualMailManager.py:634 #, python-format msgid "" "The account has been successfully deleted from the database.\n" @@ -421,7 +425,7 @@ " »%(directory)s«\n" " Grund: %(raeson)s" -#: VirtualMailManager/VirtualMailManager.py:666 +#: VirtualMailManager/VirtualMailManager.py:674 msgid "Account doesn't exists" msgstr "Der Account existiert nicht" @@ -613,3 +617,4 @@ #: vmm:492 msgid "Ouch" msgstr "Autsch" + diff -r bc41dfcef0ad -r 0d303d15549e po/vmm.pot --- a/po/vmm.pot Wed Nov 26 23:50:04 2008 +0000 +++ b/po/vmm.pot Mon Dec 08 22:23:26 2008 +0000 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: vmm 0.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-05 05:20+0200\n" +"POT-Creation-Date: 2008-12-08 19:36+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -143,22 +143,27 @@ "The alias domain »%(alias)s« is already assigned to the domain »%(domain)s«." msgstr "" -#: VirtualMailManager/Config.py:101 +#: VirtualMailManager/Config.py:99 VirtualMailManager/Config.py:134 #, python-format -msgid "missing section: %s\n" +msgid "Using configuration file: %s\n" msgstr "" #: VirtualMailManager/Config.py:103 #, python-format +msgid "missing section: %s\n" +msgstr "" + +#: VirtualMailManager/Config.py:105 +#, python-format msgid "missing options in section %s:\n" msgstr "" -#: VirtualMailManager/Config.py:134 +#: VirtualMailManager/Config.py:137 #, python-format msgid "* Config section: »%s«" msgstr "" -#: VirtualMailManager/Config.py:137 +#: VirtualMailManager/Config.py:140 #, python-format msgid "Enter new value for option %(opt)s [%(val)s]: " msgstr "" @@ -272,122 +277,121 @@ "\tGood bye!\n" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:73 -#, python-format -msgid "The file »%s« does not exists." +#: VirtualMailManager/VirtualMailManager.py:77 +msgid "No »vmm.cfg« found in: /root:/usr/local/etc:/etc" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:92 +#: VirtualMailManager/VirtualMailManager.py:100 #, python-format msgid "" "»%s« is not a directory.\n" "(vmm.cfg: section \"domdir\", option \"base\")" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:97 +#: VirtualMailManager/VirtualMailManager.py:105 #, python-format msgid "" "»%(binary)s« doesn't exists.\n" "(vmm.cfg: section \"bin\", option \"%(option)s\")" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:101 +#: VirtualMailManager/VirtualMailManager.py:109 #, python-format msgid "" "»%(binary)s« is not executable.\n" "(vmm.cfg: section \"bin\", option \"%(option)s\")" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:158 +#: VirtualMailManager/VirtualMailManager.py:166 msgid "The domain name is too long." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:161 +#: VirtualMailManager/VirtualMailManager.py:169 #, python-format msgid "The domain name »%s« is invalid." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:201 +#: VirtualMailManager/VirtualMailManager.py:209 msgid "Enter new password: " msgstr "" -#: VirtualMailManager/VirtualMailManager.py:202 +#: VirtualMailManager/VirtualMailManager.py:210 msgid "Retype new password: " msgstr "" -#: VirtualMailManager/VirtualMailManager.py:204 +#: VirtualMailManager/VirtualMailManager.py:212 msgid "Sorry, passwords do not match" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:208 +#: VirtualMailManager/VirtualMailManager.py:216 msgid "Sorry, empty passwords are not permitted" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:256 -#: VirtualMailManager/VirtualMailManager.py:343 +#: VirtualMailManager/VirtualMailManager.py:264 +#: VirtualMailManager/VirtualMailManager.py:351 #, python-format msgid "No such directory: %s" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:331 +#: VirtualMailManager/VirtualMailManager.py:339 msgid "Found \"..\" in home directory path." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:339 +#: VirtualMailManager/VirtualMailManager.py:347 msgid "Owner/group mismatch in home directory detected." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:354 +#: VirtualMailManager/VirtualMailManager.py:362 msgid "FATAL: \"..\" in domain directory path detected." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:360 +#: VirtualMailManager/VirtualMailManager.py:368 msgid "FATAL: group mismatch in domain directory detected" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:447 +#: VirtualMailManager/VirtualMailManager.py:455 #, python-format msgid "" "Configurtion error: \"%s\"\n" "(in section \"connfig\", option \"done\") see also: vmm.cfg(5)\n" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:467 +#: VirtualMailManager/VirtualMailManager.py:475 #, python-format msgid "Invalid section: '%s'" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:477 +#: VirtualMailManager/VirtualMailManager.py:485 #, python-format msgid "Invalid argument: '%s'" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:487 -#: VirtualMailManager/VirtualMailManager.py:506 -#: VirtualMailManager/VirtualMailManager.py:614 -#: VirtualMailManager/VirtualMailManager.py:645 +#: VirtualMailManager/VirtualMailManager.py:495 +#: VirtualMailManager/VirtualMailManager.py:514 +#: VirtualMailManager/VirtualMailManager.py:622 +#: VirtualMailManager/VirtualMailManager.py:653 #, python-format msgid "Invalid argument: »%s«" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:510 +#: VirtualMailManager/VirtualMailManager.py:518 msgid "" "The keyword »detailed« is deprecated and will be removed in a future " "release.\n" " Please use the keyword »full« to get full details." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:584 +#: VirtualMailManager/VirtualMailManager.py:592 #, python-format msgid "The pattern »%s« contains invalid characters." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:609 +#: VirtualMailManager/VirtualMailManager.py:617 #, python-format msgid "The destination account/alias »%s« doesn't exists yet." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:626 +#: VirtualMailManager/VirtualMailManager.py:634 #, python-format msgid "" "The account has been successfully deleted from the database.\n" @@ -396,7 +400,7 @@ " Reason: %(raeson)s" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:666 +#: VirtualMailManager/VirtualMailManager.py:674 msgid "Account doesn't exists" msgstr "" diff -r bc41dfcef0ad -r 0d303d15549e update_config_0.4.x-0.5.py --- a/update_config_0.4.x-0.5.py Wed Nov 26 23:50:04 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -*- coding: UTF-8 -*- -# Copyright 2008 VEB IT -# See COPYING for distribution information. -# $Id$ - -import sys -from ConfigParser import ConfigParser -from shutil import copy2 - -cf = '/usr/local/etc/vmm.cfg' -fh = file(cf, 'r') -cp = ConfigParser() -cp.readfp(fh) -fh.close() - -if not cp.has_option('maildir', 'name') or not cp.has_option('maildir', - 'folders') or cp.has_option('maildir', 'folder'): - copy2(cf, cf+'.bak_upd_0.4.x-0.5') - fh = file(cf, 'w') - if not cp.has_option('maildir', 'name'): - if cp.has_option('maildir', 'folder'): - cp.set('maildir', 'name', cp.get('maildir', 'folder')) - cp.remove_option('maildir', 'folder') - else: - cp.set('maildir', 'name', 'Maildir') - if not cp.has_option('maildir', 'folders'): - cp.set('maildir', 'folders', 'Drafts:Sent:Templates:Trash') - if cp.has_option('maildir', 'folder'): - cp.remove_option('maildir', 'folder') - cp.write(fh) - fh.close() - -if not cp.has_option('bin', 'postconf'): - fh = file(cf, 'w') - try: - postconf = sys.argv[1].strip() - if len(postconf): - cp.set('bin', 'postconf', postconf) - else: # possible? - cp.set('bin', 'postconf', '/usr/sbin/postconf') - except IndexError: - cp.set('bin', 'postconf', '/usr/sbin/postconf') - cp.write(fh) - fh.close() - print - print "Please have a look at your %s" %cf - print "and verify the value from option 'postconf' in section 'bin'." - print - diff -r bc41dfcef0ad -r 0d303d15549e update_tables_0.4.x-0.5.pgsql --- a/update_tables_0.4.x-0.5.pgsql Wed Nov 26 23:50:04 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ --- $Id$ - -SET client_encoding = 'UTF8'; -SET client_min_messages = warning; - -ALTER SEQUENCE domains_gid RENAME TO domain_gid; - - -CREATE TABLE domain_data ( - gid bigint NOT NULL DEFAULT nextval('domain_gid'), - tid bigint NOT NULL DEFAULT 1, - domaindir varchar(40) NOT NULL, - CONSTRAINT pkey_domain_data PRIMARY KEY (gid), - CONSTRAINT fkey_domain_data_tid_transport FOREIGN KEY (tid) - REFERENCES transport (tid) -); - -CREATE TABLE domain_name ( - domainname varchar(255) NOT NULL, - gid bigint NOT NULL, - is_primary boolean NOT NULL, - CONSTRAINT pkey_domain_name PRIMARY KEY (domainname), - CONSTRAINT fkey_domain_name_gid_domain_data FOREIGN KEY (gid) - REFERENCES domain_data (gid) -); - -INSERT INTO domain_data (gid, tid, domaindir) - SELECT gid, tid, domaindir - FROM domains; - -INSERT INTO domain_name (domainname, gid, is_primary) - SELECT domainname, gid, TRUE - FROM domains; - - -ALTER TABLE users DROP CONSTRAINT pkye_users; -ALTER TABLE users ADD CONSTRAINT pkey_users PRIMARY KEY (local_part, gid); -ALTER TABLE users DROP CONSTRAINT fkey_users_gid_domains; -ALTER TABLE users ADD CONSTRAINT fkey_users_gid_domain_data FOREIGN KEY (gid) - REFERENCES domain_data (gid); - -ALTER TABLE alias DROP CONSTRAINT fkey_alias_gid_domains; -ALTER TABLE alias DROP CONSTRAINT pkey_alias; -ALTER TABLE alias ADD CONSTRAINT fkey_alias_gid_domain_data FOREIGN KEY (gid) - REFERENCES domain_data (gid); - -ALTER TABLE relocated DROP CONSTRAINT fkey_relocated_gid_domains; -ALTER TABLE relocated ADD CONSTRAINT fkey_relocated_gid_domain_data - FOREIGN KEY (gid) REFERENCES domain_data (gid); - - -CREATE OR REPLACE VIEW dovecot_password AS - SELECT local_part || '@' || domain_name.domainname AS "user", - passwd AS "password", smtp, pop3, imap, managesieve - FROM users - LEFT JOIN domain_name USING (gid); - -CREATE OR REPLACE VIEW dovecot_user AS - SELECT local_part || '@' || domain_name.domainname AS userid, - uid, gid, domain_data.domaindir || '/' || uid AS home, - '~/' || maillocation.maillocation AS mail - FROM users - LEFT JOIN domain_data USING (gid) - LEFT JOIN domain_name USING (gid) - LEFT JOIN maillocation USING (mid); - -CREATE OR REPLACE VIEW postfix_gid AS - SELECT gid, domainname - FROM domain_name; - -CREATE OR REPLACE VIEW postfix_uid AS - SELECT local_part || '@' || domain_name.domainname AS address, uid - FROM users - LEFT JOIN domain_name USING (gid); - -CREATE OR REPLACE VIEW postfix_maildir AS - SELECT local_part || '@' || domain_name.domainname AS address, - domain_data.domaindir||'/'||uid||'/'||maillocation.maillocation||'/' - AS maildir - FROM users - LEFT JOIN domain_data USING (gid) - LEFT JOIN domain_name USING (gid) - LEFT JOIN maillocation USING (mid); - -CREATE OR REPLACE VIEW postfix_relocated AS - SELECT address || '@' || domain_name.domainname AS address, destination - FROM relocated - LEFT JOIN domain_name USING (gid); - -DROP VIEW postfix_alias; -DROP VIEW vmm_domain_info; -DROP VIEW vmm_alias_count; - -ALTER TABLE alias ALTER address TYPE varchar(64); -ALTER TABLE alias ADD CONSTRAINT pkey_alias - PRIMARY KEY (gid, address, destination); - -CREATE OR REPLACE VIEW postfix_alias AS - SELECT address || '@' || domain_name.domainname AS address, destination, gid - FROM alias - LEFT JOIN domain_name USING (gid); - -CREATE OR REPLACE VIEW postfix_transport AS - SELECT local_part || '@' || domain_name.domainname AS address, - transport.transport - FROM users - LEFT JOIN transport USING (tid) - LEFT JOIN domain_name USING (gid); - -CREATE OR REPLACE VIEW vmm_domain_info AS - SELECT gid, domainname, transport, domaindir, - count(uid) AS accounts, - (SELECT count(DISTINCT address) - FROM alias - WHERE alias.gid = domain_data.gid) AS aliases, - (SELECT count(gid) - FROM relocated - WHERE relocated.gid = domain_data.gid) AS relocated, - (SELECT count(gid) - FROM domain_name - WHERE domain_name.gid = domain_data.gid - AND NOT domain_name.is_primary) AS aliasdomains - FROM domain_data - LEFT JOIN domain_name USING (gid) - LEFT JOIN transport USING (tid) - LEFT JOIN users USING (gid) - WHERE domain_name.is_primary - GROUP BY gid, domainname, transport, domaindir; - - -DROP TABLE domains; - - -CREATE LANGUAGE plpgsql; - -CREATE OR REPLACE FUNCTION domain_primary_trigger() RETURNS TRIGGER AS $$ -DECLARE - primary_count bigint; -BEGIN - SELECT INTO primary_count count(gid) + NEW.is_primary::integer - FROM domain_name - WHERE domain_name.gid = NEW.gid - AND is_primary; - - IF (primary_count > 1) THEN - RAISE EXCEPTION 'There can only be one domain marked as primary.'; - END IF; - - RETURN NEW; -END; -$$ LANGUAGE plpgsql STABLE; - -DROP TRIGGER IF EXISTS primary_count ON domain_name; -CREATE TRIGGER primary_count_ins BEFORE INSERT ON domain_name - FOR EACH ROW EXECUTE PROCEDURE domain_primary_trigger(); - -CREATE TRIGGER primary_count_upd AFTER UPDATE ON domain_name - FOR EACH ROW EXECUTE PROCEDURE domain_primary_trigger(); diff -r bc41dfcef0ad -r 0d303d15549e upgrade.sh --- a/upgrade.sh Wed Nov 26 23:50:04 2008 +0000 +++ b/upgrade.sh Mon Dec 08 22:23:26 2008 +0000 @@ -10,7 +10,6 @@ PF_CONFDIR=$(postconf -h config_directory) PF_GID=$(id -g $(postconf -h mail_owner)) -POSTCONF=$(which postconf) LOCALE_DIR=${PREFIX}/share/locale DOC_DIR=${PREFIX}/share/doc/vmm if [ ${PREFIX} == "/usr" ]; then @@ -18,7 +17,7 @@ else MANDIR=${PREFIX}/man fi -DOCS="ChangeLog COPYING INSTALL README" +DOCS="ChangeLog COPYING NEWS INSTALL README" INSTALL_OPTS="-g 0 -o 0 -p" INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p" @@ -43,14 +42,6 @@ done cd - >/dev/null -# remove misplaced manual pages -if [ -f /usr/local/share/man/man1/vmm.1 ]; then - rm -f /usr/local/share/man/man1/vmm.1 -fi -if [ -f /usr/local/share/man/man5/vmm.cfg.5 ]; then - rm -f /usr/local/share/man/man5/vmm.cfg.5 -fi - # install manual pages cd man [ -d ${MANDIR}/man1 ] || mkdir -m 0755 -p ${MANDIR}/man1 @@ -82,6 +73,3 @@ install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples -# update config file -./update_config_0.4.x-0.5.py $POSTCONF -