mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
b19a54d2f9
git-subtree-dir: build/dobuild git-subtree-split: b017db7c22e7c0ca6cee3f0f5ac1dd50f3b68eb9
41 lines
859 B
Bash
Executable File
41 lines
859 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
#
|
|
# This file is part of dobuild.
|
|
# Copyright (c) 2019 Contributors as noted in the AUTHORS file.
|
|
#
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
exec 0<&-
|
|
|
|
set -e
|
|
|
|
export LANG=C
|
|
export LC_ALL=C
|
|
|
|
TOPDIR="$1"
|
|
|
|
[ -z "$TOPDIR" ] || cd "$TOPDIR"
|
|
|
|
try_git() {
|
|
[ -d .git ] || return 1
|
|
git show -s --format=format:%ct HEAD
|
|
}
|
|
|
|
try_svn() {
|
|
[ -d .svn ] || return 1
|
|
LAST_CHANGED_DATE="$(svn info | sed -n -e 's/^Last Changed Date: //p')"
|
|
[ -n "$LAST_CHANGED_DATE" ] || return 2
|
|
SOURCE_DATE_EPOCH="$(date -d "$LAST_CHANGED_DATE" +%s)"
|
|
}
|
|
|
|
try_mtime() {
|
|
stat -c '%Y' "$PWD"
|
|
}
|
|
|
|
SOURCE_DATE_EPOCH="$(try_git || try_svn || try_mtime)"
|
|
echo "$SOURCE_DATE_EPOCH"
|