From: Russ Allbery Date: Tue, 23 Aug 2005 06:07:33 +0000 (+0000) Subject: Ensure that the new cell is listed in /etc/openafs/CellServDB before X-Git-Tag: debian/1.4rc1-1~22 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=a488d6f88cbdb29b56ac65f013f1afbd3c33dfb2;p=packages%2Fo%2Fopenafs.git Ensure that the new cell is listed in /etc/openafs/CellServDB before continuing. --- 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";