Bootloader/Yaboot.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 44 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
_set_config_file
2.0
install
2.0
CRAP 2.0
1 package Linux::Bootloader::Yaboot;
2  
3 =head1 NAME
4  
5 Linux::Bootloader::Yaboot - Parse and modify YABOOT configuration files.
6  
7 =head1 SYNOPSIS
8  
9 use Linux::Bootloader;
10 use Linux::Bootloader::Yaboot;
11
12 my $bootloader = Linux::Bootloader::Yaboot->new();
13 my $config_file='/etc/yaboot.conf';
14  
15 $bootloader->read($config_file)
16  
17 # add a kernel
18 $bootloader->add(%hash)
19  
20 # remove a kernel
21 $bootloader->remove(2)
22  
23 # set new default
24 $bootloader->set_default(1)
25  
26 $bootloader->write($config_file)
27  
28  
29 =head1 DESCRIPTION
30  
31 This module provides functions for working with YABOOT configuration files.
32  
33 Adding a kernel:
34 - add kernel at start, end, or any index position.
35 - kernel path and title are required.
36 - root, kernel args, initrd are optional.
37 - any options not specified are copied from default.
38 - remove any conflicting kernels if force is specified.
39
40 Removing a kernel:
41 - remove by index position
42 - or by title/label
43  
44  
45 =head1 FUNCTIONS
46  
47 Also see L<Linux::Bootloader> for functions available from the base class.
48  
49 =head2 new()
50  
51 Creates a new Linux::Bootloader::Yaboot object.
52  
53 =head2 install()
54  
55 Attempts to install bootloader.
56 Takes: nothing.
57 Returns: undef on error.
58  
59 =cut
60  
61  
62 use strict;
63 use warnings;
64 use Linux::Bootloader
65  
66 @Linux::Bootloader::Yaboot::ISA = qw(Linux::Bootloader);
67 use base 'Linux::Bootloader';
68  
69  
70 use vars qw( $VERSION );
71 our $VERSION = '1.2';
72  
73  
74 sub new {
75 my $this = shift;
76 my $class = ref($this) || $this;
77 my $self = bless({}, $class);
78  
79 $self->SUPER::new();
80  
81 return $self;
82 }
83  
84  
85 sub _set_config_file {
86 my $self=shift;
87 $self->{'config_file'}='/etc/yaboot.conf';
88 }
89  
90 ### YABOOT functions ###
91  
92  
93 # Run command to install bootloader
94  
95 sub install {
96 my $self=shift;
97  
98 #system("/usr/sbin/ybin");
99 #if ( $? != 0 ) {
100 # warn("ERROR: Failed to run ybin.\n") && return undef;
101 #}
102  
103 print("Not installing bootloader.\n");
104 print("Depending on your arch you may need to run ybin.\n");
105 return 1;
106 }
107  
108  
109 1;
110  
111  
112 =head1 AUTHOR
113  
114 Open Source Development Labs, Engineering Department <eng@osdl.org>
115  
116 =head1 COPYRIGHT
117  
118 Copyright (C) 2006 Open Source Development Labs
119 All Rights Reserved.
120  
121 This script is free software; you can redistribute it and/or modify it
122 under the same terms as Perl itself.
123  
124 =head1 SEE ALSO
125  
126 L<Linux::Bootloader>
127  
128 =cut
129