1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
|
#! /bin/sh
# Script to install Exim binaries in BIN_DIRECTORY, which is defined in
# the local Makefile. It expects to be run in a build directory. It needs
# to be run as root in order to make exim setuid to root. If exim runs setuid
# to (e.g.) exim, this script should be run as that user or root.
# This script also installs a default configuration file in CONFIGURE_FILE
# if there is no configuration file there.
# If INFO_DIRECTORY is defined in any of the local Makefiles, and the Exim doc
# directory contains the Texinfo documentation, this script also installs a
# the info files in INFO_DIRECTORY.
# The script can be made to output what it would do, without actually doing
# anything, by giving it the option "-n" (cf make). Arguments are the names
# of things to install. No arguments installs everything.
if [ "$1" = "-n" ]; then
shift
real="true || "
ver="verification "
com=": "
echo $com ""
echo $com "*** Verification mode only: no commands will actually be obeyed"
echo $com ""
echo $com "You can cut and paste the bits you want to a shell, etc"
echo $com ""
echo cd `pwd`
fi
# First off, get the OS type, and check that there is a make file for it.
os=`../scripts/os-type -generic` || exit 1
if test ! -r ../OS/Makefile-$os
then echo ""
echo "*** Sorry - operating system $os is not supported"
echo "*** See OS/Makefile-* for supported systems" 1>&2
echo ""
exit 1;
fi
# We also need the architecture type, in order to test for any architecture-
# specific configuration files.
arch=`../scripts/arch-type` || exit 1
# Get the values of BIN_DIRECTORY and CONFIGURE_FILE from the relevant
# makefiles in the Local directory. Such make files might contain
# settings that have spaces in them for other parameters, and these
# confuse the shell if a straight sourcing operation is done. Pity that
# make and sh are incompatible in this way. Instead we have to seek out
# the values we want explicitly.
Local_Makefile=${LOCAL_MAKEFILE-../Local/Makefile}
files=${Local_Makefile}
if [ -f ${Local_Makefile}-$os ] ; then
files="$files ${Local_Makefile}-$os"
fi
if [ -f ${Local_Makefile}-$arch ] ; then
files="$files ${Local_Makefile}-$arch"
fi
if [ -f ${Local_Makefile}-$os-$arch ] ; then
files="$files ${Local_Makefile}-$os-$arch"
fi
BIN_DIRECTORY=`grep "^ *BIN_DIRECTORY=" $files | tail -1 | cut -f2-99 -d: | cut -c15-99`
CONFIGURE_FILE=`grep "^ *CONFIGURE_FILE=" $files | tail -1 | cut -f2-99 -d: | cut -c16-99`
INFO_DIRECTORY=`grep "^ *INFO_DIRECTORY=" $files | tail -1 | cut -f2-99 -d: | cut -c16-99`
# Allow INST_xx to over-ride xx
case "$INST_BIN_DIRECTORY" in ?*) BIN_DIRECTORY="$INST_BIN_DIRECTORY";; esac
case "$INST_CONFIGURE_FILE" in ?*) CONFIGURE_FILE="$INST_CONFIGURE_FILE";; esac
case "$INST_INFO_DIRECTORY" in ?*) INFO_DIRECTORY="$INST_INFO_DIRECTORY";; esac
case "$INST_UID" in '') INST_UID=root;; *) INST_UID="$INST_UID";; esac
case "$INST_CP" in '') CP=cp;; *) CP="$INST_CP";; esac
case "$INST_MV" in '') MV=mv;; *) MV="$INST_MV";; esac
case "$INST_CHOWN" in '') CHOWN=chown;; *) CHOWN="$INST_CHOWN";; esac
case "$INST_CHMOD" in '') CHMOD=chmod;; *) CHMOD="$INST_CHMOD";; esac
# Allow the user to over-ride xx
case "$inst_dest" in ?*) BIN_DIRECTORY="$inst_dest";; esac
case "$inst_conf" in ?*) CONFIGURE_FILE="$inst_conf";; esac
case "$inst_info" in ?*) INFO_DIRECTORY="$inst_info";; esac
case "$inst_uid" in ?*) INST_UID="$inst_uid";; esac
case "$inst_cp" in ?*) CP="$inst_cp";; esac
case "$inst_mv" in ?*) MV="$inst_mv";; esac
case "$inst_chown" in ?*) CHOWN="$inst_chown";; esac
case "$inst_chmod" in ?*) CHMOD="$inst_chmod";; esac
# chown is a special case; in at least one OS it is in /usr/etc instead
# of in /usr/bin, and therefore not likely to be on the path. Another OS
# has it in /usr/sbin. This fudge tries to cope with these variations.
if [ "${CHOWN}" = "chown" -a -x /usr/sbin/chown ] ; then
CHOWN=/usr/sbin/chown
fi
if [ "${CHOWN}" = "chown" -a ! -f /usr/bin/chown -a -f /usr/etc/chown ] ; then
CHOWN=/usr/etc/chown
fi
# See if the exim monitor has been built
if [ -f eximon -a -f eximon.bin ]; then
exim_monitor="eximon eximon.bin"
fi
# If bin directory doesn't exist, try to create it
if [ ! -d "${BIN_DIRECTORY}" ]; then
echo mkdir -p ${BIN_DIRECTORY}
${real} mkdir -p ${BIN_DIRECTORY}
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** Exim installation ${ver}failed ***"
exit 1
else
echo $com ${BIN_DIRECTORY} created
fi
fi
# If no arguments, install everything
if [ $# -gt 0 ]; then
set $@
else
set exim ${exim_monitor} exim_dumpdb exim_fixdb exim_tidydb \
exinext exiwhat exim_dbmbuild exicyclog exigrep eximstats \
exiqsumm exim_lock
fi
echo $com ""
echo $com Installation directory is ${BIN_DIRECTORY}
echo $com ""
while [ $# -gt 0 ]; do
name=$1
shift
from=
if [ $name = exigrep -o $name = eximstats -o $name = exiqsumm ]; then
from=../util/
fi
if [ ! -s ${from}${name} ]; then
echo $com ""
echo $com "*** `pwd`/${from}${name} does not exist or is empty"
echo $com "*** Have you built Exim successfully?"
echo $com "*** Exim installation ${ver}failed ***"
exit 1
fi
if ../scripts/newer ${from}${name} ${BIN_DIRECTORY}/${name}; then
if [ -f ${BIN_DIRECTORY}/${name} ]; then
echo ${MV} ${BIN_DIRECTORY}/${name} ${BIN_DIRECTORY}/${name}.O
${real} ${MV} ${BIN_DIRECTORY}/${name} ${BIN_DIRECTORY}/${name}.O
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** Exim installation ${ver}failed ***"
exit 1
fi
fi
echo ${CP} ${from}${name} ${BIN_DIRECTORY}
${real} ${CP} ${from}${name} ${BIN_DIRECTORY}
echo strip ${BIN_DIRECTORY}/${name}
${real} strip ${BIN_DIRECTORY}/${name} || true
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** Exim installation ${ver}failed ***"
exit 1
fi
if [ $name = exim ]; then
echo ${CHOWN} ${INST_UID} ${BIN_DIRECTORY}/exim
${real} ${CHOWN} ${INST_UID} ${BIN_DIRECTORY}/exim
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** You must be ${INST_UID} to install exim ***"
exit 1
fi
echo ${CHMOD} a+x ${BIN_DIRECTORY}/exim
${real} ${CHMOD} a+x ${BIN_DIRECTORY}/exim
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** Exim installation ${ver}failed ***"
exit 1
fi
echo ${CHMOD} u+s ${BIN_DIRECTORY}/exim
${real} ${CHMOD} u+s ${BIN_DIRECTORY}/exim
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** Exim installation ${ver}failed ***"
exit 1
fi
fi
else
echo $com ${name} is not newer than ${BIN_DIRECTORY}/${name}
fi
done
# If there is no configuration file, install the default.
echo $com ""
if [ ! -f ${CONFIGURE_FILE} ]; then
echo $com Installing default configuration in ${CONFIGURE_FILE}
echo $com because there is no existing configuration file.
echo ${CP} ../src/configure.default ${CONFIGURE_FILE}
${real} ${CP} ../src/configure.default ${CONFIGURE_FILE}
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** Exim installation ${ver}failed ***"
exit 1
fi
else
echo $com Configuration file ${CONFIGURE_FILE} already exists
fi
# Install info files if the directory is defined and the Texinfo
# source documentation is present.
if [ "${INFO_DIRECTORY}" != "" -a -f ../doc/spec.texinfo ] ; then
echo $com ""
if [ ! -d "${INFO_DIRECTORY}" ] ; then
echo mkdir -p ${INFO_DIRECTORY}
${real} mkdir -p ${INFO_DIRECTORY}
if [ $? -ne 0 ]; then
echo $com ""
echo $com "*** Exim installation ${ver}failed ***"
exit 1
else
echo $com ${INFO_DIRECTORY} created
fi
fi
echo $com Info installation directory is ${INFO_DIRECTORY}
echo $com ""
makeinfo --no-split --output exim_overview.info ../doc/oview.texinfo
echo ${CP} exim_overview.info ${INFO_DIRECTORY}
${real} ${CP} exim_overview.info ${INFO_DIRECTORY}
install-info --section="Exim" \
--entry "* Exim Overview: (exim_overview). Overview of the Exim system" \
${INFO_DIRECTORY}/exim_overview.info ${INFO_DIRECTORY}/dir
makeinfo --no-split --output exim.info ../doc/spec.texinfo
echo ${CP} exim.info ${INFO_DIRECTORY}
${real} ${CP} exim.info ${INFO_DIRECTORY}
install-info --section="Exim" \
--entry "* Exim Specification: (exim). Exim manual" \
${INFO_DIRECTORY}/exim.info ${INFO_DIRECTORY}/dir
makeinfo --no-split --output exim_filter.info ../doc/filter.texinfo
echo ${CP} exim_filter.info ${INFO_DIRECTORY}
${real} ${CP} exim_filter.info ${INFO_DIRECTORY}
install-info --section="Exim" \
--entry "* Exim Filtering: (exim_filter). Filtering mail with Exim" \
${INFO_DIRECTORY}/exim_filter.info ${INFO_DIRECTORY}/dir
fi
# Everything OK
echo $com ""
echo $com Exim installation ${ver}complete
# End of exim_install
|