Skip to content

Commit

Permalink
fix: migration of certs during homebrew upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan committed Oct 27, 2021
1 parent 163d43a commit b054cf0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,19 @@ brews:
end
# Create/migrate cert path
old_cert_path = "#{ENV['HOME']}/.vproxy"
puts ohai_title("created cert dir #{var}/vproxy/cert")
mkdir_p("#{var}/vproxy/cert", mode: 0755)
if File.exist?(old_cert_path) then
puts ohai_title("migrating certs")
mv(old_cert_path, "#{var}/vproxy/cert", force: true)
else
puts ohai_title("created cert dir #{var}/vproxy/cert")
mkdir("#{var}/vproxy/cert", mode: 0755)
certs = Dir.glob(old_cert_path+"/*.pem")
puts ohai_title("migrating #{certs.size} certs")
errs = 0
certs.each do |cert|
if File.readable?(cert)
cp(cert, "#{var}/vproxy/cert")
else
errs += 1
end
end
onoe("couldn't read #{errs} cert(s)") if errs > 0
end
end

0 comments on commit b054cf0

Please sign in to comment.