create_tizen_gbs_conf 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/bin/bash
  2. # Arguments = -r qtbase,qtdeclarative,...,qtxmlpatterns -f
  3. set -e
  4. usage()
  5. {
  6. cat << EOF
  7. usage: $0 options
  8. This script will download and sync tizen repos with upstream
  9. OPTIONS:
  10. -h Show this message
  11. -q QT_REPO_URL url qt rpm repository
  12. -p PROFILE_NAME Profile name
  13. -r GBS_BUILDROOT_PATH Path for GBS-ROOT
  14. -b BASE_REPO_URL Url of base rpm repository
  15. -m MAIN_REPO_URL Url of main rpm repository
  16. -f TEMPLATE_FILE Template filename
  17. -o OUTPUT_FILE output filename
  18. example:
  19. $0 -q http://download.qt-project.org/community_releases/tizen/1.0-alpha4/tizen2.2/emulator \
  20. -p mobile_2.2_emulator \
  21. -r /home/user/tizenbuildtools/emulator/GBS-ROOT \
  22. -b http://download.tizen.org/releases/2.2-emul/tizen-2.2-emul_20130719.2/repos/tizen-base/ia32/packages \
  23. -m http://download.tizen.org/releases/2.2-emul/tizen-2.2-emul_20130719.2/repos/tizen-main/ia32/packages \
  24. -f /home/user/tizenbuildtools/common/gbs.conf.template \
  25. -o /home/user/tizenbuildtools/emulator/mobile_2.2_emulator.conf
  26. EOF
  27. exit
  28. }
  29. QT_REPO_URL=""
  30. PROFILE_NAME=""
  31. GBS_BUILDROOT_PATH=""
  32. BASE_REPO_URL=""
  33. MAIN_REPO_URL=""
  34. TEMPLATE_FILE=""
  35. OUTPUT_FILE=""
  36. while getopts ":hq:p:r:m:b:f:o:" opt; do
  37. case $opt in
  38. h)
  39. usage
  40. ;;
  41. q)
  42. QT_REPO_URL="$OPTARG"
  43. ;;
  44. p)
  45. PROFILE_NAME="$OPTARG"
  46. ;;
  47. r)
  48. GBS_BUILDROOT_PATH="$OPTARG"
  49. ;;
  50. b)
  51. BASE_REPO_URL="$OPTARG"
  52. ;;
  53. m)
  54. MAIN_REPO_URL="$OPTARG"
  55. ;;
  56. f)
  57. TEMPLATE_FILE="$OPTARG"
  58. ;;
  59. o)
  60. OUTPUT_FILE="$OPTARG"
  61. ;;
  62. ?)
  63. echo "Invalid option: -$OPTARG"
  64. usage
  65. ;;
  66. esac
  67. done
  68. if [ "$PROFILE_NAME" == "" ]; then
  69. echo PROFILE_NAME can not be empty
  70. usage
  71. fi
  72. if [ "$GBS_BUILDROOT_PATH" == "" ]; then
  73. echo GBS_BUILDROOT_PATH can not be empty
  74. usage
  75. fi
  76. if [ "$BASE_REPO_URL" == "" ]; then
  77. echo BASE_REPO_URL can not be empty
  78. usage
  79. fi
  80. #if [ "$MAIN_REPO_URL" == "" ]; then
  81. # echo MAIN_REPO_URL can not be empty
  82. # usage
  83. #fi
  84. if [ "$TEMPLATE_FILE" == "" ]; then
  85. echo TEMPLATE_FILE can not be empty
  86. usage
  87. fi
  88. if [ "$OUTPUT_FILE" == "" ]; then
  89. echo OUTPUT_FILE can not be empty
  90. usage
  91. fi
  92. cp $TEMPLATE_FILE $OUTPUT_FILE
  93. sed -i "s!PROFILE_NAME_FOR_REPLACE!$PROFILE_NAME!gi" $OUTPUT_FILE
  94. if [ "$QT_REPO_URL" == "" ]; then
  95. sed -i "s!QT_REPOS_URL_FOR_REPLACE!$BASE_REPO_URL!gi" $OUTPUT_FILE
  96. else
  97. sed -i "s!QT_REPOS_URL_FOR_REPLACE!$QT_REPO_URL!gi" $OUTPUT_FILE
  98. fi
  99. if [ "$MAIN_REPO_URL" == "" ]; then
  100. sed -i "s!MAIN_REPO_FOR_REPLACE!$BASE_REPO_URL!gi" $OUTPUT_FILE
  101. else
  102. sed -i "s!MAIN_REPO_FOR_REPLACE!$MAIN_REPO_URL!gi" $OUTPUT_FILE
  103. fi
  104. sed -i "s!BASE_REPO_FOR_REPLACE!$BASE_REPO_URL!gi" $OUTPUT_FILE
  105. sed -i "s!GBS_BUILDROOT_FOR_REPLACE!$GBS_BUILDROOT_PATH!gi" $OUTPUT_FILE