Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tails
tails
Commits
9a265941
Commit
9a265941
authored
Sep 15, 2015
by
anonym
Browse files
Make sure TMPDIR is created before we use it.
parent
ff39501d
Changes
1
Hide whitespace changes
Inline
Side-by-side
features/support/hooks.rb
View file @
9a265941
...
...
@@ -5,6 +5,23 @@ require 'tmpdir'
# Run once, before any feature
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
# anything written to it "immediately" (well, as fast as inotify
# detects it). We're forced to a convoluted solution like this
...
...
@@ -50,23 +67,6 @@ def add_after_scenario_hook(&block)
end
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
if
TAILS_ISO
.
nil?
raise
"No Tails ISO image specified, and none could be found in the "
+
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment