freebsd-dev/contrib/ntp/scripts/build/fixautomakedepsmagic
Cy Schubert 2b15cb3d09 MFV ntp 4.2.8p1 (r258945, r275970, r276091, r276092, r276093, r278284)
Thanks to roberto for providing pointers to wedge this into HEAD.

Approved by:	roberto
2015-03-30 13:30:15 +00:00

29 lines
402 B
Bash
Executable File

#!/bin/sh
prog=`basename $0`
t=/tmp/$prog.$$
trap 'rm -f ${t} ; exit 1' 1 3 15
while [ $# -gt 0 ]; do
f=$1
shift
sed -e '/^DEPS_MAGIC :=/,/^-include \$/s/^/#/' $f > $t
c="diff $f $t"
echo $c
$c
tstatus=$?
if [ $tstatus = 0 ]; then
echo "$prog":" $f not modified"
elif [ ! -w $f ]; then
echo "$prog":" $f not not writable"
else
c="cp $t $f"
echo $c
$c
fi
rm -f $t
done