timezone: Make shell interpreter overridable in tzselect.ksh

Message ID 20211209234015.1554552-1-raj.khem@gmail.com
State New, archived
Headers
Series timezone: Make shell interpreter overridable in tzselect.ksh |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Khem Raj Dec. 9, 2021, 11:40 p.m. UTC
  define new macro called KSHELL which can be used to define default shell
use Bash by default

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 Makeconfig        | 9 +++++++++
 timezone/Makefile | 1 +
 2 files changed, 10 insertions(+)
  

Comments

Paul Eggert Dec. 10, 2021, 1:42 a.m. UTC | #1
Thanks, this patch looks good to me.
  

Patch

diff --git a/Makeconfig b/Makeconfig
index 3fa2f13003..a1ea5d5571 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -292,6 +292,15 @@  ifndef sysincludedir
 sysincludedir = /usr/include
 endif
 
+# The full path name of a Posix-compliant shell, preferably one that supports
+# the Korn shell's 'select' statement as an extension.
+# These days, Bash is the most popular.
+# It should be OK to set this to /bin/sh, on platforms where /bin/sh
+# lacks 'select' or doesn't completely conform to Posix, but /bin/bash
+# is typically nicer if it works.
+ifndef KSHELL
+KSHELL = /bin/bash
+endif
 
 # Commands to install files.
 ifndef INSTALL_DATA
diff --git a/timezone/Makefile b/timezone/Makefile
index c624a189b3..dc8f5277de 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -127,6 +127,7 @@  $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
 	    -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
 	    -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
 	    -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
+	    -e 's|#!/bin/bash|#!$(KSHELL)|g' \
 	    < $< > $@.new
 	chmod 555 $@.new
 	mv -f $@.new $@