PATH=/sbin:/usr/sbin:/bin:/usr/bin
-while getopts "o:s:d:tnwf" options; do
+while getopts "o:s:d:tnw:f" options; do
case $options in
o ) OUTFILE=$OPTARG;;
d ) WORKDIR=$OPTARG;;
n ) SORTARG="-zn";;
- w ) WARN="true";;
+ w ) WARNMSG="$OPTARG";;
f ) FORCE="true";;
t ) TEST="true";;
* ) echo "Specify output file with -o and fragments directory with -d"
cd ${WORKDIR}
-if [ x${WARN} = "x" ]; then
- cat /dev/null > "fragments.concat"
+if [ x${WARNMSG} = "x" ]; then
+ : > "fragments.concat"
else
- echo '# This file is managed by Puppet. DO NOT EDIT.' > "fragments.concat"
+ echo -e "$WARNMSG" > "fragments.concat"
fi
# find all the files in the fragments directory, sort them numerically and concat to fragments.concat in the working dir
$version = $concat::setup::majorversion
$fragdir = "${concatdir}/${safe_name}"
$concat_name = "fragments.concat.out"
+ $default_warn_message = '# This file is managed by Puppet. DO NOT EDIT.'
case $warn {
- 'true',true,yes,on: { $warnflag = "-w" }
- 'false',false,no,off: { $warnflag = "" }
- default: { fail("Improper 'warn' value given to concat: $warn") }
+ 'true',true,yes,on: { $warnmsg = "$default_warn_message" }
+ 'false',false,no,off: { $warnmsg = "" }
+ default: { $warnmsg = "$warn" }
+ }
+
+ $warnmsg_escaped = regsubst($warnmsg, "'", "'\\\\''", 'G')
+ $warnflag = $warnmsg_escaped ? {
+ '' => '',
+ default => "-w '$warnmsg_escaped'"
}
case $force {