Skip to content

Commit ca4e23d

Browse files
committed
Windows TEMP envvar (if exists) & recursive
Using the Windows TEMP envvar for file storage (if it exists), and added recursive directory creation.
1 parent bea01ec commit ca4e23d

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

recipes/default.rb

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,29 @@
3434
else
3535
installer = "strawberry-perl-#{node['perl']['maj_version']}.#{node['perl']['min_version']}.#{node['perl']['sub_version']}-#{node['perl']['bitness']}.msi"
3636

37-
directory 'C:\\temp\\' do
38-
action :create
39-
owner "administrator"
40-
group "administrators"
41-
mode 0774
42-
end
37+
tempdir = "#{ENV['TEMP']}"
4338

39+
if tempdir.nil? || tempdir == ''
40+
tempdir = 'C:\\temp\\'
41+
42+
#directory 'C:\\temp\\' do
43+
directory "#{tempdir}" do
44+
action :create
45+
inherits true
46+
owner "administrator"
47+
group "administrators"
48+
end
49+
end
50+
4451
directory node['perl']['install_dir'] do
4552
action :create
53+
recursive true
54+
inherits true
4655
owner "administrator"
4756
group "administrators"
48-
mode 0774
4957
end
5058

51-
remote_file "C:\\temp\\#{installer}" do
59+
remote_file "#{tempdir}\\#{installer}" do
5260
source "https://strawberry-perl.googlecode.com/files/#{installer}"
5361
action :create
5462
owner "administrator"
@@ -57,7 +65,7 @@
5765
end
5866

5967
execute "Install StrawberryPerl" do
60-
command "msiexec /qn /i C:\\temp\\#{installer} INSTALLDIR=#{node['perl']['install_dir']} PERL_PATH=YES"
68+
command "msiexec /qn /i #{tempdir}\\#{installer} INSTALLDIR=#{node['perl']['install_dir']} PERL_PATH=YES"
6169
not_if { File.exists?("#{node['perl']['install_dir']}\\perl\\bin\\perl.exe") }
6270
end
6371

0 commit comments

Comments
 (0)