From d831434e95c6a3b33a8af04e630d34f078d26e4f Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Tue, 15 Jun 2021 23:30:05 +0200 Subject: Init --- bin/redo-ifcreate | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 bin/redo-ifcreate (limited to 'bin/redo-ifcreate') diff --git a/bin/redo-ifcreate b/bin/redo-ifcreate new file mode 100755 index 0000000..5365044 --- /dev/null +++ b/bin/redo-ifcreate @@ -0,0 +1,35 @@ +#!/bin/sh -eu +# redo-ifcreate – bourne shell implementation of DJB redo +# Copyright © 2014-2019 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. + +# redo-ifcreate takes a list of non-existent files (sources) and adds +# them as non-existence dependencies to the current target (the one +# calling redo-ifcreate). If a non-existence dependency of a target +# exists, the target will be rebuilt. + +for filename; do + # BusyBox v.1.19.3 outputs nothing for “readlink -f” on a nonexistent + # file, which means that redo-ifcreate can not canonicalize filenames. + case "${filename}" in + /*) dependency_ne="${filename}" ;; + *) dependency_ne="${PWD%/}/${filename}" ;; + esac + if [ ! -e "${dependency_ne}" ]; then + mkdir -p $(LANG=C dirname "${REDO_DIR}/${REDO_TARGET}".dependencies_ne.tmp) + printf '%s\n' "${dependency_ne}" >> "${REDO_DIR}/${REDO_TARGET}".dependencies_ne.tmp + else + printf "%sredo-ifcreate: %s exists.%s\n" "${REDO_COLOR_FAILURE}" "$dependency_ne" "${REDO_PLAIN}" >&2 + exit 1 + fi +done +exit 0 -- cgit 1.4.1