Commit 9a265941 authored by anonym's avatar anonym
Browse files

Make sure TMPDIR is created before we use it.

parent ff39501d
...@@ -5,6 +5,23 @@ require 'tmpdir' ...@@ -5,6 +5,23 @@ require 'tmpdir'
# Run once, before any feature # Run once, before any feature
AfterConfiguration do |config| AfterConfiguration do |config|
if File.exist?($config["TMPDIR"])
if !File.directory?($config["TMPDIR"])
raise "Temporary directory '#{$config["TMPDIR"]}' exists but is not a " +
"directory"
end
if !File.owned?($config["TMPDIR"])
raise "Temporary directory '#{$config["TMPDIR"]}' must be owned by the " +
"current user"
end
FileUtils.chmod(0755, $config["TMPDIR"])
else
begin
Dir.mkdir($config["TMPDIR"])
rescue Errno::EACCES => e
raise "Cannot create temporary directory: #{e.to_s}"
end
end
# Start a thread that monitors a pseudo fifo file and debug_log():s # Start a thread that monitors a pseudo fifo file and debug_log():s
# anything written to it "immediately" (well, as fast as inotify # anything written to it "immediately" (well, as fast as inotify
# detects it). We're forced to a convoluted solution like this # detects it). We're forced to a convoluted solution like this
...@@ -50,23 +67,6 @@ def add_after_scenario_hook(&block) ...@@ -50,23 +67,6 @@ def add_after_scenario_hook(&block)
end end
BeforeFeature('@product') do |feature| BeforeFeature('@product') do |feature|
if File.exist?($config["TMPDIR"])
if !File.directory?($config["TMPDIR"])
raise "Temporary directory '#{$config["TMPDIR"]}' exists but is not a " +
"directory"
end
if !File.owned?($config["TMPDIR"])
raise "Temporary directory '#{$config["TMPDIR"]}' must be owned by the " +
"current user"
end
FileUtils.chmod(0755, $config["TMPDIR"])
else
begin
Dir.mkdir($config["TMPDIR"])
rescue Errno::EACCES => e
raise "Cannot create temporary directory: #{e.to_s}"
end
end
delete_all_snapshots if !KEEP_SNAPSHOTS delete_all_snapshots if !KEEP_SNAPSHOTS
if TAILS_ISO.nil? if TAILS_ISO.nil?
raise "No Tails ISO image specified, and none could be found in the " + raise "No Tails ISO image specified, and none could be found in the " +
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment