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
|
#!/bin/sh
#
# Generate a krb5.conf file with an [appdefault] krb5-sync section that
# contains all the key/value pairs given on the command line. This script is
# used by C tests to set up the environment.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2009, 2013
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
set -e
# Command-line arguments are the source krb5.conf template, the directory into
# which to write the resulting krb5.conf file, and then any number of key and
# value pairs to put into krb5.conf.
source="$1"
tmpdir="$2"
if [ -z "$tmpdir" ] ; then
echo 'Syntax: make-krb5-conf <source> <tmpdir> <key> <value> ...' >&2
exit 1
fi
shift
shift
# Pull over all of the template file up to the krb5-sync settings.
sed '/^ *krb5-sync *= */q' <"$source" >"$tmpdir"/krb5.conf
# Add the key-value pairs.
while [ -n "$1" ] ; do
echo " $1 = $2" >>"$tmpdir"/krb5.conf
shift
shift
done
# Add the rest of the file.
sed '0,/^ *krb5-sync *= */d' <"$source" >>"$tmpdir"/krb5.conf
# Done.
exit 0
|