upgrade.sh
author Pascal Volk <neverseen@users.sourceforge.net>
Tue, 16 Sep 2008 05:55:54 +0000
changeset 86 e43e4e7e9ec0
parent 81 89b71a9abfcf
child 94 0d303d15549e
permissions -rwxr-xr-x
* 'VirtualMailManager/ext/Postconf.py' - Added to repository to read some Postfix settings * 'VirtualMailManager/Config.py' * 'VirtualMailManager/VirtualMailManager.py' * 'man/de/man5/vmm.cfg.5' * 'man/man5/vmm.cfg.5' * 'setup.py' * 'update_config_0.4.x-0.5.py' * 'upgrade.sh' * 'vmm.cfg' - Added postconf stuff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     1
#!/bin/sh
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     2
# $Id$
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
#
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
# Upgrade script for the Virtual Mail Manager
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
# run: ./install.sh
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
LANG=C
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
PATH=/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     9
PREFIX=/usr/local
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    10
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
PF_CONFDIR=$(postconf -h config_directory)
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    12
PF_GID=$(id -g $(postconf -h mail_owner))
86
e43e4e7e9ec0 * 'VirtualMailManager/ext/Postconf.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 81
diff changeset
    13
POSTCONF=$(which postconf)
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    14
LOCALE_DIR=${PREFIX}/share/locale
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    15
DOC_DIR=${PREFIX}/share/doc/vmm
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    16
if [ ${PREFIX} == "/usr" ]; then
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    17
    MANDIR=${PREFIX}/share/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    18
else
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    19
    MANDIR=${PREFIX}/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    20
fi
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    21
DOCS="ChangeLog COPYING INSTALL README"
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    22
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    23
INSTALL_OPTS="-g 0 -o 0 -p"
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    24
INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p"
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    26
if [ $(id -u) -ne 0 ]; then
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    27
    echo "Run this script as root."
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    28
    exit 1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    29
fi
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    30
81
89b71a9abfcf * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 68
diff changeset
    31
python setup.py -q install --prefix ${PREFIX}
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    32
python setup.py clean --all >/dev/null
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    33
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    34
install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    35
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    36
[ -d ${LOCALE_DIR} ] || mkdir -m 0755 -p ${LOCALE_DIR}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    37
cd po
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    38
for po in $(ls -1 *.po); do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    39
    lang=$(basename ${po} .po)
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    40
    ddir=${LOCALE_DIR}/${lang}/LC_MESSAGES
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    41
    [ -d ${ddir}  ] || mkdir -m 0755 -p ${ddir}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    42
    msgfmt -o ${LOCALE_DIR}/${lang}/LC_MESSAGES/vmm.mo ${po}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    43
done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    44
cd - >/dev/null
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    45
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    46
# remove misplaced manual pages
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    47
if [ -f /usr/local/share/man/man1/vmm.1 ]; then
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    48
    rm -f /usr/local/share/man/man1/vmm.1
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    49
fi
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    50
if [ -f /usr/local/share/man/man5/vmm.cfg.5 ]; then
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    51
    rm -f /usr/local/share/man/man5/vmm.cfg.5
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    52
fi
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    53
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 38
diff changeset
    54
# install manual pages
38
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    55
cd man
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    56
[ -d ${MANDIR}/man1 ] || mkdir -m 0755 -p ${MANDIR}/man1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    57
install -m 0644 ${INSTALL_OPTS} man1/vmm.1 ${MANDIR}/man1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    58
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    59
[ -d ${MANDIR}/man5 ] || mkdir -m 0755 -p ${MANDIR}/man5
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    60
install -m 0644 ${INSTALL_OPTS} man5/vmm.cfg.5 ${MANDIR}/man5
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    61
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    62
for l in $(find . -maxdepth 1 -mindepth 1 -type d \! -name man\? \! -name .svn)
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    63
do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    64
    for s in man1 man5; do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    65
        [ -d ${MANDIR}/${l}/${s} ] || mkdir -m 0755 -p ${MANDIR}/${l}/${s}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    66
    done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    67
    if [ -f ${l}/man1/vmm.1 ]; then
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    68
        install -m 0644 ${INSTALL_OPTS} ${l}/man1/vmm.1 ${MANDIR}/${l}/man1
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    69
    fi
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    70
    if [ -f ${l}/man5/vmm.cfg.5 ]; then
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    71
        install -m 0644 ${INSTALL_OPTS} ${l}/man5/vmm.cfg.5 ${MANDIR}/${l}/man5
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    72
    fi
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    73
done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    74
cd - >/dev/null
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    75
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    76
[ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    77
for DOC in ${DOCS}; do
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    78
    install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    79
done
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    80
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    81
[ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    82
install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples
c44ea4526546 * 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    83
install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples
68
7ae95b9938c4 * 'VirtualMailManager/VirtualMailManager.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 39
diff changeset
    84
7ae95b9938c4 * 'VirtualMailManager/VirtualMailManager.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 39
diff changeset
    85
# update config file
86
e43e4e7e9ec0 * 'VirtualMailManager/ext/Postconf.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 81
diff changeset
    86
./update_config_0.4.x-0.5.py $POSTCONF
68
7ae95b9938c4 * 'VirtualMailManager/VirtualMailManager.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 39
diff changeset
    87