Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

copyright-year-gen 714B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2017-2018 The strace developers.
  4. # All rights reserved.
  5. #
  6. # SPDX-License-Identifier: LGPL-2.1-or-later
  7. : ${YEAR_FILE:=$1}
  8. : ${DEFAULT_YEAR:=$2}
  9. LC_TIME=C; export LC_TIME
  10. year=
  11. [ -n "${YEAR_FILE}" ] || {
  12. echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
  13. exit 1
  14. }
  15. [ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
  16. [ -n "${year}" ] ||
  17. year="$(date -u +%Y -d "$(git show -s --format=format:%cD)")"
  18. [ -n "${year}" ] ||
  19. year="${DEFAULT_YEAR}"
  20. [ -n "${year}" ] ||
  21. [ -z "${SOURCE_DATE_EPOCH-}" ] ||
  22. year="$(date -u +%Y -d "@${SOURCE_DATE_EPOCH}")"
  23. [ -n "${year}" ] ||
  24. year="$(date -u +%Y)"
  25. [ -n "${year}" ] || {
  26. echo >&2 'Undefined year.'
  27. exit 1
  28. }
  29. printf "%s" "${year}"