createTarball.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (C) 2011-2018 Intel Corporation. All rights reserved.
  4. #
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. #
  9. # * Redistributions of source code must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above copyright
  12. # notice, this list of conditions and the following disclaimer in
  13. # the documentation and/or other materials provided with the
  14. # distribution.
  15. # * Neither the name of Intel Corporation nor the names of its
  16. # contributors may be used to endorse or promote products derived
  17. # from this software without specific prior written permission.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. #
  31. #
  32. set -e
  33. SCRIPT_DIR=$(dirname "$0")
  34. ROOT_DIR="${SCRIPT_DIR}/../../../../"
  35. BUILD_DIR="${ROOT_DIR}/build/linux"
  36. LINUX_INSTALLER_DIR="${ROOT_DIR}/linux/installer"
  37. LINUX_INSTALLER_COMMON_DIR="${LINUX_INSTALLER_DIR}/common"
  38. INSTALL_PATH=${SCRIPT_DIR}/output
  39. # Cleanup
  40. rm -fr ${INSTALL_PATH}
  41. # Get the architecture of the build from generated binary
  42. get_arch()
  43. {
  44. local a=$(readelf -h $BUILD_DIR/sgx_sign | sed -n '2p' | awk '/:/{print $6}')
  45. test $a = 02 && echo 'x64' || echo 'x86'
  46. }
  47. ARCH=$(get_arch)
  48. # Get the configuration for this package
  49. source ${SCRIPT_DIR}/installConfig.${ARCH}
  50. # Fetch the gen_source script
  51. cp ${LINUX_INSTALLER_COMMON_DIR}/gen_source/gen_source.py ${SCRIPT_DIR}
  52. # Copy the files according to the BOM
  53. python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/psw_base.txt
  54. python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/psw_${ARCH}.txt --cleanup=false
  55. python ${SCRIPT_DIR}/gen_source.py --bom=../licenses/BOM_license.txt --cleanup=false
  56. # Create the tarball
  57. pushd ${INSTALL_PATH} &> /dev/null
  58. tar -zcvf ${TARBALL_NAME} *
  59. popd &> /dev/null