blob: 536504440c530c31669aa3c0785ee2b991146e46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
|