install.sh
changeset 31 b7a7e566833c
parent 27 8c5f1eba0ea6
child 32 ceb700bc4a80
equal deleted inserted replaced
30:24d8baf0cd6b 31:b7a7e566833c
     1 #!/bin/bash
     1 #!/bin/sh
     2 # $Id$
     2 # $Id$
     3 #
     3 #
     4 # Installation script for the Virtual Mail Manager
     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=/bin:/usr/sbin:/usr/bin
     8 PATH=/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
     9 INSTALL_OPTS="-g 0 -o 0 -p -v"
       
    10 PREFIX=/usr/local
     9 PREFIX=/usr/local
    11 PF_CONFDIR=$(postconf -h config_directory)
    10 PF_CONFDIR=$(postconf -h config_directory)
    12 PF_GID=$(id -g postfix)
    11 PF_GID=$(id -g $(postconf -h mail_owner))
    13 DOC_DIR=${PREFIX}/share/doc/vmm
    12 DOC_DIR=${PREFIX}/share/doc/vmm
    14 MAN1DIR=${PREFIX}/share/man/man1
    13 MAN1DIR=${PREFIX}/share/man/man1
    15 MAN5DIR=${PREFIX}/share/man/man5
    14 MAN5DIR=${PREFIX}/share/man/man5
    16 DOCS="ChangeLog COPYING INSTALL README"
    15 DOCS="ChangeLog COPYING INSTALL README"
       
    16 
       
    17 case "$(uname -s)" in
       
    18     'OpenBSD' | 'NetBSD')
       
    19         INSTALL_OPTS="-g 0 -o 0 -p"
       
    20         INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p"
       
    21         ;;
       
    22     *)
       
    23         INSTALL_OPTS="-g 0 -o 0 -p -v"
       
    24         INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p -v"
       
    25         ;;
       
    26 esac
    17 
    27 
    18 if [ $(id -u) -ne 0 ]; then
    28 if [ $(id -u) -ne 0 ]; then
    19     echo "Run this script as root."
    29     echo "Run this script as root."
    20     exit 1
    30     exit 1
    21 fi
    31 fi
    22 
    32 
    23 python setup.py install --prefix ${PREFIX}
    33 python setup.py install --prefix ${PREFIX}
    24 python setup.py clean --all >/dev/null
    34 python setup.py clean --all >/dev/null
    25 
    35 
    26 install -b -m 0600 ${INSTALL_OPTS} vmm.cfg ${PREFIX}/etc/
    36 install -b -m 0600 ${INSTALL_OPTS} vmm.cfg ${PREFIX}/etc/
    27 install -b -m 0640 -g ${PF_GID} -o 0 -p -v pgsql-*.cf ${PF_CONFDIR}/
    37 install ${INSTALL_OPTS_CF} pgsql-*.cf ${PF_CONFDIR}/
    28 install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
    38 install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
    29 
    39 
    30 [ -d ${MAN1DIR} ] || mkdir -m 0755 -p ${MAN1DIR}
    40 [ -d ${MAN1DIR} ] || mkdir -m 0755 -p ${MAN1DIR}
    31 install -m 0644 ${INSTALL_OPTS} vmm.1 ${MAN1DIR}
    41 install -m 0644 ${INSTALL_OPTS} vmm.1 ${MAN1DIR}
    32 
    42