VMM/cli/main: Adjusted to new argparse functionality.
======================Upgrading to vmm 0.6.x======================This document describes the procedure to upgrade a vmm-0.5.2 installationto version 0.6.xIf you still have installed vmm-0.4/vmm-0.4-r41 you have to proceed thisstep first: ‣ :doc:`0.4.x-0.5`Upgrading from vmm-0.5.2------------------------Stop Postfix and Dovecot^^^^^^^^^^^^^^^^^^^^^^^^Before updating your database layout you have to stop Postfix and Dovecot...code-block::consoleroot@host:~# /etc/init.d/postfixstopStopping Postfix Mail Transport Agent: postfix.root@host:~# /etc/init.d/dovecotstopStopping IMAP/POP3 mail server: dovecot.Create a database backup^^^^^^^^^^^^^^^^^^^^^^^^It is always wise to back up your database from time to time.Particularly with regard to an impending structure modification.Example: Backing up the `mailsys` database with pg_dump_...code-block::consoleuser@host:~$ pg_dump-hlocalhost-Uvmm-Wmailsys>mailsys-0.5.2.sqlDatabase update^^^^^^^^^^^^^^^Connect as your `vmm` database user to your database...code-block::consoleuser@host:~$ psqlmailsysvmm-W-hlocalhostIn the PostgreSQL interactive terminal you have to run one of the followingcommands to perform the update.Dovecot v1.2.x/v2.0.x/v2.1.x""""""""""""""""""""""""""""..code-block::postgresql-consolemailsys=>\i/path/to/vmm-0.6.1/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsqlmailsys=>\qDovecot v1.0.x/v1.1.x"""""""""""""""""""""..code-block::postgresql-consolemailsys=>\i/path/to/vmm-0.6.1/pgsql/update_tables_0.5.x-0.6.pgsqlmailsys=>\q.._set-database-permissions:Set database permissions^^^^^^^^^^^^^^^^^^^^^^^^..include:: ../pgsql_set_permissionspermissions.rstStart Dovecot and Postfix again^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^..warning:: All the views (*dovecot_…* and *postfix_…*) have been replaced by database functions. So you have to adjust all your ``postfix/pgsql-*.cf`` files and also your``/etc/dovecot/dovecot-sql.conf`` or ``/etc/dovecot/dovecot-sql.conf.ext``. See the `vmm-0.6.1/postfix/pgsql-*.cf` files and:ref:`Dovecot configuration <dovecot-sql-conf-ext>`/`dovecot-sql.conf.ext` or :ref:`Dovecot configuration <dovecot-sql-conf>`/`dovecot-sql-conf`.After a successfully update start Dovecot and Postfix again...code-block::consoleroot@host:~# /etc/init.d/dovecotstartStarting IMAP/POP3 mail server: dovecot.root@host:~# /etc/init.d/postfixstartStarting Postfix Mail Transport Agent: postfix.Upgrade vmm^^^^^^^^^^^Finally execute the :file:`upgrade.sh` script.This will install the new code and also update your :file:`vmm.cfg`...code-block::consoleroot@host:~# cd/path/to/vmm-0.6.1root@host:/path/to/vmm-0.6.1# ./upgrade.shPlease have a look at your configuration: /usr/local/etc/vmm.cfgThis are your Modified/Renamed/New settings:R account.delete_directory = falseR account.directory_mode = 448R account.disk_usage = falseR domain.delete_directory = falseR domain.directory_mode = 504R domain.force_deletion = falseR domain.imap = trueR domain.pop3 = trueR domain.sieve = trueR domain.smtp = trueR domain.transport = dovecot:R mailbox.folders = Drafts:Sent:Templates:TrashR mailbox.root = MaildirR misc.base_directory = /srv/mailM misc.dovecot_version = 2.1.7R misc.dovecot_version = 2.1.7R misc.password_scheme = PLAINRemoved section "config" with option "done" (obsolte)Removed option "gid_mail" from section "misc" (obsolte)Upgrading from vmm-0.6.0------------------------Database fixes^^^^^^^^^^^^^^Due to an error in :ref:`usertransport`'s argument parsing, it is possiblethat some users' transport-ID points to the erroneous transport *domain*.To fix that error in your database, execute the following SQL statement:..code-block::psqlUPDATEusersSETtid=NULLWHEREtid=(SELECTtidFROMtransportWHEREtransport='domain');If you are using Dovecot < v.1.2.0, you have to replace the databasefunction *dovecotpassword()*.The *service_set.ssid* was selected unconditionally.This may cause an empty result, which will make logins impossible.To replace the function execute the following SQL statement:..code-block::psqlCREATEORREPLACEFUNCTIONdovecotpassword(INlocalpartvarchar,INthe_domainvarchar)RETURNSSETOFdovecotpasswordAS$$DECLARErecorddovecotpassword; userid varchar(320) := localpart || '@' || the_domain; BEGIN FOR record IN SELECT userid, passwd, smtp, pop3, imap, managesieve FROM users, service_set, domain_data WHERE users.gid = (SELECT gid FROM domain_name WHERE domainname = the_domain) AND local_part = localpart AND users.gid = domain_data.gid AND CASE WHEN users.ssid IS NOT NULL THEN service_set.ssid = users.ssid ELSE service_set.ssid = domain_data.ssid END LOOP RETURN NEXT record; END LOOP; RETURN; END;$$ LANGUAGE plpgsql STABLERETURNS NULL ON NULL INPUTEXTERNAL SECURITY INVOKER;Upgrade vmm^^^^^^^^^^^Execute the :file:`upgrade.sh`, in order to install the updated code.Upgrade to Dovecot ≧ v1.2.beta2-------------------------------When you are upgrading your old Dovecot (< v.1.2.beta2) to a newer version,≧ v1.2.beta2, you also have to update the database layout.After you have backed up your database, you have to apply the changes fromthe file :file:`dovecot_update_v1.2+.pgsql` to your database.(The file is currently only available from hg:`dovecot_update_v1.2+.pgsql <http://hg.localdomain.org/vmm/raw-file/bb23693e5fc9/pgsql/dovecot_update_v1.2%2B.pgsql>`_)Connect as your `vmm` database user to your database...code-block::consoleuser@host:~$ psqlmailsysvmm-W-hlocalhostThen do the database update:..code-block::postgresql-consolemailsys=>\i/path/to/dovecot_update_v1.2+.pgsqlmailsys=>\qFinally :ref:`set-database-permissions`...include:: ../ext_references.rst