]> granicus.if.org Git - strace/blob - copyright-year-gen
tests: check decoding of vcpu auxstr
[strace] / copyright-year-gen
1 #! /bin/sh
2
3 : ${YEAR_FILE:=$1}
4 : ${DEFAULT_YEAR:=$2}
5 LC_TIME=C; export LC_TIME
6
7 year=
8
9 [ -n "${YEAR_FILE}" ] || {
10         echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
11         exit 1
12 }
13
14 [ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
15
16 [ -n "${year}" ] ||
17         year="$(date -u +%Y -d "$(git show --format=format:%cD --no-patch)")"
18
19 [ -n "${year}" ] ||
20         year="${DEFAULT_YEAR}"
21
22 [ -n "${year}" ] ||
23         [ -z "${SOURCE_DATE_EPOCH-}" ] ||
24         year="$(date -u +%Y -d "@${SOURCE_DATE_EPOCH}")"
25
26 [ -n "${year}" ] ||
27         year="$(date -u +%Y)"
28
29 [ -n "${year}" ] || {
30         echo >&2 'Undefined year.'
31         exit 1
32 }
33
34 printf "%s" "${year}"