generate_manifest.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. sysupgrade_ext=
  8. SITE_CODE="$(scripts/site.sh site_code)"
  9. generate_line() {
  10. local model="$1"
  11. local file="$2"
  12. [ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo "$model" "$GLUON_RELEASE" "$(scripts/sha512sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" "$file"
  13. }
  14. generate() {
  15. [ "${output}" ] || return 0
  16. if [ "$sysupgrade_ext" ]; then
  17. generate_line "$output" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${output}-sysupgrade${sysupgrade_ext}"
  18. for alias in $aliases; do
  19. generate_line "$alias" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${alias}-sysupgrade${sysupgrade_ext}"
  20. done
  21. fi
  22. }
  23. . scripts/common.inc.sh
  24. device() {
  25. generate
  26. output="$1"
  27. aliases=
  28. sysupgrade_ext="$default_sysupgrade_ext"
  29. }
  30. sysupgrade_image() {
  31. generate
  32. output="$1"
  33. aliases=
  34. if [ "$3" ]; then
  35. sysupgrade_ext="$3"
  36. else
  37. sysupgrade_ext="$2"
  38. fi
  39. }
  40. alias() {
  41. aliases="$aliases $1"
  42. }
  43. sysupgrade() {
  44. if [ "$2" ]; then
  45. sysupgrade_ext="$2"
  46. else
  47. sysupgrade_ext="$1"
  48. fi
  49. if [ -z "$output" ]; then
  50. default_sysupgrade_ext="$sysupgrade_ext"
  51. fi
  52. }
  53. . targets/"$1"; generate