Dmitry V. Levin
92e347b556
We do our best to keep copyright headers up to date, yet git history provides better information on this subject and is more accurate than copyright headers.
40 lines
714 B
Bash
Executable File
40 lines
714 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2017-2018 The strace developers.
|
|
# All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
: ${YEAR_FILE:=$1}
|
|
: ${DEFAULT_YEAR:=$2}
|
|
LC_TIME=C; export LC_TIME
|
|
|
|
year=
|
|
|
|
[ -n "${YEAR_FILE}" ] || {
|
|
echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
|
|
exit 1
|
|
}
|
|
|
|
[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
|
|
|
|
[ -n "${year}" ] ||
|
|
year="$(date -u +%Y -d "$(git show -s --format=format:%cD)")"
|
|
|
|
[ -n "${year}" ] ||
|
|
year="${DEFAULT_YEAR}"
|
|
|
|
[ -n "${year}" ] ||
|
|
[ -z "${SOURCE_DATE_EPOCH-}" ] ||
|
|
year="$(date -u +%Y -d "@${SOURCE_DATE_EPOCH}")"
|
|
|
|
[ -n "${year}" ] ||
|
|
year="$(date -u +%Y)"
|
|
|
|
[ -n "${year}" ] || {
|
|
echo >&2 'Undefined year.'
|
|
exit 1
|
|
}
|
|
|
|
printf "%s" "${year}"
|