download_prebuilt.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. top_dir=`dirname $0`
  33. out_dir=$top_dir
  34. optlib_name=optimized_libs-2.1.3_with_license.tar
  35. ae_file_name=prebuilt-ae-2.1.3.tar
  36. server_url_path=https://download.01.org/intel-sgx/linux-2.1.3/
  37. server_optlib_url=$server_url_path/$optlib_name
  38. server_ae_url=$server_url_path/$ae_file_name
  39. optlib_sha256=5a40b2b34f9a41f42bc4dd95761168e22eb63948ffce856f540d28a60b32ef93
  40. ae_sha256=022fadd5a72234282176c09695c08b755defcffb82ea47b7dd9337c2f43b8378
  41. rm -rf $out_dir/$optlib_name
  42. wget $server_optlib_url -P $out_dir
  43. if [ $? -ne 0 ]; then
  44. echo "Fail to download file $server_optlib_url"
  45. exit -1
  46. fi
  47. sha256sum $out_dir/$optlib_name > check_sum.txt
  48. grep $optlib_sha256 check_sum.txt
  49. if [ $? -ne 0 ]; then
  50. echo "File $server_optlib_url checksum failure"
  51. exit -1
  52. fi
  53. rm -rf $out_dir/$ae_file_name
  54. wget $server_ae_url -P $out_dir
  55. if [ $? -ne 0 ]; then
  56. echo "Fail to download file $server_ae_url"
  57. exit -1
  58. fi
  59. sha256sum $out_dir/$ae_file_name > check_sum.txt
  60. grep $ae_sha256 check_sum.txt
  61. if [ $? -ne 0 ]; then
  62. echo "File $server_ae_url checksum failure"
  63. exit -1
  64. fi
  65. pushd $out_dir;tar -xf $optlib_name;tar -xf $ae_file_name;rm -f $optlib_name;rm -f $ae_file_name;popd