diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2021-06-15 23:30:05 +0200 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2021-06-15 23:30:05 +0200 |
commit | d831434e95c6a3b33a8af04e630d34f078d26e4f (patch) | |
tree | 93965830662798a4c8674634110eac88bdb3a6ab /bin/redo-stamp | |
download | spiewnik-trakt-d831434e95c6a3b33a8af04e630d34f078d26e4f.tar.gz spiewnik-trakt-d831434e95c6a3b33a8af04e630d34f078d26e4f.zip |
Init
Diffstat (limited to 'bin/redo-stamp')
-rwxr-xr-x | bin/redo-stamp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/redo-stamp b/bin/redo-stamp new file mode 100755 index 0000000..8705765 --- /dev/null +++ b/bin/redo-stamp @@ -0,0 +1,29 @@ +#!/bin/sh +# redo-stamp – bourne shell implementation of DJB redo +# Copyright © 2014-2017 Nils Dagsson Moskopp (erlehmann) + +# 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. + +# Dieses Programm hat das Ziel, die Medienkompetenz der Leser zu +# steigern. Gelegentlich packe ich sogar einen handfesten Buffer +# Overflow oder eine Format String Vulnerability zwischen die anderen +# Codezeilen und schreibe das auch nicht dran. + +stamp_new=$(md5sum) +stamp_old=$(cat "$REDO_DIR/$REDO_TARGET".stamp 2>/dev/null) +if [ "$stamp_new" != "$stamp_old" ]; then + path="$REDO_DIR/$REDO_TARGET" + dir=${path%/*} + [ ! -d "$dir" ] && mkdir -p "$dir" + printf '%s' "$stamp_new" > "$REDO_DIR/$REDO_TARGET".stamp + redo-ifchange "$REDO_DIR/$REDO_TARGET".stamp + exit 0 +fi +if [ -e "$REDO_TARGET" ]; then + # Exit code 123 conveys that target was considered uptodate at runtime. + exit 123 + # FIXME: redo-stamp may not be the only dependency mechanism +fi |