Skip to content

Loading…

Fix for issue #14 in bjeanes/ghost #18

Merged
merged 2 commits into from

4 participants

@LarsFronius

Fix for issue #14 in bjeanes/ghost
Looks up Mac OS X Version and uses /etc/hosts if equal or greater than 10.7.2

Lars Fronius Fix for issue #14 in bjeanes/ghost.
Looks up Mac OS X Version and uses /etc/hosts if equal or greater than 10.7.2
d1077de
@tboerger

I think is end is too much, right?

@LarsFronius

Yes it was - sorry for that!

@bjeanes bjeanes merged commit 3b63494 into bjeanes:master
@bjeanes bjeanes referenced this pull request
Closed

Not working in 10.7.2 #14

@outerim

It may be picking nits but this this isn't really fixed considering you have to be running as root on osx to write to the /etc/hosts file and using the previous mechanism you didn't. It's at least worth noting the difference anyway.

Could we detect cases where the user isn't running as root and use a sudo cat type approach as a fallback? Granted they may have to enter their password which could lead to other issues such as running in a non-interactive mode.

@LarsFronius

On linux it's the same right? So it should be fixed in the linux version, cause Mac OS > 10.7.2 uses same mechanisms now.

@LarsFronius

@outerim I looked into that, and ghost should really handle insufficient permissions better. I will take a look if I can provide a better solution for both sides Mac OS/Linux.

@bjeanes
Owner

@outerim I'm actually a fan of removing the implicit sudo in the Mac version. I wanted to remove it a long time ago but had push back from some users. IMO, no tool should ask for permission elevation (except sudo). I'd rather people be explicit about permission elevation. Removing the sudo from the dscl strategy would mean the behavior is consistent (always require sudo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 5, 2012
  1. Fix for issue #14 in bjeanes/ghost.

    Lars Fronius committed
    Looks up Mac OS X Version and uses /etc/hosts if equal or greater than 10.7.2
  2. @LarsFronius
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/ghost.rb
View
7 lib/ghost.rb
@@ -2,7 +2,12 @@
case RUBY_PLATFORM
when /darwin/
- require 'ghost/mac-host'
+ productVersion = `/usr/bin/sw_vers -productVersion`.strip
+ if productVersion =~ /^10\.7\.[2-9]{1}$/
+ require 'ghost/linux-host'
+ else
+ require 'ghost/mac-host'
+ end
when /linux/
require 'ghost/linux-host'
end
Something went wrong with that request. Please try again.