Skip to content

Commit 4d80d1e

Browse files
committed
Handle existing install artifacts gracefully
1 parent 19cd4a8 commit 4d80d1e

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

lib/arduino_ci/arduino_installation.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,25 @@ def force_install
7878
when :linux
7979
pkgname = "arduino-#{DESIRED_ARDUINO_IDE_VERSION}"
8080
tarfile = "#{pkgname}-linux64.tar.xz"
81-
system("wget", "https://downloads.arduino.cc/#{tarfile}")
82-
system("tar", "xf", tarfile)
83-
system("mv", pkgname, force_install_location)
81+
if File.exist? tarfile
82+
puts "Arduino tarfile seems to have been downloaded already"
83+
else
84+
puts "Downloading Arduino binary with wget"
85+
system("wget", "https://downloads.arduino.cc/#{tarfile}")
86+
end
87+
88+
if File.exist? pkgname
89+
puts "Tarfile seems to have been extracted already"
90+
else
91+
puts "Extracting archive with tar"
92+
system("tar", "xf", tarfile)
93+
end
94+
95+
if File.exist? force_install_location
96+
puts "Arduino binary seems to have already been force-installed"
97+
else
98+
system("mv", pkgname, force_install_location)
99+
end
84100
end
85101
end
86102

0 commit comments

Comments
 (0)