kernel: update kernel 4.4 to version 4.4.22
[openwrt/openwrt.git] / scripts / get_source_date_epoch.sh
1 #!/usr/bin/env bash
2 export LANG=C
3 export LC_ALL=C
4 [ -n "$TOPDIR" ] && cd $TOPDIR
5
6 try_version() {
7 [ -f version.date ] || return 1
8 SOURCE_DATE_EPOCH="$(cat version.date)"
9 [ -n "$SOURCE_DATE_EPOCH" ]
10 }
11
12 try_git() {
13 [ -e .git ] || return 1
14 SOURCE_DATE_EPOCH="$(git log -1 --format=format:%ct)"
15 [ -n "$SOURCE_DATE_EPOCH" ]
16 }
17
18 try_hg() {
19 [ -d .hg ] || return 1
20 SOURCE_DATE_EPOCH=""
21 [ -n "$SOURCE_DATE_EPOCH" ]
22 }
23
24 try_version || try_git || try_hg || SOURCE_DATE_EPOCH=""
25 echo "$SOURCE_DATE_EPOCH"