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