install.sh
author Pascal Volk <user@localhost.localdomain.org>
Sat, 05 Jan 2013 23:49:42 +0000
changeset 675 d24f094d1cb5
parent 631 9b4d0e2c97d5
child 680 5365af94a8ec
permissions -rwxr-xr-x
Updated copyright notices to include the year 2013.
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
631
9b4d0e2c97d5 install.sh: Don't fail if $SYSCONFDIR doesn't exist.
Pascal Volk <user@localhost.localdomain.org>
parents: 562
diff changeset
    16
    SYSCONFDIR=/etc
39
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
631
9b4d0e2c97d5 install.sh: Don't fail if $SYSCONFDIR doesn't exist.
Pascal Volk <user@localhost.localdomain.org>
parents: 562
diff changeset
    19
    SYSCONFDIR=${PREFIX}/etc
39
8dcf739fc97e * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 37
diff changeset
    20
fi
562
b5bb7b34e831 Configure.Dovecot_2: Added configuration documentation for Dovecot_2 >= 2.0.
Pascal Volk <user@localhost.localdomain.org>
parents: 167
diff changeset
    21
DOCS="ChangeLog Configure.Dovecot_2 COPYING INSTALL NEWS README"
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    22
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    23
INSTALL_OPTS="-g 0 -o 0 -p"
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    24
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
    25
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    26
if [ $(id -u) -ne 0 ]; then
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    27
    echo "Run this script as root."
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    28
    exit 1
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    29
fi
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    30
164
67dc18294de6 *.sh: Added --force option to python setup.py install call.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 159
diff changeset
    31
python setup.py -q install --force --prefix ${PREFIX}
0
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    32
python setup.py clean --all >/dev/null
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    33
631
9b4d0e2c97d5 install.sh: Don't fail if $SYSCONFDIR doesn't exist.
Pascal Volk <user@localhost.localdomain.org>
parents: 562
diff changeset
    34
[ -d ${SYSCONFDIR} ] || mkdir -m 0755 -p ${SYSCONFDIR}
9b4d0e2c97d5 install.sh: Don't fail if $SYSCONFDIR doesn't exist.
Pascal Volk <user@localhost.localdomain.org>
parents: 562
diff changeset
    35
install -b -m 0600 ${INSTALL_OPTS} vmm.cfg ${SYSCONFDIR}/
159
78b6b06188d3 Moved Postfix PostgreSQL client configuration files into the postfix directory.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 102
diff changeset
    36
install ${INSTALL_OPTS_CF} postfix/pgsql-*.cf ${PF_CONFDIR}/
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    37
install -m 0700 ${INSTALL_OPTS} vmm ${PREFIX}/sbin
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    38
32
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    39
[ -d ${LOCALE_DIR} ] || mkdir -m 0755 -p ${LOCALE_DIR}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    40
cd po
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    41
for po in $(ls -1 *.po); do
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    42
    lang=$(basename ${po} .po)
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    43
    ddir=${LOCALE_DIR}/${lang}/LC_MESSAGES
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    44
    [ -d ${ddir}  ] || mkdir -m 0755 -p ${ddir}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    45
    msgfmt -o ${LOCALE_DIR}/${lang}/LC_MESSAGES/vmm.mo ${po}
ceb700bc4a80 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 31
diff changeset
    46
done
37
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    47
cd - >/dev/null
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    48
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    49
cd man
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    50
[ -d ${MANDIR}/man1 ] || mkdir -m 0755 -p ${MANDIR}/man1
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    51
install -m 0644 ${INSTALL_OPTS} man1/vmm.1 ${MANDIR}/man1
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    52
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    53
[ -d ${MANDIR}/man5 ] || mkdir -m 0755 -p ${MANDIR}/man5
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    54
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
    55
167
bb58aedefa3a update_config.py: adjusted functions stuff to renamed settings.
Pascal Volk <neverseen@users.sourceforge.net>
parents: 164
diff changeset
    56
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
    57
do
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    58
    for s in man1 man5; do
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    59
        [ -d ${MANDIR}/${l}/${s} ] || mkdir -m 0755 -p ${MANDIR}/${l}/${s}
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    60
    done
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    61
    if [ -f ${l}/man1/vmm.1 ]; then
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    62
        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
    63
    fi
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    64
    if [ -f ${l}/man5/vmm.cfg.5 ]; then
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    65
        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
    66
    fi
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    67
done
89f952b0f366 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 32
diff changeset
    68
cd - >/dev/null
24
48ea255e8a85 * 'vmm.cfg.5'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 23
diff changeset
    69
4
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    70
[ -d ${DOC_DIR} ] || mkdir -m 0755 -p ${DOC_DIR}
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    71
for DOC in ${DOCS}; do
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    72
    install -m 0644 ${INSTALL_OPTS} ${DOC} ${DOC_DIR}
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    73
done
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    74
f3c30b7421b9 * 'install.sh'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 0
diff changeset
    75
[ -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
    76
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
    77
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
    78
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    79
echo
14
ebc9b864bc9a * 'update_config_0.3.x-0.4.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents: 4
diff changeset
    80
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
    81
echo "and ${PF_CONFDIR}/pgsql-*.cf files."
bb0aa2102206 Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff changeset
    82
echo