upgrade.sh
changeset 38 c44ea4526546
child 39 8dcf739fc97e
equal deleted inserted replaced
37:89f952b0f366 38:c44ea4526546
       
     1 #!/bin/sh
       
     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:/usr/local/sbin:/usr/local/bin
       
     9 PREFIX=/usr/local
       
    10 PF_CONFDIR=$(postconf -h config_directory)
       
    11 PF_GID=$(id -g $(postconf -h mail_owner))
       
    12 LOCALE_DIR=${PREFIX}/share/locale
       
    13 DOC_DIR=${PREFIX}/share/doc/vmm
       
    14 MANDIR=${PREFIX}/share/man
       
    15 DOCS="ChangeLog COPYING INSTALL README"
       
    16 
       
    17 INSTALL_OPTS="-g 0 -o 0 -p"
       
    18 INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p"
       
    19 
       
    20 if [ $(id -u) -ne 0 ]; then
       
    21     echo "Run this script as root."
       
    22     exit 1
       
    23 fi
       
    24 
       
    25 python setup.py install --prefix ${PREFIX}
       
    26 python setup.py clean --all >/dev/null
       
    27 
       
    28 install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
       
    29 
       
    30 [ -d ${LOCALE_DIR} ] || mkdir -m 0755 -p ${LOCALE_DIR}
       
    31 cd po
       
    32 for po in $(ls -1 *.po); do
       
    33     lang=$(basename ${po} .po)
       
    34     ddir=${LOCALE_DIR}/${lang}/LC_MESSAGES
       
    35     [ -d ${ddir}  ] || mkdir -m 0755 -p ${ddir}
       
    36     msgfmt -o ${LOCALE_DIR}/${lang}/LC_MESSAGES/vmm.mo ${po}
       
    37 done
       
    38 cd - >/dev/null
       
    39 
       
    40 cd man
       
    41 [ -d ${MANDIR}/man1 ] || mkdir -m 0755 -p ${MANDIR}/man1
       
    42 install -m 0644 ${INSTALL_OPTS} man1/vmm.1 ${MANDIR}/man1
       
    43 
       
    44 [ -d ${MANDIR}/man5 ] || mkdir -m 0755 -p ${MANDIR}/man5
       
    45 install -m 0644 ${INSTALL_OPTS} man5/vmm.cfg.5 ${MANDIR}/man5
       
    46 
       
    47 for l in $(find . -maxdepth 1 -mindepth 1 -type d \! -name man\? \! -name .svn)
       
    48 do
       
    49     for s in man1 man5; do
       
    50         [ -d ${MANDIR}/${l}/${s} ] || mkdir -m 0755 -p ${MANDIR}/${l}/${s}
       
    51     done
       
    52     if [ -f ${l}/man1/vmm.1 ]; then
       
    53         install -m 0644 ${INSTALL_OPTS} ${l}/man1/vmm.1 ${MANDIR}/${l}/man1
       
    54     fi
       
    55     if [ -f ${l}/man5/vmm.cfg.5 ]; then
       
    56         install -m 0644 ${INSTALL_OPTS} ${l}/man5/vmm.cfg.5 ${MANDIR}/${l}/man5
       
    57     fi
       
    58 done
       
    59 cd - >/dev/null
       
    60 
       
    61 [ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
       
    62 for DOC in ${DOCS}; do
       
    63     install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
       
    64 done
       
    65 
       
    66 [ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
       
    67 install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples
       
    68 install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples