Changeset 3143 in MondoRescue
- Timestamp:
- Jun 14, 2013, 6:06:09 AM (12 years ago)
- Location:
- branches/3.0/mindi
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mindi/install.sh
r2964 r3143 40 40 MINDIVER=PBVER 41 41 MINDIREV=PBREV 42 VERSTR=${MINDIVER}-r${MINDIREV} 42 43 ARCH=`/bin/uname -m` 43 echo "mindi $ {MINDIVER}-r${MINDIREV}will be installed under $local"44 echo "mindi $VERSTR will be installed under $local" 44 45 45 46 if [ _"$CACHEDIR" = _"" ]; then … … 80 81 install -m 644 $f $conf/deplist.d 81 82 done 82 for f in mindi-bkphw mindi-get-perl-modules parted2fdisk.pl; do83 install -m 755 $f $local/sbin84 done85 83 86 84 # Substitute variables for mindi 87 85 sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$sublocal~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$subconf~" -e "s~^MINDI_LIB=LLL~MINDI_LIB=$sublocallib~" mindi > $local/sbin/mindi 88 chmod 755 $local/sbin/mindi $local/sbin/mindi-bkphw 86 chmod 755 $local/sbin/mindi 87 install -m 644 mindi.8 $MANDIR 89 88 90 install -m 644 mindi.8 $MANDIR 91 #install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR 89 # Manage perl script man pages 90 for s in mindi-bkphw mindi-get-perl-modules parted2fdisk.pl; do 91 install -m 755 $s $local/sbin 92 pod2man -c "$s a MondoRescue tool" --section=8 --release="$VERSTR" $local/sbin/$s > $s.8 93 install -m 644 $s.8 $MANDIR 94 # Generate the list of perl modules needed at restore time for mindi 95 cat > $conf/perl-scripts << EOF 96 $sublocal/sbin/$s 97 EOF 98 done 99 (cd $MANDIR ; ln -s parted2fdisk.pl.8 parted2fdisk.9) 92 100 93 101 if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then … … 101 109 else 102 110 # FHS requires fdisk under /sbin 103 (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)111 (cd $local/sbin && ln -sf ../../sbin/fdisk parted2fdisk) 104 112 echo "Symlinking fdisk to parted2fdisk" 105 113 ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk) … … 114 122 fi 115 123 116 # Generate the list of perl modules needed at restore time for mindi117 cat > $conf/perl-scripts << EOF118 $sublocal/sbin/mindi-get-perl-modules119 $sublocal/sbin/mindi-bkphw120 $sublocal/sbin/parted2fdisk.pl121 EOF122 123 124 exit 0 -
branches/3.0/mindi/mindi-bkphw
r3094 r3143 2 2 # 3 3 # $Id$ 4 # Copyright B. Cornec 2005-2013 5 # Provided under the GPL v2 4 6 # 5 7 # Backup the hardware configuration on machine supporting it … … 8 10 use strict; 9 11 use File::Basename; 12 13 =pod 14 15 =head1 NAME 16 17 mindi-bkphw keeps track of your hardware configuration (BIOS, Raid, Management board, ...) 18 19 =head1 DESCRIPTION 20 21 mindi-bkphw keeps track of your hardware configuration by calling the tool provided by IHV (Independant Hardware Vendor) in order to store the configuration of the system BIOS, the RAID controller or the onboard management card if any of those is present. 22 23 For the moment, this is only working for HP ProLiant servers, as HP provides all these tools in a convenient way to perform these actions. Other manufacturer can provide patches or relevant info in order to be supported as well here. 24 25 =head1 SYNOPSIS 26 27 mindi-bkphw /path/to/cache-dir /path/to/conf-dir 28 29 =head1 ARGUMENTS 30 31 =over 4 32 33 =item B</path/to/cache-dir> 34 35 This is the directory where the generated files will be stored. 36 37 =item B</path/to/conf-dir> 38 39 This is the directory where the configuration file describing the tools needed to backup hardware information is stored. Generaly /etc/mindi. It should contain a deplist.d subdirectory, and for now only the ProLiant.conf file is used in it. 40 41 =back 42 43 =head1 WEB SITES 44 45 The main Web site of the project is available at L<http://www.mondorescue.org>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>. 46 47 =head1 USER MAILING LIST 48 49 For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel> 50 51 =head1 AUTHORS 52 53 The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>. 54 55 =head1 COPYRIGHT 56 57 MondoRescue is distributed under the GPL v2.0 license or later, 58 described in the file C<COPYING> included with the distribution. 59 60 =cut 61 10 62 11 63 # Handling Configuration files -
branches/3.0/mindi/mindi-get-perl-modules
r2839 r3143 1 1 #!/usr/bin/perl -w 2 # 3 # $Id$ 4 # Copyright B. Cornec 2005-2013 5 # Provided under the GPL v2 2 6 # 3 7 # Get perl modules required by mindi and mondo and that should be on the restore media … … 7 11 use File::Find; 8 12 use Cwd; 13 14 15 =pod 16 17 =head1 NAME 18 19 mindi-get-perl-modules keeps track of the perl modules that should be on your restore media 20 21 =head1 DESCRIPTION 22 23 mindi-get-perl-modules keeps track of the perl modules that should be on your restore media by analyzing the references made to them in the scripts passed as parameters and returning all the modules needed to have them work correctly. 24 25 =head1 SYNOPSIS 26 27 mindi-get-perl-modules /path/to/perl-script ... 28 29 =head1 ARGUMENTS 30 31 =over 4 32 33 =item B</path/to/perl-script> 34 35 This is the path of the perl script to analyze and for which we want its perl modules in dependence to be included 36 37 =back 38 39 =head1 WEB SITES 40 41 The main Web site of the project is available at L<http://www.mondorescue.org>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>. 42 43 =head1 USER MAILING LIST 44 45 For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel> 46 47 =head1 AUTHORS 48 49 The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>. 50 51 =head1 COPYRIGHT 52 53 MondoRescue is distributed under the GPL v2.0 license or later, 54 described in the file C<COPYING> included with the distribution. 55 56 =cut 57 9 58 10 59 my $file = get_perl_modules(@ARGV) if (defined $ARGV[0]); … … 100 149 sub process_file { 101 150 102 103 104 105 106 107 151 my %line; 152 my %require; 153 my $current_line; 154 my $tag; 155 156 foreach my $file (@_) { 108 157 109 open(FILE, "<$file") || return(\%require); 110 111 while (<FILE>) { 112 113 # skip the "= <<" block 114 115 if ( ( m/^\s*\$(.*)\s*=\s*<<\s*["'](.*)['"]/i) || 116 ( m/^\s*\$(.*)\s*=\s*<<\s*(.*);/i) ) { 117 $tag = $2; 118 while (<FILE>) { 119 ( $_ =~ /^$tag/) && last; 120 } 121 } 122 123 # skip the documentation 124 125 # we should not need to have item in this if statement (it 126 # properly belongs in the over/back section) but people do not 127 # read the perldoc. 128 129 if ( (m/^=(head1|head2|pod|item)/) .. (m/^=(cut)/) ) { 130 next; 131 } 132 133 if ( (m/^=(over)/) .. (m/^=(back)/) ) { 134 next; 135 } 136 137 # skip the data section 138 if (m/^__(DATA|END)__$/) { 139 last; 140 } 141 142 # Each keyword can appear multiple times. Don't 143 # bother with datastructures to store these strings, 144 # if we need to print it print it now. 145 146 if ( m/^\s*\$RPM_Requires\s*=\s*["'](.*)['"]/i) { 147 foreach $_ (split(/\s+/, $1)) { 148 print "$_\n"; 149 } 150 } 151 152 if ( 158 open(FILE, "<$file") || return(\%require); 159 while (<FILE>) { 160 161 # skip the "= <<" block 162 163 if ( ( m/^\s*\$(.*)\s*=\s*<<\s*["'](.*)['"]/i) || 164 ( m/^\s*\$(.*)\s*=\s*<<\s*(.*);/i) ) { 165 $tag = $2; 166 while (<FILE>) { 167 ( $_ =~ /^$tag/) && last; 168 } 169 } 170 171 # skip the documentation 172 173 # we should not need to have item in this if statement (it 174 # properly belongs in the over/back section) but people do not 175 # read the perldoc. 176 177 if ( (m/^=(head1|head2|pod|item)/) .. (m/^=(cut)/) ) { 178 next; 179 } 180 181 if ( (m/^=(over)/) .. (m/^=(back)/) ) { 182 next; 183 } 184 185 # skip the data section 186 if (m/^__(DATA|END)__$/) { 187 last; 188 } 189 190 # Each keyword can appear multiple times. Don't 191 # bother with datastructures to store these strings, 192 # if we need to print it print it now. 193 194 if ( m/^\s*\$RPM_Requires\s*=\s*["'](.*)['"]/i) { 195 foreach $_ (split(/\s+/, $1)) { 196 print "$_\n"; 197 } 198 } 199 200 if ( 153 201 154 202 # ouch could be in a eval, perhaps we do not want these since we catch … … 160 208 161 209 162 (m/^(\s*) # we hope the inclusion starts the line 163 (require|use)\s+(?!\{) # do not want 'do {' loops 164 # quotes around name are always legal 165 [\'\"]?([^\;\ \'\"\t]*)[\'\"]?[\t\;\ ] 166 # the syntax for 'use' allows version requirements 167 \s*([.0-9]*) 168 /x) 169 ) { 170 my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4); 171 my $usebase; 172 173 # we only consider require statements that are flush against 174 # the left edge. any other require statements give too many 175 # false positives, as they are usually inside of an if statement 176 # as a fallback module or a rarely used option 177 178 ($whitespace ne "" && $statement eq "require") && next; 179 180 # if there is some interpolation of variables just skip this 181 # dependency, we do not want 182 # do "$ENV{LOGDIR}/$rcfile"; 183 184 ($module =~ m/\$/) && next; 185 186 # skip if the phrase was "use of" -- shows up in gimp-perl, et al 187 next if $module eq 'of'; 188 189 # if the module ends in a comma we probaly caught some 190 # documentation of the form 'check stuff,\n do stuff, clean 191 # stuff.' there are several of these in the perl distribution 192 193 ($module =~ m/[,>]$/) && next; 194 195 # if the module name starts in a dot it is not a module name. 196 # Is this necessary? Please give me an example if you turn this 197 # back on. 198 199 # ($module =~ m/^\./) && next; 200 201 # if the module ends with .pm strip it to leave only basename. 202 # starts with /, which means its an absolute path to a file 203 if ($module =~ m(^/)) { 204 print "$module\n"; 205 next; 206 } 207 208 # as seen in some perl scripts 209 # use base qw(App::CLI Class::Accessor::Chained::Fast App::CLI::Command); 210 if ($module eq 'base') { 211 $require{$module} = $version; 212 $line{$module} = $current_line; 213 ($module = $_) =~ s/use\s*base\s*//; 214 $module =~ s/qw\((.*)\)\s*;/$1/; 215 $module =~ s/qw(.)(.*)\1\s*;/$2/; 216 $module =~ s/\s*;$//; 217 $module =~ s/#.*//; 218 $usebase = 1; 219 } 220 # sometimes people do use POSIX qw(foo), or use POSIX(qw(foo)) etc 221 # we can strip qw.*$, as well as (.*$: 222 $module =~ s/qw.*$//; 223 $module =~ s/\(.*$//; 224 225 $module =~ s/\.pm$//; 226 227 # some perl programmers write 'require URI/URL;' when 228 # they mean 'require URI::URL;' 229 230 $module =~ s/\//::/; 231 232 # trim off trailing parenthesis if any. Sometimes people pass 233 # the module an empty list. 234 235 $module =~ s/\(\s*\)$//; 236 237 # if module is a number then both require and use interpret that 238 # to mean that a particular version of perl is specified. Don't 239 # add a dependency, though, since the rpm will already require 240 # perl-base at the build version (via find-requires) 241 next if $module =~ /^v?\d/; 242 243 # ph files do not use the package name inside the file. 244 # perlmodlib documentation says: 245 # the .ph files made by h2ph will probably end up as 246 # extension modules made by h2xs. 247 # so do not spend much effort on these. 248 249 # there is no easy way to find out if a file named systeminfo.ph 250 # will be included with the name sys/systeminfo.ph so only use the 251 # basename of *.ph files 252 253 ($module =~ m/\.ph$/) && next; 254 255 # if the module was loaded trough base, we need to split the list 256 if ($usebase) { 257 my $current_line = $_; 258 foreach (split(/\s+/, $module)) { 259 next unless $_; 260 $require{$_} = $version; 261 $line{$_} = $current_line; 262 } 263 } else { 264 $require{$module}=$version; 265 $line{$module}=$current_line; 266 } 267 } 268 } 269 270 close(FILE) || 271 die("$0: Could not close file: '$file' : $!\n"); 210 (m/^(\s*) # we hope the inclusion starts the line 211 (require|use)\s+(?!\{) # do not want 'do bracket' loops 212 # quotes around name are always legal 213 [\'\"]?([^\;\ \'\"\t]*)[\'\"]?[\t\;\ ] 214 # the syntax for 'use' allows version requirements 215 \s*([.0-9]*) 216 /x) 217 ) { 218 my ($whitespace, $statement, $module, $version) = ($1, $2, $3,$4); 219 my $usebase; 220 221 # we only consider require statements that are flush against 222 # the left edge. any other require statements give too many 223 # false positives, as they are usually inside of an if statement 224 # as a fallback module or a rarely used option 225 226 ($whitespace ne "" && $statement eq "require") && next; 227 228 # if there is some interpolation of variables just skip this 229 # dependency, we do not want 230 # do "$ENV{LOGDIR}/$rcfile"; 231 232 ($module =~ m/\$/) && next; 233 234 # skip if the phrase was "use of" -- shows up in gimp-perl, et al 235 next if $module eq 'of'; 236 237 # if the module ends in a comma we probaly caught some 238 # documentation of the form 'check stuff,\n do stuff, clean 239 # stuff.' there are several of these in the perl distribution 240 241 ($module =~ m/[,>]$/) && next; 242 243 # if the module name starts in a dot it is not a module name. 244 # Is this necessary? Please give me an example if you turn this 245 # back on. 246 247 # ($module =~ m/^\./) && next; 248 249 # if the module ends with .pm strip it to leave only basename. 250 # starts with /, which means its an absolute path to a file 251 if ($module =~ m(^/)) { 252 print "$module\n"; 253 next; 254 } 255 256 # as seen in some perl scripts 257 # use base qw(App::CLI Class::Accessor::Chained::Fast App::CLI::Command); 258 if ($module eq 'base') { 259 $require{$module} = $version; 260 $line{$module} = $current_line; 261 ($module = $_) =~ s/use\s*base\s*//; 262 $module =~ s/qw\((.*)\)\s*;/$1/; 263 $module =~ s/qw(.)(.*)\1\s*;/$2/; 264 $module =~ s/\s*;$//; 265 $module =~ s/#.*//; 266 $usebase = 1; 267 } 268 # sometimes people do use POSIX qw(foo), or use POSIX(qw(foo)) etc 269 # we can strip qw.*$, as well as (.*$: 270 $module =~ s/qw.*$//; 271 $module =~ s/\(.*$//; 272 273 $module =~ s/\.pm$//; 274 275 # some perl programmers write 'require URI/URL;' when 276 # they mean 'require URI::URL;' 277 278 $module =~ s/\//::/; 279 280 # trim off trailing parenthesis if any. Sometimes people pass 281 # the module an empty list. 282 283 $module =~ s/\(\s*\)$//; 284 285 # if module is a number then both require and use interpret that 286 # to mean that a particular version of perl is specified. Don't 287 # add a dependency, though, since the rpm will already require 288 # perl-base at the build version (via find-requires) 289 next if $module =~ /^v?\d/; 290 291 # ph files do not use the package name inside the file. 292 # perlmodlib documentation says: 293 # the .ph files made by h2ph will probably end up as 294 # extension modules made by h2xs. 295 # so do not spend much effort on these. 296 297 # there is no easy way to find out if a file named systeminfo.ph 298 # will be included with the name sys/systeminfo.ph so only use the 299 # basename of *.ph files 300 301 ($module =~ m/\.ph$/) && next; 302 303 # if the module was loaded trough base, we need to split the list 304 if ($usebase) { 305 my $current_line = $_; 306 foreach (split(/\s+/, $module)) { 307 next unless $_; 308 $require{$_} = $version; 309 $line{$_} = $current_line; 310 } 311 } else { 312 $require{$module}=$version; 313 $line{$module}=$current_line; 314 } 315 } 272 316 } 273 317 274 return(\%require); 275 } 318 close(FILE) || die("$0: Could not close file: '$file' : $!\n"); 319 } 320 321 return(\%require); 322 } -
branches/3.0/mindi/parted2fdisk.pl
r2192 r3143 9 9 # Tested on ia64 with RHAS 2.1 - Mandrake 9.0 - RHEL 3.0 - SLES 10 10 10 # 11 # (c) Bruno Cornec <Bruno.Cornec@hp.com>12 # Licensed under the GPL11 # Copyright B. Cornec 2000-2013 12 # Provided under the GPL v2 13 13 14 14 use strict; 15 16 17 =pod 18 19 =head1 NAME 20 21 parted2fdisk is a fdisk lie command using parted internally. 22 23 =head1 DESCRIPTION 24 25 parted2fdisk behaves like a fdisk command, but dialog internally with parted in order to manipulate partiion tables, which allow it to support GPT partition format as well as MBR, contrary to fdisk. It aimed at providing compatible external interface wti fdisk. Developed initialy for ia64 Linux, but is also useful now on x86 systems using GPT partition format (for large HDDs). 26 27 =head1 SYNOPSIS 28 29 parted2fdisk -s partition 30 parted2fdisk -l device 31 parted2fdisk [-n] device 32 33 =head1 OPTIONS 34 35 =over 4 36 37 =item B<-s> 38 39 Print the size (in blocks) of the given partition. 40 41 =item B<-n> 42 43 Fake mode. Doesn't pass the commands just simulate. 44 45 =item B<-l> 46 47 List the partition tables for the specified device and then exit. 48 49 =item B<no option> 50 51 Allow the creation and manipulation of partition tables. 52 53 =back 54 55 =head1 ARGUMENTS 56 57 =over 4 58 59 =item B<partition> 60 61 partition device file (only used with -s option). 62 63 =item B<device> 64 65 device file to work on. 66 67 =back 68 69 =head1 WEB SITES 70 71 The main Web site of the project is available at L<http://www.mondorescue.org>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>. 72 73 =head1 USER MAILING LIST 74 75 For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel> 76 77 =head1 AUTHORS 78 79 The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>. 80 81 =head1 COPYRIGHT 82 83 MondoRescue is distributed under the GPL v2.0 license or later, 84 described in the file C<COPYING> included with the distribution. 85 86 =cut 87 15 88 16 89 $ENV{LANG} = "C";
Note:
See TracChangeset
for help on using the changeset viewer.