Fix download to stdout
This commit is contained in:
17
installJRMC
17
installJRMC
@@ -430,7 +430,7 @@ get_latest_mc_version() {
|
||||
mc_version_source="containerized package manager"
|
||||
execute buildah rm "$cnt"
|
||||
# Fallback to webscrape
|
||||
elif MC_VERSION=$(download "$BOARD_URL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) \
|
||||
elif MC_VERSION=$(download_stdout "$BOARD_URL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) \
|
||||
&& [[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
mc_version_source="webscrape"
|
||||
# Fallback to hardcoded value
|
||||
@@ -1802,6 +1802,21 @@ download() {
|
||||
|
||||
"${cmd[@]}" "$url"
|
||||
}
|
||||
download_stdout() {
|
||||
local url="$1"
|
||||
local -a cmd
|
||||
|
||||
if command -v curl &>/dev/null; then
|
||||
cmd=(curl --silent --fail --location -o - "$url")
|
||||
elif command -v wget &>/dev/null; then
|
||||
cmd=(wget --quiet -O - "$url")
|
||||
else
|
||||
err "Neither curl nor wget is available"
|
||||
return 1
|
||||
fi
|
||||
|
||||
"${cmd[@]}"
|
||||
}
|
||||
|
||||
# Roughly turn debugging on for pre-init
|
||||
# Reset and reparse in parse_input() with getopt
|
||||
|
||||
Reference in New Issue
Block a user