upgrade.sh
author Pascal Volk <neverseen@users.sourceforge.net>
Tue, 22 Apr 2008 07:34:02 +0000
changeset 22 576a4709a44f
parent 14 ebc9b864bc9a
permissions -rwxr-xr-x
* 'vmm.1' - extended (not completed yet)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     1
#!/bin/bash
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     2
# $Id$
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
#
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
# Upgrade script for the Virtual Mail Manager
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
# run: ./install.sh
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
LANG=C
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
PATH=/bin:/usr/sbin:/usr/bin
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     9
INSTALL_OPTS="-g 0 -o 0 -p -v"
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    10
PREFIX=/usr/local
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
PF_CONFDIR=$(postconf -h config_directory)
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
CFS="smtpd_sender_login_maps transport virtual_mailbox_domains"
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    13
DOC_DIR=${PREFIX}/share/doc/vmm
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    14
DOCS="ChangeLog COPYING INSTALL README"
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    15
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    16
if [ $(id -u) -ne 0 ]; then
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    17
    echo "Run this script as root."
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    18
    exit 1
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    19
fi
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    20
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    21
python setup.py install --prefix ${PREFIX}
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    22
python setup.py clean --all >/dev/null
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    23
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    24
for CF in ${CFS} ; do
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
    install -b -m 0640 ${INSTALL_OPTS} pgsql-${CF}.cf ${PF_CONFDIR}/
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    26
done
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    27
install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    28
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    29
[ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    30
for DOC in ${DOCS}; do
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    31
    install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    32
done
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    33
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    34
[ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    35
install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    36
install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    37
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    38
./update_tables_0.3.x-0.4.py
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    39
./update_config_0.3.x-0.4.py
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    40
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    41
echo
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    42
echo "Don't forget to check ${PREFIX}/etc/vmm.cfg"
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    43
echo "and modify: ${PF_CONFDIR}/pgsql-*.cf files."
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    44
for CF in ${CFS}; do
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    45
    echo " * ${PF_CONFDIR}/pgsql-${CF}.cf"
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    46
done
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    47
echo