Skip to content

Commit

Permalink
fix: Make startup scripts a little more foolproof (quarkusio#883)
Browse files Browse the repository at this point in the history
The scripts will now detect if an install is missing
a required file and try to re-download.
  • Loading branch information
quintesse authored May 29, 2021
1 parent 7c7937a commit 118a69f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/scripts/jbang
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ if [ -f "$abs_jbang_dir/jbang.jar" ]; then
elif [ -f "$abs_jbang_dir/.jbang/jbang.jar" ]; then
jarPath=$abs_jbang_dir/.jbang/jbang.jar
else
if [ ! -f "$JBDIR/bin/jbang.jar" ]; then
if [ ! -f "$JBDIR/bin/jbang.jar" || ! -f "$JBDIR/bin/jbang" ]; then
echo "Downloading JBang..." 1>&2
mkdir -p "$TDIR/urls"
jburl="https://github.com/jbangdev/jbang/releases/latest/download/jbang.tar"
Expand Down
4 changes: 2 additions & 2 deletions src/main/scripts/jbang.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ if (Test-Path "$PSScriptRoot\jbang.jar") {
} elseif (Test-Path "$PSScriptRoot\.jbang\jbang.jar") {
$jarPath="$PSScriptRoot\.jbang\jbang.jar"
} else {
if (Test-Path "$JBDIR\bin\jbang.jar.new") {
if (Test-Path "$JBDIR\bin\jbang.jar.new" -and Test-Path "$JBDIR\bin\jbang.ps1") {
Move-Item -Path "$JBDIR\bin\jbang.jar.new" -Destination"$JBDIR\bin\jbang.jar" -Force
} elseif (-not (Test-Path "$JBDIR\bin\jbang.jar")) {
} elseif (-not (Test-Path "$JBDIR\bin\jbang.jar") -or -not (Test-Path "$JBDIR\bin\jbang.ps1")) {
[Console]::Error.WriteLine("Downloading JBang...")
New-Item -ItemType Directory -Force -Path "$TDIR\urls" >$null 2>&1
$jburl="https://github.com/jbangdev/jbang/releases/latest/download/jbang.zip"
Expand Down

0 comments on commit 118a69f

Please sign in to comment.