| 1 | #!/usr/bin/perl | ||
| 2 | # | ||
| 3 | # genprepundo.pl | ||
| 4 | # | ||
| 5 | # Initialize undo file for Clustered Genezzo | ||
| 6 | # | ||
| 7 | # | ||
| 8 | use strict; | ||
| 9 | use warnings; | ||
| 10 | use Getopt::Long; | ||
| 11 | use Carp; | ||
| 12 | use Genezzo::Contrib::Clustered::PrepUndo; | ||
| 13 | use Pod::Usage; | ||
| 14 | |||
| 15 | =head1 NAME | ||
| 16 | |||
| 17 | genprepundo.pl - Prepare undo file for Clustered Genezzo | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | B<genprepundo.pl> [options] | ||
| 22 | |||
| 23 | Options: | ||
| 24 | |||
| 25 | -help brief help message | ||
| 26 | -man full documentation | ||
| 27 | -gnz_home supply a directory for the gnz_home | ||
| 28 | -undo_filename name of the undo file | ||
| 29 | -number_of_processes | ||
| 30 | -undo_blocks_per_process | ||
| 31 | |||
| 32 | =head1 OPTIONS | ||
| 33 | |||
| 34 | =over 8 | ||
| 35 | |||
| 36 | =item B<-help> | ||
| 37 | |||
| 38 | Print a brief help message and exits. | ||
| 39 | |||
| 40 | =item B<-man> | ||
| 41 | |||
| 42 | Prints the manual page and exits. | ||
| 43 | |||
| 44 | =item B<-gnz_home> | ||
| 45 | |||
| 46 | Supply the location for the gnz_home installation. If | ||
| 47 | specified, it overrides the GNZ_HOME environment variable. | ||
| 48 | |||
| 49 | =item B<-undo_filename> | ||
| 50 | |||
| 51 | Supply the name of the undo file. If not specified, it | ||
| 52 | defaults to undo.und for file system devices. It must | ||
| 53 | be specified for raw devices. | ||
| 54 | |||
| 55 | =item B<-number_of_processes> | ||
| 56 | |||
| 57 | Specify the maximum number of processes supported by undo. | ||
| 58 | If not specified defaults to 256. | ||
| 59 | |||
| 60 | =item B<-undo_blocks_per_process> | ||
| 61 | |||
| 62 | Specify the number of blocks (which list fileno-blockno pairs) | ||
| 63 | for a process. If not specified defaults to 220. | ||
| 64 | |||
| 65 | =back | ||
| 66 | |||
| 67 | =head1 DESCRIPTION | ||
| 68 | |||
| 69 | Creates or re-initializes undo file under GNZ_HOME. By default | ||
| 70 | file is named undo.und. File header contains basic information about | ||
| 71 | all other files in Genezzo installation. genprepundo.pl must | ||
| 72 | be run whenever a new file is added to the Genezzo installation. | ||
| 73 | |||
| 74 | Undo file format is documented in Clustered.pm. | ||
| 75 | |||
| 76 | =head1 AUTHOR | ||
| 77 | |||
| 78 | Eric Rollins, rollins@acm.org | ||
| 79 | |||
| 80 | =head1 COPYRIGHT AND LICENSE | ||
| 81 | |||
| 82 | Copyright (c) 2005 Eric Rollins. All rights reserved. | ||
| 83 | |||
| 84 | This program is free software; you can redistribute it and/or modify | ||
| 85 | it under the terms of the GNU General Public License as published by | ||
| 86 | the Free Software Foundation; either version 2 of the License, or | ||
| 87 | any later version. | ||
| 88 | |||
| 89 | |||
| 90 | This program is distributed in the hope that it will be useful, | ||
| 91 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 92 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 93 | GNU General Public License for more details. | ||
| 94 | |||
| 95 | You should have received a copy of the GNU General Public License | ||
| 96 | along with this program; if not, write to the Free Software | ||
| 97 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 98 | |||
| 99 | Address bug reports and comments to rollins@acm.org | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | BEGIN { | ||
| 104 | my $man = 0; | ||
| 105 | my $help = 0; | ||
| 106 | my $init = 0; | ||
| 107 | my $shutdown = 0; | ||
| 108 | my $gnz_home = ''; | ||
| 109 | my $undo_filename = ''; | ||
| 110 | my $number_of_processes = 256; | ||
| 111 | my $undo_blocks_per_process = 220; | ||
| 112 | |||
| 113 | GetOptions( | ||
| 114 | 'help|?' => \$help, man => \$man, | ||
| 115 | 'gnz_home=s' => \$gnz_home, | ||
| 116 | 'undo_filename=s' => \$undo_filename, | ||
| 117 | 'number_of_processes=i' => \$number_of_processes, | ||
| 118 | 'undo_blocks_per_process=i' => \$undo_blocks_per_process) | ||
| 119 | or pod2usage(2); | ||
| 120 | |||
| 121 | my $glob_id = "Genezzo Version $Genezzo::GenDBI::VERSION - $Genezzo::GenDBI::RELSTATUS $Genezzo::GenDBI::RELDATE\n\n"; | ||
| 122 | |||
| 123 | pod2usage(-msg => $glob_id, -exitstatus => 1) if $help; | ||
| 124 | pod2usage(-msg => $glob_id, -exitstatus => 0, -verbose => 2) if $man; | ||
| 125 | |||
| 126 | print "beginning initialization...\n"; | ||
| 127 | Genezzo::Contrib::Clustered::PrepUndo::prepareUndo( | ||
| 128 | gnz_home => $gnz_home, | ||
| 129 | undo_filename => $undo_filename, | ||
| 130 | number_of_processes => $number_of_processes, | ||
| 131 | undo_blocks_per_process => $undo_blocks_per_process); | ||
| 132 | } | ||
| 133 |