1From e207c3dbcff1d3d09c60eec99b6fec2a698b01bd Mon Sep 17 00:00:00 2001
2From: Bernardo Meurer <bernardo@meurer.org>
3Date: Fri, 22 Jul 2022 22:11:07 -0700
4Subject: [PATCH] Revert "Remove all usage of @BASH@ or ${BASH} in installed
5 files, and hardcode /bin/bash instead"
6
7We need the ability to override to use `/bin/sh` here to avoid having
8some bootstrap tools in a final build product.
9
10This reverts commit 5188a9d0265cc6f7235a8af1d31ab02e4a24853d.
11
12Co-authored-by: Maximilian Bosch <maximilian@mbosch.me>
13---
14 debug/Makefile | 5 +++--
15 debug/xtrace.sh | 2 +-
16 elf/Makefile | 4 +++-
17 elf/ldd.bash.in | 2 +-
18 elf/sotruss.sh | 2 +-
19 malloc/Makefile | 5 +++--
20 malloc/memusage.sh | 2 +-
21 timezone/Makefile | 3 ++-
22 8 files changed, 15 insertions(+), 10 deletions(-)
23
24diff --git a/debug/Makefile b/debug/Makefile
25index 3903cc97a3..b041acca71 100644
26--- a/debug/Makefile
27+++ b/debug/Makefile
28@@ -343,8 +343,9 @@ $(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o
29
30 $(objpfx)xtrace: xtrace.sh
31 rm -f $@.new
32- sed -e 's|@VERSION@|$(version)|' -e 's|@SLIBDIR@|$(sLIBdir)|' \
33- -e 's|@BINDIR@|$(bindir)|' -e 's|@PKGVERSION@|$(PKGVERSION)|' \
34+ sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
35+ -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' \
36+ -e 's|@PKGVERSION@|$(PKGVERSION)|' \
37 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
38 && rm -f $@ && mv $@.new $@ && chmod +x $@
39
40diff --git a/debug/xtrace.sh b/debug/xtrace.sh
41index 77ec1d84df..5614404a71 100755
42--- a/debug/xtrace.sh
43+++ b/debug/xtrace.sh
44@@ -1,4 +1,4 @@
45-#!/bin/bash
46+#! @BASH@
47 # Copyright (C) 1999-2024 Free Software Foundation, Inc.
48 # This file is part of the GNU C Library.
49
50diff --git a/elf/Makefile b/elf/Makefile
51index 5d78b659ce..a2145d7b64 100644
52--- a/elf/Makefile
53+++ b/elf/Makefile
54@@ -249,7 +249,8 @@ $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
55 $(common-objpfx)libc_nonshared.a
56
57 $(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
58- sed -e 's%@VERSION@%$(version)%g' \
59+ sed -e 's%@BASH@%$(BASH)%g' \
60+ -e 's%@VERSION@%$(version)%g' \
61 -e 's%@TEXTDOMAINDIR@%$(localedir)%g' \
62 -e 's%@PREFIX@%$(prefix)%g' \
63 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
64@@ -1392,6 +1393,7 @@ ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
65 -e 's%@VERSION@%$(version)%g' \
66 -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
67 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
68+ -e 's%@BASH@%$(BASH)%g' \
69 -e 's%@TEXTDOMAINDIR@%$(localedir)%g'
70
71 ifeq ($(ldd-rewrite-script),no)
72diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
73index d6b640df66..46111670cd 100644
74--- a/elf/ldd.bash.in
75+++ b/elf/ldd.bash.in
76@@ -1,4 +1,4 @@
77-#!/bin/bash
78+#! @BASH@
79 # Copyright (C) 1996-2024 Free Software Foundation, Inc.
80 # This file is part of the GNU C Library.
81
82diff --git a/elf/sotruss.sh b/elf/sotruss.sh
83index ac1a83984e..2bf17c518e 100755
84--- a/elf/sotruss.sh
85+++ b/elf/sotruss.sh
86@@ -1,4 +1,4 @@
87-#!/bin/bash
88+#! @BASH@
89 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
90 # This file is part of the GNU C Library.
91
92diff --git a/malloc/Makefile b/malloc/Makefile
93index c83ade5f10..8dd9174b79 100644
94--- a/malloc/Makefile
95+++ b/malloc/Makefile
96@@ -312,8 +312,9 @@ $(objpfx)mtrace: mtrace.pl
97
98 $(objpfx)memusage: memusage.sh
99 rm -f $@.new
100- sed -e 's|@VERSION@|$(version)|' -e 's|@SLIBDIR@|$(sLIBdir)|' \
101- -e 's|@BINDIR@|$(bindir)|' -e 's|@PKGVERSION@|$(PKGVERSION)|' \
102+ sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
103+ -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' \
104+ -e 's|@PKGVERSION@|$(PKGVERSION)|' \
105 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
106 && rm -f $@ && mv $@.new $@ && chmod +x $@
107
108diff --git a/malloc/memusage.sh b/malloc/memusage.sh
109index d2d9d17ea8..2e7efc9049 100755
110--- a/malloc/memusage.sh
111+++ b/malloc/memusage.sh
112@@ -1,4 +1,4 @@
113-#!/bin/bash
114+#! @BASH@
115 # Copyright (C) 1999-2024 Free Software Foundation, Inc.
116 # This file is part of the GNU C Library.
117
118diff --git a/timezone/Makefile b/timezone/Makefile
119index d7acb387ba..c8e203ea3a 100644
120--- a/timezone/Makefile
121+++ b/timezone/Makefile
122@@ -132,7 +132,8 @@ $(testdata)/XT5: testdata/gen-XT5.sh
123 mv $@.tmp $@
124
125 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
126- sed -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
127+ sed -e 's|/bin/bash|$(BASH)|' \
128+ -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
129 -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
130 -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
131 -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
132--
1332.42.0
134