2014-08-08 12:57:20 +02:00
|
|
|
#!/bin/sh
|
2020-12-03 11:19:15 +02:00
|
|
|
|
2025-03-19 09:37:25 +02:00
|
|
|
# Copyright (C) 2014-2025 Internet Systems Consortium, Inc. ("ISC")
|
2014-08-08 18:17:36 +02:00
|
|
|
#
|
2015-12-15 21:37:34 +01:00
|
|
|
# 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/.
|
2020-12-03 11:19:15 +02:00
|
|
|
|
2014-08-08 18:17:36 +02:00
|
|
|
# This script replaces @prefix@, @localstatedir@ and other automake/autoconf
|
|
|
|
# variables with their actual content.
|
|
|
|
#
|
|
|
|
# Invocation:
|
2014-08-08 12:57:20 +02:00
|
|
|
#
|
|
|
|
# ./path_replacer.sh input-file.in output-file
|
2014-08-08 18:17:36 +02:00
|
|
|
#
|
|
|
|
# This script is initially used to generate configuration files, but it is
|
|
|
|
# generic and can be used to generate any text files.
|
2014-08-08 12:57:20 +02:00
|
|
|
|
2020-12-03 11:19:15 +02:00
|
|
|
# shellcheck disable=SC2034
|
|
|
|
# SC2034: ... appears unused. Verify use (or export if used externally).
|
|
|
|
|
|
|
|
# Exit with error if commands exit with non-zero and if undefined variables are
|
|
|
|
# used.
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
prefix="@prefix@"
|
|
|
|
sysconfdir="@sysconfdir@"
|
|
|
|
localstatedir="@localstatedir@"
|
|
|
|
exec_prefix="@exec_prefix@"
|
|
|
|
libdir="@libdir@"
|
2014-08-08 12:57:20 +02:00
|
|
|
|
2014-08-08 18:17:36 +02:00
|
|
|
echo "Replacing \@prefix\@ with ${prefix}"
|
2019-07-23 22:45:00 +02:00
|
|
|
echo "Replacing \@libdir\@ with ${libdir}"
|
2014-08-08 18:17:36 +02:00
|
|
|
echo "Replacing \@sysconfdir\@ with ${sysconfdir}"
|
2014-08-08 12:57:20 +02:00
|
|
|
echo "Replacing \@localstatedir\@ with ${localstatedir}"
|
|
|
|
|
|
|
|
echo "Input file: $1"
|
|
|
|
echo "Output file: $2"
|
|
|
|
|
2020-12-03 11:19:15 +02:00
|
|
|
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}"
|