update_chconf_nil.sh 771 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. if [ $# -eq 2 ]
  3. then
  4. if [ $1 = "rootpath" ]
  5. then
  6. find $2 -name "chconf.h" -exec bash update_chconf_nil.sh "{}" \;
  7. else
  8. echo "Usage: update_chconf_nil.sh [rootpath <root path>]"
  9. fi
  10. elif [ $# -eq 1 ]
  11. then
  12. declare conffile=$(<$1)
  13. if egrep -q "_CHIBIOS_NIL_CONF_" <<< "$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/chconf_nil
  18. then
  19. echo
  20. echo "aborted"
  21. exit 1
  22. fi
  23. cp ./chconf.h $1
  24. rm ./chconf.h ./values.txt
  25. fi
  26. else
  27. echo "Usage: update_chconf_nil.sh [rootpath <root path>]"
  28. echo " update_chconf_nil.sh <configuration file>]"
  29. fi