methods/in_osx.rb
# Check OSC DHCP installation on OS X
Check OSC DHCP installation on OS X
Check OSC DHCP installation on OS X
def check_osx_dhcpd_installed(options)
  brew_file   = "/usr/local/Library/Formula/isc-dhcp.rb"
  backup_file = brew_file+".orig"
  dhcpd_bin   = "/usr/local/sbin/dhcpd"
  if not File.symlink?(dhcpd_bin)
    pkg_name = "bind"
    install_brew_pkg(pkg_name)
    message  = "Information:\tUpdating Brew sources list"
    command  = "brew update"
    execute_command(options,message,command)
    message  = "Information:\tChecking OS X Version"
    command  = "sw_vers |grep ProductVersion |awk '{print $2}'"
    output   = execute_command(options,message,command)
    if output.match(/10\.9/)
      if File.exist?(brew_file)
        message = "Information:\tChecking version of ISC DHCPd"
        command = "cat #{brew_file} | grep url"
        output  = execute_command(options,message,command)
        if output.match(/4\.2\.5\-P1/)
          message = "Information:\tArchiving Brew file "+brew_file+" to "+backup_file
          command = "cp #{brew_file} #{backup_file}"
          execute_command(options,message,command)
          message = "Information:\tFixing Brew configuration file "+brew_file
          command = "cat #{backup_file} | grep -v sha1 | sed 's/4\.2\.5\-P1/4\.3\.0rc1/g' > #{brew_file}"
          execute_command(options,message,command)
        end
        pkg_name = "isc-dhcp"
        install_brew_pkg(pkg_name)
      end
        message = "Information:\tCreating Launchd service for ISC DHCPd"
        command = "cp -fv /usr/local/opt/isc-dhcp/*.plist /Library/LaunchDaemons"
        execute_command(options,message,command)
    end
    if not File.exist?(options['dhcpdfile'])
      message = "Information:\tCreating DHCPd configuration file "+options['dhcpdfile']
      command = "touch #{options['dhcpdfile']}"
      execute_command(options,message,command)
    end
  end
  return
end
def check_osx_dhcpd_installed ( options ) brew_file = "/usr/local/Library/Formula/isc-dhcp.rb" backup_file = brew_file + ".orig" dhcpd_bin = "/usr/local/sbin/dhcpd" if not File . symlink? ( dhcpd_bin ) pkg_name = "bind" install_brew_pkg ( pkg_name ) message = "Information:\tUpdating Brew sources list" command = "brew update" execute_command ( options , message , command ) message = "Information:\tChecking OS X Version" command = "sw_vers |grep ProductVersion |awk '{print $2}'" output = execute_command ( options , message , command ) if output . match ( / 10 \. 9 / ) if File . exist? ( brew_file ) message = "Information:\tChecking version of ISC DHCPd" command = "cat #{brew_file} | grep url" output = execute_command ( options , message , command ) if output . match ( / 4 \. 2 \. 5 \- P1 / ) message = "Information:\tArchiving Brew file " + brew_file + " to " + backup_file command = "cp #{brew_file} #{backup_file}" execute_command ( options , message , command ) message = "Information:\tFixing Brew configuration file " + brew_file command = "cat #{backup_file} | grep -v sha1 | sed 's/4\.2\.5\-P1/4\.3\.0rc1/g' > #{brew_file}" execute_command ( options , message , command ) end pkg_name = "isc-dhcp" install_brew_pkg ( pkg_name ) end message = "Information:\tCreating Launchd service for ISC DHCPd" command = "cp -fv /usr/local/opt/isc-dhcp/*.plist /Library/LaunchDaemons" execute_command ( options , message , command ) end if not File . exist? ( options [ 'dhcpdfile' ] ) message = "Information:\tCreating DHCPd configuration file " + options [ 'dhcpdfile' ] command = "touch #{options['dhcpdfile']}" execute_command ( options , message , command ) end end return end
Check OSC DHCP installation on OS X
Check OSC DHCP installation on OS X
options
<not_specific>