install.sh
author Pascal Volk <neverseen@users.sourceforge.net>
Thu, 15 Apr 2010 19:46:53 +0000
branchv0.6.x
changeset 249 bb7d9906c529
parent 167 bb58aedefa3a
child 562 b5bb7b34e831
permissions -rwxr-xr-x
VMM/Relocated: implemented Relocated.__nonzero__() for truth value testing. Use EmailAddress' __str__() method when raising RelocatedErrors.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
b7a7e566833c * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 27
diff changeset
     1
#!/bin/sh
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     2
#
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
     3
# Installation script for the Virtual Mail Manager
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     4
# run: ./install.sh
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
LANG=C
31
b7a7e566833c * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 27
diff changeset
     7
PATH=/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     8
PREFIX=/usr/local
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
     9
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    10
PF_CONFDIR=$(postconf -h config_directory)
31
b7a7e566833c * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 27
diff changeset
    11
PF_GID=$(id -g $(postconf -h mail_owner))
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    12
LOCALE_DIR=${PREFIX}/share/locale
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    13
DOC_DIR=${PREFIX}/share/doc/vmm
102
485d3f7d6981 Removed svn keywords, more POSIX compliant shell scripts
Pascal Volk <neverseen@users.sourceforge.net>
parents: 81
diff changeset
    14
if [ ${PREFIX} = "/usr" ]; then
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    15
    MANDIR=${PREFIX}/share/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    16
else
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    17
    MANDIR=${PREFIX}/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    18
fi
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    19
DOCS="ChangeLog COPYING INSTALL README"
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    20
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    21
INSTALL_OPTS="-g 0 -o 0 -p"
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    22
INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p"
31
b7a7e566833c * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 27
diff changeset
    23
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    24
if [ $(id -u) -ne 0 ]; then
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
    echo "Run this script as root."
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    26
    exit 1
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    27
fi
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    28
164
67dc18294de6 *.sh: Added --force option to python setup.py install call.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 159
diff changeset
    29
python setup.py -q install --force --prefix ${PREFIX}
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    30
python setup.py clean --all >/dev/null
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    31
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    32
install -b -m 0600 ${INSTALL_OPTS} vmm.cfg ${PREFIX}/etc/
159
78b6b06188d3 Moved Postfix PostgreSQL client configuration files into the postfix directory.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 102
diff changeset
    33
install ${INSTALL_OPTS_CF} postfix/pgsql-*.cf ${PF_CONFDIR}/
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    34
install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    35
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    36
[ -d ${LOCALE_DIR} ] || mkdir -m 0755 -p ${LOCALE_DIR}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    37
cd po
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    38
for po in $(ls -1 *.po); do
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    39
    lang=$(basename ${po} .po)
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    40
    ddir=${LOCALE_DIR}/${lang}/LC_MESSAGES
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    41
    [ -d ${ddir}  ] || mkdir -m 0755 -p ${ddir}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    42
    msgfmt -o ${LOCALE_DIR}/${lang}/LC_MESSAGES/vmm.mo ${po}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    43
done
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    44
cd - >/dev/null
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    45
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    46
cd man
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    47
[ -d ${MANDIR}/man1 ] || mkdir -m 0755 -p ${MANDIR}/man1
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    48
install -m 0644 ${INSTALL_OPTS} man1/vmm.1 ${MANDIR}/man1
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    49
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    50
[ -d ${MANDIR}/man5 ] || mkdir -m 0755 -p ${MANDIR}/man5
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    51
install -m 0644 ${INSTALL_OPTS} man5/vmm.cfg.5 ${MANDIR}/man5
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    52
167
bb58aedefa3a update_config.py: adjusted functions stuff to renamed settings.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 164
diff changeset
    53
for l in $(find . -maxdepth 1 -mindepth 1 -type d \! -name man\?)
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    54
do
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    55
    for s in man1 man5; do
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    56
        [ -d ${MANDIR}/${l}/${s} ] || mkdir -m 0755 -p ${MANDIR}/${l}/${s}
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    57
    done
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    58
    if [ -f ${l}/man1/vmm.1 ]; then
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    59
        install -m 0644 ${INSTALL_OPTS} ${l}/man1/vmm.1 ${MANDIR}/${l}/man1
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    60
    fi
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    61
    if [ -f ${l}/man5/vmm.cfg.5 ]; then
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    62
        install -m 0644 ${INSTALL_OPTS} ${l}/man5/vmm.cfg.5 ${MANDIR}/${l}/man5
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    63
    fi
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    64
done
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    65
cd - >/dev/null
24
48ea255e8a85 * 'vmm.cfg.5'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 23
diff changeset
    66
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    67
[ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    68
for DOC in ${DOCS}; do
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    69
    install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    70
done
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    71
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    72
[ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
159
78b6b06188d3 Moved Postfix PostgreSQL client configuration files into the postfix directory.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 102
diff changeset
    73
install -m 0644 ${INSTALL_OPTS} postfix/pgsql-*.cf ${DOC_DIR}/examples
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    74
install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    75
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    76
echo
14
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    77
echo "Don't forget to edit ${PREFIX}/etc/vmm.cfg - or run: vmm cf"
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    78
echo "and ${PF_CONFDIR}/pgsql-*.cf files."
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    79
echo