upgrade.sh
changeset 118 cf85d78486ce
parent 104 c0b5afb89088
child 159 78b6b06188d3
equal deleted inserted replaced
117:c96b5768c76d 118:cf85d78486ce
     8 PREFIX=/usr/local
     8 PREFIX=/usr/local
     9 
     9 
    10 PF_CONFDIR=$(postconf -h config_directory)
    10 PF_CONFDIR=$(postconf -h config_directory)
    11 PF_GID=$(id -g $(postconf -h mail_owner))
    11 PF_GID=$(id -g $(postconf -h mail_owner))
    12 POSTCONF=$(which postconf)
    12 POSTCONF=$(which postconf)
       
    13 DOVECOT_VERS=$(dovecot --version | awk -F . '{print $1 $2}')
    13 LOCALE_DIR=${PREFIX}/share/locale
    14 LOCALE_DIR=${PREFIX}/share/locale
    14 DOC_DIR=${PREFIX}/share/doc/vmm
    15 DOC_DIR=${PREFIX}/share/doc/vmm
    15 if [ ${PREFIX} = "/usr" ]; then
    16 if [ ${PREFIX} = "/usr" ]; then
    16     MANDIR=${PREFIX}/share/man
    17     MANDIR=${PREFIX}/share/man
    17 else
    18 else
    22 INSTALL_OPTS="-g 0 -o 0 -p"
    23 INSTALL_OPTS="-g 0 -o 0 -p"
    23 INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p"
    24 INSTALL_OPTS_CF="-b -m 0640 -g ${PF_GID} -o 0 -p"
    24 
    25 
    25 if [ $(id -u) -ne 0 ]; then
    26 if [ $(id -u) -ne 0 ]; then
    26     echo "Run this script as root."
    27     echo "Run this script as root."
       
    28     exit 1
       
    29 fi
       
    30 
       
    31 # update config file before installing the new files.
       
    32 ./update_config_0.4.x-0.5.py ${POSTCONF} ${DOVECOT_VERS:-10}
       
    33 rv=$?
       
    34 if [ $rv -eq 2 ]; then
       
    35 	echo "please run the install.sh script"
       
    36 	exit 1
       
    37 elif [ $rv -eq 3 ]; then
       
    38     echo "please read the upgrade instructions at http://vmm.localdomain.org/"
       
    39     exit 1
       
    40 elif [ $rv -ne 0 ]; then
       
    41     echo "Sorry, something went wrong. Please file a bug:"
       
    42     echo "https://sourceforge.net/tracker/?group_id=213727"
    27     exit 1
    43     exit 1
    28 fi
    44 fi
    29 
    45 
    30 python setup.py -q install --prefix ${PREFIX}
    46 python setup.py -q install --prefix ${PREFIX}
    31 python setup.py clean --all >/dev/null
    47 python setup.py clean --all >/dev/null
    79 
    95 
    80 [ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
    96 [ -d ${DOC_DIR}/examples ] || mkdir -m 0755 -p ${DOC_DIR}/examples
    81 install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples
    97 install -m 0644 ${INSTALL_OPTS} pgsql-*.cf ${DOC_DIR}/examples
    82 install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples
    98 install -m 0644 ${INSTALL_OPTS} vmm.cfg ${DOC_DIR}/examples
    83 
    99 
    84 # update config file
       
    85 ./update_config_0.4.x-0.5.py $POSTCONF
       
    86