Every instance of exit 2 >&2 "message here" should be replaced with:
>&2 echo "message here"
exit 2
The former does not work, and does not exit either, because exit is called with too many arguments. This then leads to odd failure conditions later in the script.
Patch for tools.sh follows:
diff --git a/tools/download.sh b/tools/download.sh
index e37acf8..0617985 100755
--- a/tools/download.sh
+++ b/tools/download.sh
@@ -27,18 +27,22 @@ case "$OSTYPE" in
version=ubuntu1.16.04.1_amd64.deb
;;
*)
- exit 2 >&2 "Ubuntu $VERSION_ID is not supported!"
+ >&2 echo "Ubuntu $VERSION_ID is not supported!"
+ exit 2
esac
;;
*)
- exit 2 >&2 "$NAME is not supported!"
+ >&2 echo "$NAME is not supported!"
+ exit 2
+ ;;
esac
;;
darwin*)
version=pkg
;;
*)
- exit 2 >&2 "$OSTYPE is not supported!"
+ >&2 echo "$OSTYPE is not supported!"
+ exit 2
;;
esac
This might need its own issue, but seems related: build.psm1 is chock full of hard coded distribution checks, which is causing build failures on Arch Linux (PowerShell itself runs fine with freshly built files from the dotnet-cli package from the AUR dropped in to the /opt/microsoft/powershell-foo directory) and will act as a significant blocker for bootstrapping on Alpine, Debian, or any other distribution not already listed.
This is inefficient, awkward, and wrongheaded. An upstream build system like PowerShell's should focus on building the executables and libraries needed, and possibly include an installation makefile/psbuild target to drop them into a relative directory.
Let the distributions' package management teams take advantage of that relative-directory installation target and handle packaging themselves. I guarantee they'll do a better job than Microsoft will, judging by the inadequate code quality in all the Unix-native stuff like build.sh so far. Even Valve recognizes the benefit their platform receives from allowing binary redistribution and repackaging of the Steam application for Linux. The only reason to _not_ delegate packaging to the distributions is if Microsoft was planning on taking PowerShell so proprietary that even binary redistribution is banned.
That's not anything we have to worry about, RIGHT?
This is a download script. I have not added support for it to recognize other platforms. If you want to install a package on an unsupported platform, please install the package manually rather than using a convenience script.
Hey what version of Bash are you using here? exit isn't being called with any additional arguments, the error message is being sent to the shells redirection operator.
If this fails for you, please provide me with the information I need to debug.
Fixed it. I guess I got lucky and never tried to install on unsupported platforms :smile:
For the curious:
$ bash --version
GNU bash, version 4.3.46(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Most helpful comment
This might need its own issue, but seems related: build.psm1 is chock full of hard coded distribution checks, which is causing build failures on Arch Linux (PowerShell itself runs fine with freshly built files from the
dotnet-clipackage from the AUR dropped in to the /opt/microsoft/powershell-foo directory) and will act as a significant blocker for bootstrapping on Alpine, Debian, or any other distribution not already listed.This is inefficient, awkward, and wrongheaded. An upstream build system like PowerShell's should focus on building the executables and libraries needed, and possibly include an installation makefile/psbuild target to drop them into a relative directory.
Let the distributions' package management teams take advantage of that relative-directory installation target and handle packaging themselves. I guarantee they'll do a better job than Microsoft will, judging by the inadequate code quality in all the Unix-native stuff like build.sh so far. Even Valve recognizes the benefit their platform receives from allowing binary redistribution and repackaging of the Steam application for Linux. The only reason to _not_ delegate packaging to the distributions is if Microsoft was planning on taking PowerShell so proprietary that even binary redistribution is banned.
That's not anything we have to worry about, RIGHT?