summaryrefslogtreecommitdiffstats
path: root/tools/path_replacer.sh.in
blob: 37683a9f917fd09dcc9536f2395c09596f69025c (plain)
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
#!/bin/sh
# Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This script replaces @prefix@, @localstatedir@ and other automake/autoconf
# variables with their actual content.
#
# Invocation:
#
# ./path_replacer.sh input-file.in output-file
#
# This script is initially used to generate configuration files, but it is
# generic and can be used to generate any text files.
#

prefix=@prefix@
sysconfdir=@sysconfdir@
localstatedir=@localstatedir@
exec_prefix=@exec_prefix@
libdir=@libdir@

echo "Replacing \@prefix\@ with ${prefix}"
echo "Replacing \@libdir\@ with ${libdir}"
echo "Replacing \@sysconfdir\@ with ${sysconfdir}"
echo "Replacing \@localstatedir\@ with ${localstatedir}"

echo "Input file: $1"
echo "Output file: $2"

sed -e "s@SEP@\@libdir\@@SEP@${libdir}@SEP@g; s@SEP@\@localstatedir\@@SEP@${localstatedir}@SEP@g; s@SEP@\@prefix\@@SEP@${prefix}@SEP@g; s@SEP@\@sysconfdir\@@SEP@${sysconfdir}@SEP@g" $1 > $2