mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 03:32:24 +00:00
iffe: fix broken shell detection; allow building on NetBSD 9.0
The shell detection test assumed that any shell that has $RANDOM and isn't bash must be ksh and have the 'print' built-in command. This broke iffe on NetBSD 9.0 sh, which has $RANDOM but not 'print'. src/cmd/INIT/iffe.sh: - Rewrite shell detection test to test for features actually used by iffe. "$shell" can now have the values 'bsh' for an ancient pre-POSIX Bourne shell, 'bash' for bash, 'ksh' for a shell with 'let', 'typeset -u' and 'print' (ksh88, ksh93, mksh, pdksh, zsh), and 'posix' for another POSIX or POSIX-ish shell with modern command substitutions and parameter substitutions. (The 'posix' value currently is not actively checked for anywhere, but avoids unnecessary use of bsh fallbacks.)
This commit is contained in:
parent
506bd2b23a
commit
42d1651108
1 changed files with 10 additions and 7 deletions
|
@ -649,16 +649,19 @@ protoflags=
|
|||
puthdr=
|
||||
putlib=
|
||||
pragma=
|
||||
case $RANDOM in
|
||||
$RANDOM)shell=bsh
|
||||
case `eval 'v=NOposixNO; w=$(export "w=$v"; echo "${w%%NO}"); echo "${w##NO}"' 2>/dev/null` in
|
||||
posix) shell=posix # or at least POSIX-ish
|
||||
case $BASH_VERSION in
|
||||
[1-9]*) shell=bash ;;
|
||||
esac
|
||||
case `eval 'PATH=/dev/null && let i=93-5 && typeset -u v=ksh$i && print -r - "$v"' 2>/dev/null` in
|
||||
KSH88) shell=ksh ;; # also pdksh, mksh, zsh
|
||||
esac
|
||||
;;
|
||||
*) shell=bsh # ancient pre-POSIX Bourne shell
|
||||
($executable .) 2>/dev/null || executable='test -r'
|
||||
($exists .) 2>/dev/null || exists='test -r'
|
||||
;;
|
||||
*) case $BASH_VERSION in
|
||||
?*) shell=bash ;;
|
||||
*) shell=ksh ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
reallystatic=
|
||||
reallystatictest=
|
||||
|
|
Loading…
Reference in a new issue