unbound: fix post_install. (#12093)
Ensure that we check the configuration file exists and simplify by using the `Pathname`.
This commit is contained in:
parent
f8195fcf7f
commit
2e91cc6cd1
1 changed files with 5 additions and 3 deletions
|
@ -43,9 +43,11 @@ class Unbound < Formula
|
|||
end
|
||||
|
||||
def post_install
|
||||
if File.read(etc/"unbound/unbound.conf").include?('username: "@@HOMEBREW-UNBOUND-USER@@"')
|
||||
inreplace etc/"unbound/unbound.conf", 'username: "@@HOMEBREW-UNBOUND-USER@@"', "username: \"#{ENV["USER"]}\""
|
||||
end
|
||||
conf = etc/"unbound/unbound.conf"
|
||||
return unless conf.exist?
|
||||
return unless conf.read.include?('username: "@@HOMEBREW-UNBOUND-USER@@"')
|
||||
inreplace conf, 'username: "@@HOMEBREW-UNBOUND-USER@@"',
|
||||
"username: \"#{ENV["USER"]}\""
|
||||
end
|
||||
|
||||
plist_options :startup => true
|
||||
|
|
Loading…
Reference in a new issue