sethost: If no host options are specified, try to guess
This commit is contained in:
parent
4c0bc308cc
commit
afd03f5a7e
|
@ -34,8 +34,8 @@
|
|||
|
||||
progname=$0
|
||||
debug=n
|
||||
host=linux
|
||||
wenv=cygwin
|
||||
host=
|
||||
wenv=
|
||||
unset configfile
|
||||
|
||||
function showusage {
|
||||
|
@ -94,6 +94,32 @@ while [ ! -z "$1" ]; do
|
|||
shift
|
||||
done
|
||||
|
||||
# If the host was not explicitly given, try to guess.
|
||||
# Examples of "uname -s" outputs:
|
||||
# macOS: Darwin
|
||||
# Cygwin: CYGWIN_NT-10.0-WOW
|
||||
# Linux: Linux
|
||||
# MSYS: MINGW32_NT-6.2
|
||||
if [ -z "$host" ]; then
|
||||
case $(uname -s) in
|
||||
Darwin)
|
||||
host=macos
|
||||
;;
|
||||
CYGWIN*)
|
||||
host=windows
|
||||
wenv=cygwin
|
||||
;;
|
||||
MINGW32*)
|
||||
host=windows
|
||||
wenv=msys
|
||||
;;
|
||||
*)
|
||||
# Assume linux as a fallback
|
||||
host=linux
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
echo "ERROR: Garbage at the end of line"
|
||||
showusage
|
||||
|
|
Loading…
Reference in New Issue