compat.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright 2015 The Crashpad Authors. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
  15. echo "${0}: this file must be sourced, not run directly" >& 2
  16. exit 1
  17. fi
  18. # Some extensions of command-line tools behave differently on different systems.
  19. # $sed_ext should be a sed invocation that enables extended regular expressions.
  20. # $date_time_t should be a date invocation that causes it to print the date and
  21. # time corresponding to a time_t string that immediately follows it.
  22. case "$(uname -s)" in
  23. Darwin)
  24. sed_ext="sed -E"
  25. date_time_t="date -r"
  26. ;;
  27. Linux)
  28. sed_ext="sed -r"
  29. date_time_t="date -d@"
  30. ;;
  31. *)
  32. echo "${0}: unknown operating system" >& 2
  33. exit 1
  34. ;;
  35. esac