Commit 60a7d1d6 authored by Mike Hibler's avatar Mike Hibler

Add a DoneIfContains() function that is a more general DoneIfEdited().

Did this before I realized how DoneIfEdited worked, but it seems like a
useful function to have for something someday.
parent 381e67a3
#!/usr/bin/perl -w
#
# Copyright (c) 2003-2015 University of Utah and the Flux Group.
# Copyright (c) 2003-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -427,6 +427,21 @@ sub DoneIfEdited($) {
close(FH);
}
#
# Similar to DoneIfEdited, but look for the existance of a user specified
# string in the file.
#
sub DoneIfContains($$) {
my ($filename,$magic_string) = @_;
if (!$filename) { PhaseFail("Bad filename passed to DoneIfContains"); }
open(FH,$filename) or return;
if (grep /$magic_string/, <FH>) {
close(FH);
PhaseSkip("File already contains desired info");
}
close(FH);
}
#
# Check to see if the phase is already done, as evidenced by the fact that two
# files are identical
......
Markdown is supported
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