install.sh
author Pascal Volk <neverseen@users.sourceforge.net>
Mon, 18 Aug 2008 01:56:31 +0000
changeset 47 191d5a5adc4a
parent 39 8dcf739fc97e
child 81 89b71a9abfcf
permissions -rwxr-xr-x
* Removed gettext import and setup in VirtualMailManager/: - 'Account.py' - 'Alias.py' - 'Config.py' - 'Domain.py' - 'MailLocation.py' - 'Transport.py' - 'VirtualMailManager.py' * 'VirtualMailManager/VirtualMailManager.py' - Renamed methods in class VirtualMailManager: + __chkLocalpart() -> chkLocalpart() + __chkDomainname() -> chkDomainname() + __chkEmailAddress() -> chkEmailAddress() - VirtualMailManager.chkLocalpart() check also for len() < 1 *Oops* - VirtualMailManager.user_delete() explains why the home directory couldn't be deleted, if it wasn't deleted. * 'VirtualMailManager/Account.py' - Account.__init__() checks address with VirtualMailManager.chkEmailAddress() * 'VirtualMailManager/Exceptions.py' - Added class VMMDomainAliasException * 'vmm' - Implemented: w_err(), w_std() - Uses gettexts install() - Converts all args from sys.argv to unicode - available via global argv - Replaced many sys.argv by argv * 'po/de.po' * 'po/vmm.pot' - updated
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
# $Id$
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     3
#
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
     4
# Installation script for the Virtual Mail Manager
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     5
# run: ./install.sh
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     6
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
     7
LANG=C
31
b7a7e566833c * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 27
diff changeset
     8
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
     9
PREFIX=/usr/local
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    10
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    11
PF_CONFDIR=$(postconf -h config_directory)
31
b7a7e566833c * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 27
diff changeset
    12
PF_GID=$(id -g $(postconf -h mail_owner))
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    13
LOCALE_DIR=${PREFIX}/share/locale
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    14
DOC_DIR=${PREFIX}/share/doc/vmm
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    15
if [ ${PREFIX} == "/usr" ]; then
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    16
    MANDIR=${PREFIX}/share/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    17
else
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    18
    MANDIR=${PREFIX}/man
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    19
fi
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    20
DOCS="ChangeLog COPYING INSTALL README"
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    21
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    22
INSTALL_OPTS="-g 0 -o 0 -p"
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    23
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
    24
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    25
if [ $(id -u) -ne 0 ]; then
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    26
    echo "Run this script as root."
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    27
    exit 1
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    28
fi
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    29
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    30
python setup.py install --prefix ${PREFIX}
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    31
python setup.py clean --all >/dev/null
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    32
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    33
install -b -m 0600 ${INSTALL_OPTS} vmm.cfg ${PREFIX}/etc/
31
b7a7e566833c * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 27
diff changeset
    34
install ${INSTALL_OPTS_CF} pgsql-*.cf ${PF_CONFDIR}/
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    35
install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    36
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    37
[ -d ${LOCALE_DIR} ] || mkdir -m 0755 -p ${LOCALE_DIR}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    38
cd po
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    39
for po in $(ls -1 *.po); do
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    40
    lang=$(basename ${po} .po)
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    41
    ddir=${LOCALE_DIR}/${lang}/LC_MESSAGES
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    42
    [ -d ${ddir}  ] || mkdir -m 0755 -p ${ddir}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    43
    msgfmt -o ${LOCALE_DIR}/${lang}/LC_MESSAGES/vmm.mo ${po}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    44
done
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    45
cd - >/dev/null
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    46
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    47
cd man
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    48
[ -d ${MANDIR}/man1 ] || mkdir -m 0755 -p ${MANDIR}/man1
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    49
install -m 0644 ${INSTALL_OPTS} man1/vmm.1 ${MANDIR}/man1
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    50
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    51
[ -d ${MANDIR}/man5 ] || mkdir -m 0755 -p ${MANDIR}/man5
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    52
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
    53
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    54
for l in $(find . -maxdepth 1 -mindepth 1 -type d \! -name man\? \! -name .svn)
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    55
do
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    56
    for s in man1 man5; do
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    57
        [ -d ${MANDIR}/${l}/${s} ] || mkdir -m 0755 -p ${MANDIR}/${l}/${s}
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    58
    done
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    59
    if [ -f ${l}/man1/vmm.1 ]; then
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    60
        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
    61
    fi
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    62
    if [ -f ${l}/man5/vmm.cfg.5 ]; then
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    63
        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
    64
    fi
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    65
done
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    66
cd - >/dev/null
24
48ea255e8a85 * 'vmm.cfg.5'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 23
diff changeset
    67
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    68
[ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    69
for DOC in ${DOCS}; do
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    70
    install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    71
done
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    72
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    73
[ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    74
install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    75
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
    76
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    77
echo
14
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    78
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
    79
echo "and ${PF_CONFDIR}/pgsql-*.cf files."
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    80
echo