upgrade.sh
changeset 118 cf85d78486ce
parent 104 c0b5afb89088
child 159 78b6b06188d3
--- a/upgrade.sh	Wed Aug 19 02:28:43 2009 +0000
+++ b/upgrade.sh	Wed Aug 19 09:52:24 2009 +0000
@@ -10,6 +10,7 @@
 PF_CONFDIR=$(postconf -h config_directory)
 PF_GID=$(id -g $(postconf -h mail_owner))
 POSTCONF=$(which postconf)
+DOVECOT_VERS=$(dovecot --version | awk -F . '{print $1 $2}')
 LOCALE_DIR=${PREFIX}/share/locale
 DOC_DIR=${PREFIX}/share/doc/vmm
 if [ ${PREFIX} = "/usr" ]; then
@@ -27,6 +28,21 @@
     exit 1
 fi
 
+# update config file before installing the new files.
+./update_config_0.4.x-0.5.py ${POSTCONF} ${DOVECOT_VERS:-10}
+rv=$?
+if [ $rv -eq 2 ]; then
+	echo "please run the install.sh script"
+	exit 1
+elif [ $rv -eq 3 ]; then
+    echo "please read the upgrade instructions at http://vmm.localdomain.org/"
+    exit 1
+elif [ $rv -ne 0 ]; then
+    echo "Sorry, something went wrong. Please file a bug:"
+    echo "https://sourceforge.net/tracker/?group_id=213727"
+    exit 1
+fi
+
 python setup.py -q install --prefix ${PREFIX}
 python setup.py clean --all >/dev/null
 
@@ -81,6 +97,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
-