update_halconf.sh 739 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. if [ $# -eq 2 ]
  3. then
  4. if [ $1 = "rootpath" ]
  5. then
  6. find $2 -name "halconf.h" -exec bash update_halconf.sh "{}" \;
  7. else
  8. echo "Usage: update_halconf.sh [rootpath <path>]"
  9. fi
  10. elif [ $# -eq 1 ]
  11. then
  12. declare conffile=$(<$1)
  13. # if egrep -q "" <<< "$conffile"
  14. # then
  15. echo Processing: $1
  16. egrep -e "\#define\s+[a-zA-Z0-9_]*\s+[a-zA-Z0-9_]" <<< "$conffile" | sed 's/\#define //g; s/ */=/g' > ./values.txt
  17. if ! fmpp -q -C conf.fmpp -S ../ftl/processors/conf/halconf
  18. then
  19. echo
  20. echo "aborted"
  21. exit 1
  22. fi
  23. cp ./halconf.h $1
  24. rm ./halconf.h ./values.txt
  25. # fi
  26. else
  27. echo "Usage: update_halconf.sh [rootpath <root path>]"
  28. echo " update_halconf.sh <configuration file>]"
  29. fi