You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.4 KiB

  1. #!/bin/bash
  2. source "util/functions.sh"
  3. warn_not_root
  4. have_config=0
  5. usage()
  6. {
  7. echo "Skulls for the X230 Tablet"
  8. echo " Run this script to rebuild a released image"
  9. echo ""
  10. echo "Usage: $0 [-c <config_file>]"
  11. echo ""
  12. echo " -c <config_file> to use for flashrom"
  13. }
  14. args=$(getopt -o c:h -- "$@")
  15. if [ $? -ne 0 ] ; then
  16. usage
  17. exit 1
  18. fi
  19. eval set -- "$args"
  20. while [ $# -gt 0 ]
  21. do
  22. case "$1" in
  23. -c)
  24. CONFIGFILE=$2
  25. have_config=1
  26. shift
  27. ;;
  28. -h)
  29. usage
  30. exit 1
  31. ;;
  32. --)
  33. shift
  34. break
  35. ;;
  36. *)
  37. echo "Invalid option: $1"
  38. exit 1
  39. ;;
  40. esac
  41. shift
  42. done
  43. if [ ! "$have_config" -gt 0 ] ; then
  44. configs_available=$(ls -1 | grep config || true)
  45. if [ -z "${configs_available}" ] ; then
  46. echo "No config file found. Please add -c <file>"
  47. echo ""
  48. usage
  49. exit 1
  50. fi
  51. prompt="Please select a configuration to use for building or start with the -c option to use a different one:"
  52. options=( $(find -maxdepth 1 -name "*config*" -print0 | xargs -0) )
  53. PS3="$prompt "
  54. select CONFIGFILE in "${options[@]}" "Quit" ; do
  55. if (( REPLY == 1 + ${#options[@]} )) ; then
  56. exit
  57. elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
  58. break
  59. else
  60. echo "Invalid option. Try another one."
  61. fi
  62. done
  63. fi
  64. rm -f defconfig-*
  65. CONFIGFILE_READY=$(echo $CONFIGFILE | cut -d'-' -f2-)
  66. cp $CONFIGFILE $CONFIGFILE_READY
  67. cd ..
  68. ./build.sh --clean-slate --commit $(ls -1 x230t/defconfig-* | cut -d'-' -f2-) x230t
  69. rm -f x230t/defconfig-*