69 lines
1.4 KiB
Plaintext
69 lines
1.4 KiB
Plaintext
|
#!/bin/sh
|
||
|
#
|
||
|
echo "#!/bin/sh" > customize.$$
|
||
|
echo "sed \\" > customize.$$
|
||
|
chmod +x customize.$$
|
||
|
|
||
|
################################################################
|
||
|
# find a working perl:
|
||
|
#
|
||
|
for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5
|
||
|
do
|
||
|
if $i -e 'exit ($] < 5.000)'
|
||
|
then
|
||
|
echo $i works
|
||
|
perl="$i"
|
||
|
break
|
||
|
fi
|
||
|
done
|
||
|
if [ -z "$perl" ]
|
||
|
then
|
||
|
could not find a working perl command, sorry.
|
||
|
exit 1
|
||
|
fi
|
||
|
echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize.$$
|
||
|
|
||
|
|
||
|
################################################################
|
||
|
# find a diff which understands --changed-group-format
|
||
|
# and related options (like gnu diff)
|
||
|
#
|
||
|
echo 'a
|
||
|
b
|
||
|
c' > diff_format-test.$$.1
|
||
|
echo 'a
|
||
|
B
|
||
|
c' > diff_format-test.$$.2
|
||
|
|
||
|
wanted="<b
|
||
|
=B
|
||
|
>"
|
||
|
for i in /usr/bin/diff /usr/local/bin/diff
|
||
|
do
|
||
|
a="`$i --unchanged-group-format='' --changed-group-format='<%<=%>>' diff_format-test.$$.1 diff_format-test.$$.2`"
|
||
|
echo "$a"
|
||
|
|
||
|
if [ "x$a" = "x$wanted" ]
|
||
|
then
|
||
|
echo $i works
|
||
|
diff_format="$i"
|
||
|
fi
|
||
|
done
|
||
|
if [ -z "$diff_format" ]
|
||
|
then
|
||
|
echo could not find a working diff_format command, sorry.
|
||
|
exit 1
|
||
|
fi
|
||
|
echo " -e 's,@@@diff_format@@@,$diff_format,g' \\" >> customize.$$
|
||
|
rm diff_format-test.$$.?
|
||
|
|
||
|
|
||
|
################################################################
|
||
|
# finish
|
||
|
# Add trailing newline and rename temp file to final name
|
||
|
#
|
||
|
echo >> customize.$$
|
||
|
|
||
|
mv customize.$$ customize
|
||
|
|