generate_manifest.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/usr/bin/env bash
  2. set -e
  3. [ "$GLUON_IMAGEDIR" -a "$GLUON_RELEASE" -a "$GLUON_SITEDIR" ] || exit 1
  4. default_sysupgrade_ext='.bin'
  5. output=
  6. aliases=
  7. manifest_aliases=
  8. sysupgrade_ext=
  9. SITE_CODE="$(scripts/site.sh site_code)"
  10. generate_line() {
  11. local model="$1"
  12. local file="$2"
  13. [ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \
  14. "$model" \
  15. "$GLUON_RELEASE" \
  16. "$(scripts/sha256sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
  17. "$(scripts/filesize.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
  18. "$file"
  19. [ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \
  20. "$model" \
  21. "$GLUON_RELEASE" \
  22. "$(scripts/sha256sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
  23. "$file"
  24. [ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \
  25. "$model" \
  26. "$GLUON_RELEASE" \
  27. "$(scripts/sha512sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
  28. "$file"
  29. }
  30. generate() {
  31. [ "${output}" ] || return 0
  32. if [ "$sysupgrade_ext" ]; then
  33. generate_line "$output" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${output}-sysupgrade${sysupgrade_ext}"
  34. for alias in $aliases; do
  35. generate_line "$alias" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${alias}-sysupgrade${sysupgrade_ext}"
  36. done
  37. for alias in $manifest_aliases; do
  38. generate_line "$alias" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${output}-sysupgrade${sysupgrade_ext}"
  39. done
  40. fi
  41. }
  42. . scripts/common.inc.sh
  43. device() {
  44. generate
  45. output="$1"
  46. aliases=
  47. manifest_aliases=
  48. sysupgrade_ext="$default_sysupgrade_ext"
  49. }
  50. sysupgrade_image() {
  51. generate
  52. output="$1"
  53. aliases=
  54. manifest_aliases=
  55. if [ "$3" ]; then
  56. sysupgrade_ext="$3"
  57. else
  58. sysupgrade_ext="$2"
  59. fi
  60. }
  61. alias() {
  62. aliases="$aliases $1"
  63. }
  64. manifest_alias() {
  65. manifest_aliases="$manifest_aliases $1"
  66. }
  67. sysupgrade() {
  68. if [ "$2" ]; then
  69. sysupgrade_ext="$2"
  70. else
  71. sysupgrade_ext="$1"
  72. fi
  73. if [ -z "$output" ]; then
  74. default_sysupgrade_ext="$sysupgrade_ext"
  75. fi
  76. }
  77. . targets/"$1"; generate