# File lib/chef/provider/service/freebsd.rb, line 131 def service_enable_variable_name # Look for name="foo" in the shell script @init_command. Use this for determining the variable name in /etc/rc.conf # corresponding to this service # For example: to enable the service mysql-server with the init command /usr/local/etc/rc.d/mysql-server, you need # to set mysql_enable="YES" in /etc/rc.conf$ if @rcd_script_found ::File.open(@init_command) do |rcscript| rcscript.each_line do |line| if line =~ /^name="?(\w+)"?/ return $1 + "_enable" end end end # some scripts support multiple instances through symlinks such as openvpn. # We should get the service name from rcvar. Chef::Log.debug("name=\"service\" not found at #{@init_command}. falling back to rcvar") sn = shell_out!("#{@init_command} rcvar").stdout[/(\w+_enable)=/, 1] return sn end # Fallback allows us to keep running in whyrun mode when # the script does not exist. @new_resource.service_name end