SPDX: Mass-update to GPL-2.0-or-later
[exim.git] / src / scripts / Configure-eximon
1 #! /bin/sh
2
3 # Copyright (c) The Exim Maintainters 2022
4 # SPDX-License-Identifier: GPL-2.0-or-later
5
6 # Shell script to build the configurable part of the Exim monitor's start-up
7 # script. This is built from various configuration files. The final part is
8 # added in the Makefile, using various macros that are available at that stage.
9
10 scripts=../scripts
11
12 # First off, get the OS type, and check that there is a make file for it.
13
14 os=`$scripts/os-type -generic` || exit 1
15
16 if      test ! -r ../OS/Makefile-$os
17 then    echo ""
18         echo "*** Sorry - operating system $os is not supported"
19         echo "*** See OS/Makefile-* for supported systems" 1>&2
20         echo ""
21         exit 1;
22 fi
23
24 # We also need the architecture type, in order to test for any architecture-
25 # specific configuration files.
26
27 arch=`$scripts/arch-type` || exit 1
28
29 # Build a file called eximon in the current directory by joining
30 # the generic default configure file, the OS base configure file, and then
31 # local generic, OS-specific, architecture-specific, and OS+architecture-
32 # specific configurationfiles, if they exist. These files all contain variable
33 # definitions, with later definitions overriding earlier ones.
34
35 echo "#!/bin/sh" > eximon
36 chmod a+x eximon
37
38 # Concatenate the configuration files that exist
39
40 for f in OS/eximon.conf-Default \
41          OS/eximon.conf-$os \
42          Local/eximon.conf \
43          Local/eximon.conf-$os \
44          Local/eximon.conf-$arch \
45          Local/eximon.conf-$os-$arch
46 do   if test -r ../$f
47      then   echo "# From $f"
48             sed '/^#/d;/^[   ]*$/d' ../$f || exit 1
49             echo "# End of $f"
50             echo ""
51      fi
52 done >> eximon || exit 1
53
54 # End of Configure-eximon