#
# Cookbook Name:: wt_scs
# Recipe:: default
#
# Copyright 2012, Webtrends
#
# All rights reserved - Do Not Redistribute
#

name         = node[:name]
user         = node[:user]
group        = node[:group]
tarball      = node[:tarball]
log_dir      = node[:log_dir]
install_dir  = node[:install_dir]
download_url = node[:download_url]

remote_file "/tmp/#{tarball}" do
  source download_url
  mode "0644"
end

execute "tar" do
  user  "root"
  group "root"
  cwd install_dir
  command "tar zxf /tmp/#{tarball}"
end

directory "#{log_dir}" do
  owner "root"
  group "root"
  mode "0755"
  recursive true
  action :create
end

directory "#{install_dir}/#{name}/bin" do
  owner "root"
  group "root"
  mode "0755"
  recursive true
  action :create
end

template "#{install_dir}/#{name}/bin/#{name}" do
  source "#{name}.erb"
  owner "root"
  group "root"
  mode  "0755"
end

runit_service "#{name}" do
  action :start
end

execute "delete_install_source" do
  user "root"
  group "root"
  run "rm -f /tmp/#{tarball}"
end
#
# Cookbook Name:: wt_scs
# Recipe:: default
#
# Copyright 2012, Webtrends
#
# All rights reserved - Do Not Redistribute
#

name         = node[:name]
user         = node[:user]
group        = node[:group]
tarball      = node[:tarball]
log_dir      = node[:log_dir]
install_dir  = node[:install_dir]
download_url = node[:download_url]


directory "#{log_dir}" do
  owner "root"
  group "root"
  mode "0755"
  recursive true
  action :create
end

directory "#{install_dir}/#{name}/bin" do
  owner "root"
  group "root"
  mode "0755"
  recursive true
  action :create
end

remote_file "/tmp/#{tarball}" do
  source download_url
  mode "0644"
end

execute "tar" do
  user  "root"
  group "root"
  cwd install_dir
  command "tar zxf /tmp/#{tarball}"
end

template "#{install_dir}/#{name}/bin/#{name}" do
  source "#{name}.erb"
  owner "root"
  group "root"
  mode  "0755"
end

runit_service "#{name}" do
  action :start
end

execute "delete_install_source" do
  user "root"
  group "root"
  run "rm -f /tmp/#{tarball}"
end
Create the directories before we try to download the tar and CD into a directory that might not exist
Create the directories before we try to download the tar and CD into a
directory that might not exist


Former-commit-id: 9adbfba33e9f8ddeeb5eb2c28b58911e56fa92d4 [formerly 57554f6e8a52c05e1060ca88daecbcb79c87f5fe] [formerly 8b8359aacd9cdc7fc214713b5a54ab86d907eed4 [formerly 212196c974e4817df2d9459a71dae74432472916 [formerly 6260726c1877902a350d33dc3b40bdb8dcabb071]]]
Former-commit-id: 3b0d026df3ee8b46dfa45cd8c121b65bb52c2e8e [formerly 5a3e2b56d4e4a357d4557e79162ca45f61cd9b6d]
Former-commit-id: 86be87f689ae8b0563cf961bb50ce87c51457de8
Former-commit-id: ce1c074189b88a6d267ce9ab040c398e12b97443