/contrib/ntp/scripts/fixautomakedepsmagic

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 28 lines · 22 code · 5 blank · 1 comment · 2 complexity · 1bb578fc0a376bacda97d3733e08695a MD5 · raw file

  1. #!/bin/sh
  2. prog=`basename $0`
  3. t=/tmp/$prog.$$
  4. trap 'rm -f ${t} ; exit 1' 1 3 15
  5. while [ $# -gt 0 ]; do
  6. f=$1
  7. shift
  8. sed -e '/^DEPS_MAGIC :=/,/^-include \$/s/^/#/' $f > $t
  9. c="diff $f $t"
  10. echo $c
  11. $c
  12. tstatus=$?
  13. if [ $tstatus = 0 ]; then
  14. echo "$prog":" $f not modified"
  15. elif [ ! -w $f ]; then
  16. echo "$prog":" $f not not writable"
  17. else
  18. c="cp $t $f"
  19. echo $c
  20. $c
  21. fi
  22. rm -f $t
  23. done