upgrade.sh
author Pascal Volk <user@localhost.localdomain.org>
Sun, 16 Sep 2012 17:05:33 +0000
changeset 614 1ec3497a6733
parent 562 b5bb7b34e831
child 680 5365af94a8ec
permissions -rwxr-xr-x
VMM: Moved transport-validation to common.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     1
#!/bin/sh
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     2
#
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
# Upgrade script for the Virtual Mail Manager
102
485d3f7d6981 Removed svn keywords, more POSIX compliant shell scripts
Pascal Volk <neverseen@users.sourceforge.net>
parents: 94
diff changeset
     4
# run: ./upgrade.sh
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
LANG=C
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
PATH=/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
PREFIX=/usr/local
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
     9
264
04fea4d8b900 Use the complete Dovecot version, not only the concatenated major
Pascal Volk <neverseen@users.sourceforge.net>
parents: 167
diff changeset
    10
DOVECOT_VERS=$(dovecot --version | awk '{print $1}')
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
LOCALE_DIR=${PREFIX}/share/locale
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
DOC_DIR=${PREFIX}/share/doc/vmm
102
485d3f7d6981 Removed svn keywords, more POSIX compliant shell scripts
Pascal Volk <neverseen@users.sourceforge.net>
parents: 94
diff changeset
    13
if [ ${PREFIX} = "/usr" ]; then
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    14
    MANDIR=${PREFIX}/share/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    15
else
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    16
    MANDIR=${PREFIX}/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    17
fi
562
b5bb7b34e831 Configure.Dovecot_2: Added configuration documentation for Dovecot_2 >= 2.0.
Pascal Volk <user@localhost.localdomain.org>
parents: 483
diff changeset
    18
DOCS="ChangeLog Configure.Dovecot_2 COPYING INSTALL NEWS README"
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    20
INSTALL_OPTS="-g 0 -o 0 -p"
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    21
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    22
if [ $(id -u) -ne 0 ]; then
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    23
    echo "Run this script as root."
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    24
    exit 1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
fi
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    26
118
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    27
# update config file before installing the new files.
264
04fea4d8b900 Use the complete Dovecot version, not only the concatenated major
Pascal Volk <neverseen@users.sourceforge.net>
parents: 167
diff changeset
    28
./update_config.py ${DOVECOT_VERS:-'1.2.11'}
118
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    29
rv=$?
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    30
if [ $rv -eq 2 ]; then
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    31
	echo "please run the install.sh script"
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    32
	exit 1
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    33
elif [ $rv -eq 3 ]; then
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    34
    echo "please read the upgrade instructions at http://vmm.localdomain.org/"
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    35
    exit 1
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    36
elif [ $rv -ne 0 ]; then
483
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    37
    echo "Sorry, something went wrong. Please file a bug at:"
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    38
    echo "https://bitbucket.org/pvo/vmm/issues"
118
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    39
    exit 1
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    40
fi
cf85d78486ce Rewrote upgrade script and config update script
Pascal Volk <neverseen@users.sourceforge.net>
parents: 104
diff changeset
    41
483
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    42
# remove old CamelCase files
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    43
if [ -f /tmp/vmm_inst_dir ] ; then
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    44
    rm -rf `cat /tmp/vmm_inst_dir`
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    45
    rm -f /tmp/vmm_inst_dir
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    46
fi
fb210a116f18 update_config: Write the old package install dir to a tmp file.
Pascal Volk <user@localhost.localdomain.org>
parents: 264
diff changeset
    47
164
67dc18294de6 *.sh: Added --force option to python setup.py install call.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 159
diff changeset
    48
python setup.py -q install --force --prefix ${PREFIX}
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    49
python setup.py clean --all >/dev/null
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    50
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    51
install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    52
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    53
[ -d ${LOCALE_DIR} ] || mkdir -m 0755 -p ${LOCALE_DIR}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    54
cd po
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    55
for po in $(ls -1 *.po); do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    56
    lang=$(basename ${po} .po)
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    57
    ddir=${LOCALE_DIR}/${lang}/LC_MESSAGES
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    58
    [ -d ${ddir}  ] || mkdir -m 0755 -p ${ddir}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    59
    msgfmt -o ${LOCALE_DIR}/${lang}/LC_MESSAGES/vmm.mo ${po}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    60
done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    61
cd - >/dev/null
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    62
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    63
# install manual pages
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    64
cd man
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    65
[ -d ${MANDIR}/man1 ] || mkdir -m 0755 -p ${MANDIR}/man1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    66
install -m 0644 ${INSTALL_OPTS} man1/vmm.1 ${MANDIR}/man1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    67
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    68
[ -d ${MANDIR}/man5 ] || mkdir -m 0755 -p ${MANDIR}/man5
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    69
install -m 0644 ${INSTALL_OPTS} man5/vmm.cfg.5 ${MANDIR}/man5
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    70
167
bb58aedefa3a update_config.py: adjusted functions stuff to renamed settings.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 164
diff changeset
    71
for l in $(find . -maxdepth 1 -mindepth 1 -type d \! -name man\?)
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    72
do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    73
    for s in man1 man5; do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    74
        [ -d ${MANDIR}/${l}/${s} ] || mkdir -m 0755 -p ${MANDIR}/${l}/${s}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    75
    done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    76
    if [ -f ${l}/man1/vmm.1 ]; then
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    77
        install -m 0644 ${INSTALL_OPTS} ${l}/man1/vmm.1 ${MANDIR}/${l}/man1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    78
    fi
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    79
    if [ -f ${l}/man5/vmm.cfg.5 ]; then
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    80
        install -m 0644 ${INSTALL_OPTS} ${l}/man5/vmm.cfg.5 ${MANDIR}/${l}/man5
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    81
    fi
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    82
done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    83
cd - >/dev/null
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    84
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    85
[ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    86
for DOC in ${DOCS}; do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    87
    install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    88
done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    89
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    90
[ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
159
78b6b06188d3 Moved Postfix PostgreSQL client configuration files into the postfix directory.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 118
diff changeset
    91
install -m 0644 ${INSTALL_OPTS} postfix/pgsql-*.cf ${DOC_DIR}/examples
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    92
install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples
68
7ae95b9938c4 * 'VirtualMailManager/VirtualMailManager.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 39
diff changeset
    93