#!/bin/sh
exec 2>&1
cd <%= node['jenkins']['node']['home'] %>
exec chpst -u <%= node['jenkins']['node']['user'] %> \
  java -jar <%= node['jenkins']['node']['home'] %>/slave.jar \
<% if node['jenkins']['node']['no_certificate_check'] -%>
  -noCertificateCheck \
<% end -%>
  -jnlpUrl <%= node['jenkins']['server']['url'] %>/computer/<%= node['jenkins']['node']['name'] %>/slave-agent.jnlp \
  <%= !@options[:secret] || @options[:secret].empty? ? '' : "-secret #{@options[:secret]}" %> \
  <%= node['jenkins']['node']['jvm_options'] %>

#!/bin/sh
exec 2>&1
cd <%= node['jenkins']['node']['home'] %>
exec chpst -u <%= node['jenkins']['node']['user'] %> \
  env HOME=<%= node['jenkins']['node']['home'] %> \
  java -jar <%= node['jenkins']['node']['home'] %>/slave.jar \
<% if node['jenkins']['node']['no_certificate_check'] -%>
  -noCertificateCheck \
<% end -%>
  -jnlpUrl <%= node['jenkins']['server']['url'] %>/computer/<%= node['jenkins']['node']['name'] %>/slave-agent.jnlp \
  <%= !@options[:secret] || @options[:secret].empty? ? '' : "-secret #{@options[:secret]}" %> \
  <%= node['jenkins']['node']['jvm_options'] %>

Add a HOME variable for nodes started with JNLP
Add a HOME variable for nodes started with JNLP

Runit's chpst clears environment variables so we need to set this
explicitly.  Not having a HOME variable can cause a problem with some
jobs.  For example Ruby's expand_path method will fail.

[COOK-3841]
