Update bootstrapper scripts (automated commit) [ci skip]
This commit is contained in:
parent
1b6ca7f55a
commit
629ac3e216
9
run.ps1
9
run.ps1
|
|
@ -113,9 +113,9 @@ function Get-KoreBuild {
|
||||||
try {
|
try {
|
||||||
$tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip"
|
$tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip"
|
||||||
Get-RemoteFile $remotePath $tmpfile $ToolsSourceSuffix
|
Get-RemoteFile $remotePath $tmpfile $ToolsSourceSuffix
|
||||||
if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) {
|
if (Get-Command -Name 'Microsoft.PowerShell.Archive\Expand-Archive' -ErrorAction Ignore) {
|
||||||
# Use built-in commands where possible as they are cross-plat compatible
|
# Use built-in commands where possible as they are cross-plat compatible
|
||||||
Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath
|
Microsoft.PowerShell.Archive\Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Fallback to old approach for old installations of PowerShell
|
# Fallback to old approach for old installations of PowerShell
|
||||||
|
|
@ -179,8 +179,9 @@ if (Test-Path $ConfigFile) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Warning "$ConfigFile could not be read. Its settings will be ignored."
|
Write-Host -ForegroundColor Red $Error[0]
|
||||||
Write-Warning $Error[0]
|
Write-Error "$ConfigFile contains invalid JSON."
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
19
run.sh
19
run.sh
|
|
@ -186,7 +186,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
--reinstall|-[Rr]einstall)
|
--reinstall|-[Rr]einstall)
|
||||||
reinstall=true
|
reinstall=true
|
||||||
;;
|
;;
|
||||||
--ci)
|
--ci|-[Cc][Ii])
|
||||||
ci=true
|
ci=true
|
||||||
;;
|
;;
|
||||||
--verbose|-Verbose)
|
--verbose|-Verbose)
|
||||||
|
|
@ -220,17 +220,28 @@ if [ -f "$config_file" ]; then
|
||||||
config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")"
|
config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")"
|
||||||
config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")"
|
config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")"
|
||||||
else
|
else
|
||||||
__warn "$config_file is invalid JSON. Its settings will be ignored."
|
_error "$config_file contains invalid JSON."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif __machine_has python ; then
|
elif __machine_has python ; then
|
||||||
if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then
|
if python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then
|
||||||
config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
|
config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
|
||||||
config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
|
config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
|
||||||
else
|
else
|
||||||
__warn "$config_file is invalid JSON. Its settings will be ignored."
|
_error "$config_file contains invalid JSON."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif __machine_has python3 ; then
|
||||||
|
if python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'))" >/dev/null ; then
|
||||||
|
config_channel="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
|
||||||
|
config_tools_source="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
|
||||||
|
else
|
||||||
|
_error "$config_file contains invalid JSON."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
__warn 'Missing required command: jq or pyton. Could not parse the JSON file. Its settings will be ignored.'
|
_error 'Missing required command: jq or python. Could not parse the JSON file.'
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -z "${config_channel:-}" ] && channel="$config_channel"
|
[ ! -z "${config_channel:-}" ] && channel="$config_channel"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue