From 23ba49afacc1ccc349af61c3b6d68b396188a189 Mon Sep 17 00:00:00 2001 From: Michael Raitza Date: Fri, 15 May 2020 19:51:59 +0200 Subject: [PATCH] Make location of redoconf scripts definable Introduce REDOCONF variable that can be set in 'configure' just as S. Rationale: Some people might want to hide redoconf in .redoconf and, generally, just not to fix things that can stay variable. Also fixes a bug in configure.sh, which unconditionally overwrites S. --- redoconf/configure.sh | 12 ++++++------ redoconf/default.do.sh | 3 +-- redoconf/rc.sh | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/redoconf/configure.sh b/redoconf/configure.sh index 0160493..0940330 100644 --- a/redoconf/configure.sh +++ b/redoconf/configure.sh @@ -12,17 +12,17 @@ if [ -e "configure" ] || [ -e "rc.sh" ]; then exit 99 fi -S="$(dirname "$0")" +: ${REDOCONF:="$S/redoconf"} rm -f src Makefile -echo "$S" >src +printf "%s\n%s\n" "$S" "$REDOCONF" >src # Don't regenerate these files unless they're missing. Otherwise redo # will treat it as a changed dependency and rebuild a bunch of files # unnecessarily. [ -e redoconf.rc ] || cat >redoconf.rc <<-EOF # Automatically generated by $0 - read -r S Makefile <<'EOF' # A wrapper for people who like to type 'make' instead of 'redo' @@ -41,7 +41,7 @@ EOF # Don't include rc.sh here, because that might call redo-ifchange, # and we're not ready for that yet. -. "$S/redoconf/utils.sh" +. "$REDOCONF/utils.sh" usage() { exec >&2 diff --git a/redoconf/default.do.sh b/redoconf/default.do.sh index 1d7ef52..da74052 100644 --- a/redoconf/default.do.sh +++ b/redoconf/default.do.sh @@ -1,6 +1,5 @@ # This script starts with $PWD=output dir, $S=input dir. -read -r S &2 exit 99 diff --git a/redoconf/rc.sh b/redoconf/rc.sh index 2163a15..b763911 100644 --- a/redoconf/rc.sh +++ b/redoconf/rc.sh @@ -1,5 +1,4 @@ # This script starts with $PWD=output dir, $S=input dir. -REDOCONF="$S/redoconf" if [ ! -d "$S" ] || [ ! -f "$REDOCONF/default.do.sh" ]; then echo "default.do.sh: \$S is not set correctly." >&2 exit 99