compile.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. # DO NOT EDIT THIS FILE
  10. # use configuration files like config-default.conf to set the build configuration
  11. # check Armbian documentation https://docs.armbian.com/ for more info
  12. #set -o pipefail # trace ERR through pipes - will be enabled "soon"
  13. #set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
  14. set -e
  15. set -o errtrace # trace ERR through - enabled
  16. set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
  17. # Important, go read http://mywiki.wooledge.org/BashFAQ/105 NOW!
  18. SRC="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
  19. cd "${SRC}" || exit
  20. # check for whitespace in ${SRC} and exit for safety reasons
  21. grep -q "[[:space:]]" <<< "${SRC}" && {
  22. echo "\"${SRC}\" contains whitespace. Not supported. Aborting." >&2
  23. exit 1
  24. }
  25. # Sanity check.
  26. if [[ ! -f "${SRC}"/lib/single.sh ]]; then
  27. echo "Error: missing build directory structure"
  28. echo "Please clone the full repository https://github.com/armbian/build/"
  29. exit 255
  30. fi
  31. # shellcheck source=lib/single.sh
  32. source "${SRC}"/lib/single.sh
  33. # initialize logging variables. (this does not consider parameters at this point, only environment variables)
  34. logging_init
  35. # initialize the traps
  36. traps_init
  37. # make sure git considers our build system dir as a safe dir (only if actually building)
  38. [[ "${CONFIG_DEFS_ONLY}" != "yes" && "${PRE_PREPARED_HOST}" != "yes" ]] && git_ensure_safe_directory "${SRC}"
  39. # Execute the main CLI entrypoint.
  40. cli_entrypoint "$@"
  41. # Log the last statement of this script for debugging purposes.
  42. display_alert "Armbian build script exiting" "very last thing" "cleanup"