Remove bash dep from init scripts#98781
Conversation
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure Issue Detailsupstream changes dotnet/arcade#14500
|
| illumos_*) | ||
| nonPortableRid=openindiana-"$targetArch" | ||
| ;; | ||
| __smartos_major_version=$(echo "$__uname_version" | cut -c9-10) |
There was a problem hiding this comment.
Is this a typo? Or is the range also 9-10?
There was a problem hiding this comment.
Bash syntax was 'skip 8 chars and select next two', new syntax is 'cut/select characters 9 and 10'.
| VERSION_ID="${VERSION_ID%.*}" | ||
| . "${rootfsDir}/etc/os-release" | ||
| if [ "${ID}" = "rhel" ] || [ "${ID}" = "rocky" ] || [ "${ID}" = "alpine" ]; then | ||
| VERSION_ID="${VERSION_ID%.*}" # Remove the last version digit for these distros |
There was a problem hiding this comment.
We stopped using it this trimming type of expansion for __solaris_major_version but not here. Is there difference in shell supports?
There was a problem hiding this comment.
ChatGPT's reply:
If your target environments are systems that are 15 years old or newer, you are generally in a safe zone regarding the support for ${variable%pattern} parameter expansion. This feature is part of the POSIX standard, and most Unix-like systems from the last 15 years would have /bin/sh linked to a shell that supports POSIX parameter expansion
so advanced ops like substring extraction ${string:position:length} are bash-specific. So I think we can safely use that parameter expansion syntax for now.

upstream changes dotnet/arcade#14500