upgrade.sh
changeset 27 8c5f1eba0ea6
parent 26 668951708f2f
child 28 87da30d30fde
equal deleted inserted replaced
26:668951708f2f 27:8c5f1eba0ea6
     1 #!/bin/bash
       
     2 # $Id$
       
     3 #
       
     4 # Upgrade script for the Virtual Mail Manager
       
     5 # run: ./install.sh
       
     6 
       
     7 LANG=C
       
     8 PATH=/bin:/usr/sbin:/usr/bin
       
     9 INSTALL_OPTS="-g 0 -o 0 -p -v"
       
    10 PREFIX=/usr/local
       
    11 PF_CONFDIR=$(postconf -h config_directory)
       
    12 CFS="smtpd_sender_login_maps transport virtual_mailbox_domains"
       
    13 DOC_DIR=${PREFIX}/share/doc/vmm
       
    14 DOCS="ChangeLog COPYING INSTALL README"
       
    15 
       
    16 if [ $(id -u) -ne 0 ]; then
       
    17     echo "Run this script as root."
       
    18     exit 1
       
    19 fi
       
    20 
       
    21 python setup.py install --prefix ${PREFIX}
       
    22 python setup.py clean --all >/dev/null
       
    23 
       
    24 for CF in ${CFS} ; do
       
    25     install -b -m 0640 ${INSTALL_OPTS} pgsql-${CF}.cf ${PF_CONFDIR}/
       
    26 done
       
    27 install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
       
    28 
       
    29 [ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
       
    30 for DOC in ${DOCS}; do
       
    31     install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
       
    32 done
       
    33 
       
    34 [ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
       
    35 install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples
       
    36 install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples
       
    37 
       
    38 ./update_tables_0.3.x-0.4.py
       
    39 ./update_config_0.3.x-0.4.py
       
    40 
       
    41 echo
       
    42 echo "Don't forget to check ${PREFIX}/etc/vmm.cfg"
       
    43 echo "and modify: ${PF_CONFDIR}/pgsql-*.cf files."
       
    44 for CF in ${CFS}; do
       
    45     echo " * ${PF_CONFDIR}/pgsql-${CF}.cf"
       
    46 done
       
    47 echo