From a488d6f88cbdb29b56ac65f013f1afbd3c33dfb2 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 23 Aug 2005 06:07:33 +0000 Subject: [PATCH] Ensure that the new cell is listed in /etc/openafs/CellServDB before continuing. --- debian/afs-newcell | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/debian/afs-newcell b/debian/afs-newcell index a3da7b1cd..417f2ba37 100644 --- a/debian/afs-newcell +++ b/debian/afs-newcell @@ -147,6 +147,29 @@ open(CELL, "/etc/openafs/server/ThisCell") my $cell = ; chomp $cell; +# Make sure the new cell is configured in the client CellServDB. +open(CELLSERVDB, "/etc/openafs/CellServDB") + or die "Cannot open /etc/openafs/CellServDB: $!\n"; +my $found = 0; +while () { + next unless /^>\Q$cell\E\s/; + while () { + last if /^>/; + my ($dbserver) = split ' '; + if ($dbserver eq $ip) { + $found = 1; + last; + } + } + last; +} +unless ($found) { + print "The new cell $cell is not configured in /etc/openafs/CellServDB\n"; + print "Add configuration like:\n\n>$cell\n$ip\n\nto that file before" + . " continuing.\n"; + exit(1); +} + # Write out a new CellServDB for the local cell containing only this server. if (-f "/etc/openafs/server/CellServDB") { print "/etc/openafs/server/CellServDB already exists, renaming to .old\n"; -- 2.39.5