From 1e0c5f3edfd1c5c59563b31dfc7e0e395fef53ca Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 13 Jan 2017 21:23:54 -0500 Subject: Fix --- bin/post-commit.githook | 2 +- bin/write-atomic | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 bin/write-atomic (limited to 'bin') diff --git a/bin/post-commit.githook b/bin/post-commit.githook index 3f576e6..997afa3 100755 --- a/bin/post-commit.githook +++ b/bin/post-commit.githook @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -e -d="$(dirname -- "$0")" +d="$(dirname -- "$(readlink -f -- "$0")")" "$d"/auto-changelog "$d"/pre-generate &>/dev/tty & diff --git a/bin/write-atomic b/bin/write-atomic new file mode 100755 index 0000000..efb2551 --- /dev/null +++ b/bin/write-atomic @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +outfile=$1 +tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}" + +cat > "$tmpfile" || { r=$?; rm -f "$tmpfile"; exit $r; } +mv -f "$tmpfile" "$outfile" -- cgit v1.2.3