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
emulab
emulab-devel
Commits
43910e3a
Commit
43910e3a
authored
May 20, 2014
by
Mike Hibler
Browse files
For the fixit option (-F), if the DB hash is null, rehash it and record.
parent
4834bd06
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils/imagevalidate.in
View file @
43910e3a
...
...
@@ -247,12 +247,6 @@ sub doimage($)
$stamp
=
0
if
(
!
defined
(
$stamp
));
if
(
$fixit
)
{
print
"
$pidimage
: fixing hash file
\n
";
makehashfile
(
$path
,
$hash
);
return
0
;
}
if
(
$showinfo
)
{
print
"
$pidimage
: path:
$path
\n
";
print
"
$pidimage
: mtime:
$stamp
\n
";
...
...
@@ -290,6 +284,30 @@ sub doimage($)
return
1
;
}
if
(
$fixit
)
{
print
"
$pidimage
: fixing hash file
\n
";
if
(
$hash
eq
"")
{
$hash
=
`
$SHA1
$path
`;
if
(
$?
)
{
print
("
$pidimage
: hash: could not generate SHA1 hash of '
$path
'
\n
");
return
1
;
}
else
{
if
(
$hash
=~
/^SHA1.*= ([\da-fA-F]+)$/
)
{
$hash
=
lc
(
$
1
);
}
else
{
print
("
$pidimage
: hash: could not parse sha1 hash: '
$hash
'
\n
");
return
1
;
}
}
if
(
$image
->
SetHash
(
$hash
)
!=
0
)
{
print
("
$pidimage
: hash: could not store new hash: '
$hash
'
\n
");
return
1
;
}
}
makehashfile
(
$path
,
$hash
);
return
0
;
}
my
$rv
=
0
;
my
$changed
=
0
;
...
...
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