artifact-armbian-config.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/usr/bin/env bash
  2. #
  3. # SPDX-License-Identifier: GPL-2.0
  4. #
  5. # Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
  6. #
  7. # This file is a part of the Armbian Build Framework
  8. # https://github.com/armbian/build/
  9. function artifact_armbian-config_config_dump() {
  10. artifact_input_variables[BUILD_MINIMAL]="${BUILD_MINIMAL}"
  11. }
  12. function artifact_armbian-config_prepare_version() {
  13. artifact_version="undetermined" # outer scope
  14. artifact_version_reason="undetermined" # outer scope
  15. local ARMBIAN_CONFIG_SOURCE="${ARMBIAN_CONFIG_SOURCE:-"https://github.com/armbian/config"}"
  16. local ARMBIAN_CONFIG_BRANCH="branch:${ARMBIAN_CONFIG_BRANCH:-"master"}"
  17. debug_var ARMBIAN_CONFIG_SOURCE
  18. debug_var ARMBIAN_CONFIG_BRANCH
  19. declare short_hash_size=4
  20. declare -A GIT_INFO_ARMBIAN_CONFIG=([GIT_SOURCE]="${ARMBIAN_CONFIG_SOURCE}" [GIT_REF]="${ARMBIAN_CONFIG_BRANCH}")
  21. run_memoized GIT_INFO_ARMBIAN_CONFIG "git2info" memoized_git_ref_to_info
  22. debug_dict GIT_INFO_ARMBIAN_CONFIG
  23. # Sanity check, the SHA1 gotta be sane.
  24. [[ "${GIT_INFO_ARMBIAN_CONFIG[SHA1]}" =~ ^[0-9a-f]{40}$ ]] || exit_with_error "SHA1 is not sane: '${GIT_INFO_ARMBIAN_CONFIG[SHA1]}'"
  25. declare fake_unchanging_base_version="1"
  26. declare short_sha1="${GIT_INFO_ARMBIAN_CONFIG[SHA1]:0:${short_hash_size}}"
  27. # get the hashes of the lib/ bash sources involved...
  28. declare hash_files="undetermined"
  29. calculate_hash_for_files "${SRC}"/lib/functions/compilation/packages/armbian-config-deb.sh
  30. declare bash_hash="${hash_files}"
  31. declare bash_hash_short="${bash_hash:0:${short_hash_size}}"
  32. # outer scope
  33. artifact_version="${artifact_prefix_version}${fake_unchanging_base_version}-SA${short_sha1}-B${bash_hash_short}"
  34. declare -a reasons=(
  35. "Armbian armbian-config git revision \"${GIT_INFO_ARMBIAN_CONFIG[SHA1]}\""
  36. "framework bash hash \"${bash_hash}\""
  37. )
  38. artifact_version_reason="${reasons[*]}" # outer scope
  39. artifact_map_packages=(
  40. ["armbian-config"]="armbian-config"
  41. )
  42. artifact_map_debs=(
  43. ["armbian-config"]="armbian-config_${artifact_version}_all.deb"
  44. )
  45. artifact_name="armbian-config"
  46. artifact_type="deb"
  47. artifact_base_dir="${DEB_STORAGE}"
  48. artifact_final_file="${DEB_STORAGE}/armbian-config_${artifact_version}_all.deb"
  49. return 0
  50. }
  51. function artifact_armbian-config_build_from_sources() {
  52. LOG_SECTION="compile_armbian-config" do_with_logging compile_armbian-config
  53. }
  54. function artifact_armbian-config_cli_adapter_pre_run() {
  55. declare -g ARMBIAN_COMMAND_REQUIRE_BASIC_DEPS="yes" # Require prepare_host_basic to run before the command.
  56. # "gimme root on a Linux machine"
  57. cli_standard_relaunch_docker_or_sudo
  58. }
  59. function artifact_armbian-config_cli_adapter_config_prep() {
  60. use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
  61. }
  62. function artifact_armbian-config_get_default_oci_target() {
  63. artifact_oci_target_base="${GHCR_SOURCE}/armbian/os/"
  64. }
  65. function artifact_armbian-config_is_available_in_local_cache() {
  66. is_artifact_available_in_local_cache
  67. }
  68. function artifact_armbian-config_is_available_in_remote_cache() {
  69. is_artifact_available_in_remote_cache
  70. }
  71. function artifact_armbian-config_obtain_from_remote_cache() {
  72. obtain_artifact_from_remote_cache
  73. }
  74. function artifact_armbian-config_deploy_to_remote_cache() {
  75. upload_artifact_to_oci
  76. }