summaryrefslogtreecommitdiff
path: root/lib/sbin/CopyParFiles.pl
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-08-19 18:05:47 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-08-19 18:05:47 +0000
commit29fd4906dd3bece81802ff03488b7ac0efabf2e0 (patch)
tree070543a0d1a56ebf21cc64659dc7266ad5c8c002 /lib/sbin/CopyParFiles.pl
parent31f89c0ba1e351d952ed4d304a0751f8289f38ff (diff)
List thorn names with all parameter files and alphabetically too.
Implements Cactus/901 git-svn-id: http://svn.cactuscode.org/flesh/trunk@2966 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/CopyParFiles.pl')
-rw-r--r--lib/sbin/CopyParFiles.pl112
1 files changed, 66 insertions, 46 deletions
diff --git a/lib/sbin/CopyParFiles.pl b/lib/sbin/CopyParFiles.pl
index e3ce8778..5b2b9494 100644
--- a/lib/sbin/CopyParFiles.pl
+++ b/lib/sbin/CopyParFiles.pl
@@ -37,57 +37,77 @@ while (<THORNLIST>)
}
close(THORNLIST);
+@sorted = sort(@thorns);
+
for ($i=0;$i<$nthorns;$i++)
{
- $thorn=$thorns[$i];
- $thorn = "arrangements/$thorn/par";
- if (-d $thorn)
- {
- chdir $thorn;
- while ($parfile = <*.par>)
- {
- $gotall = 1;
- @ActiveThorns = &GetActiveThorns($parfile);
- $donothave = "";
- for ($j=0;$j<scalar(@ActiveThorns);$j++)
- {
- $gotit = 0;
- for ($k=0;$k<$nthorns;$k++)
- {
- $thorns[$k] =~ m:.*/(\w*):;
- if ($ActiveThorns[$j] =~ /^$1$/i)
- {
- $gotit = 1;
- }
- }
- if ($gotit == 0)
- {
- $donothave .= "$ActiveThorns[$j] ";
- $gotall = 0;
- }
- }
+ $thorn = $sorted[$i];
+ $thorn = "arrangements/$thorn/par";
+ if (-d $thorn)
+ {
+ $newthorn = 1;
+ chdir $thorn;
+ while ($parfile = <*.par>)
+ {
+ $gotall = 1;
+ $counter = 0;
+ @ActiveThorns = &GetActiveThorns($parfile);
+ $donothave = "";
+ for ($j=0;$j<scalar(@ActiveThorns);$j++)
+ {
+ $gotit = 0;
+ for ($k=0;$k<$nthorns;$k++)
+ {
+ $sorted[$k] =~ m:.*/(\w*):;
+ if ($ActiveThorns[$j] =~ /^$1$/i)
+ {
+ $gotit = 1;
+ }
+ }
+ if ($gotit == 0)
+ {
+ $counter++;
+ if ($counter%6 != 0)
+ {
+ $donothave .= "$ActiveThorns[$j] ";
+ }
+ else
+ {
+ $donothave .= "\n $ActiveThorns[$j] ";
+ }
+ $gotall = 0;
+ }
+ }
- if ($gotall == 1)
- {
- if (-e "$home/examples/$config/$parfile")
- {
- print " $parfile: Exists, no overwrite\n";
- }
- else
- {
- print " $parfile: Copying from $thorns[$i]\n";
- system("cp $parfile $home/examples/$config/$parfile");
- }
- }
- else
- {
- print " $parfile: Missing thorns ($donothave)\n";
+ if ($newthorn == 1)
+ {
+ print " $sorted[$i]:\n";
+ $newthorn = 0;
+ }
+
+ if ($gotall == 1)
+ {
+ if (-e "$home/examples/$config/$parfile")
+ {
+ print " $parfile: Not copied, already exists\n";
+ }
+ else
+ {
+ print " $parfile: Copied\n";
+ system("cp $parfile $home/examples/$config/$parfile");
+ }
+ }
+ else
+ {
+ $donothave =~ s/\s*$//;
+ print " $parfile: Not copied, missing thorns\n ($donothave)\n";
}
- }
-
- chdir "$home${sep}";
+ }
+
+ chdir "$home${sep}";
+
+ }
- }
}
# Parse the active thorns from a parameter file