17 |
our $server; |
our $server; |
18 |
our $server_ip; |
our $server_ip; |
19 |
|
|
20 |
sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt/ }; |
sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt clonezilla ubuntu memdisk/ }; |
21 |
|
|
22 |
sub debian_live { |
sub debian_live { |
23 |
my ($ip) = @_; |
my ($ip) = @_; |
126 |
|
|
127 |
}); |
}); |
128 |
} |
} |
129 |
|
|
130 |
|
sub clonezilla { |
131 |
|
my $ip = shift; |
132 |
|
upstream::iso( 'http://sourceforge.net/projects/clonezilla/files/clonezilla_live_alternative_testing/clonezilla-live-20100503-lucid.iso/download' ); |
133 |
|
pxelinux::config_for_ip( $ip, qq{ |
134 |
|
|
135 |
|
default linux |
136 |
|
label linux |
137 |
|
kernel iso/live/vmlinuz |
138 |
|
append initrd=iso/live/initrd.img boot=live union=aufs noswap noprompt vga=788 fetch=http://$server_ip:7777/clonezilla/iso/live/filesystem.squashfs |
139 |
|
|
140 |
|
}); |
141 |
|
} |
142 |
|
|
143 |
|
sub ubuntu { |
144 |
|
my $ip = shift; |
145 |
|
upstream::iso( 'http://mirrors.us.kernel.org/ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso' ); |
146 |
|
|
147 |
|
my $export = "$server::base_dir/tftp/ubuntu/iso"; |
148 |
|
my $exported = `exportfs | grep $export`; |
149 |
|
if ( $exported ne $export ) { |
150 |
|
warn "exportfs $exported\n"; |
151 |
|
system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export"; |
152 |
|
} |
153 |
|
pxelinux::config_for_ip( $ip, qq{ |
154 |
|
|
155 |
|
default linux |
156 |
|
label linux |
157 |
|
kernel iso/casper/vmlinuz |
158 |
|
append initrd=iso/casper/initrd.lz boot=casper netboot=nfs nfsroot=$server_ip:$export -- |
159 |
|
|
160 |
|
}); |
161 |
|
} |
162 |
|
|
163 |
|
sub memdisk { |
164 |
|
my $ip = shift; |
165 |
|
|
166 |
|
my $dir = "$server::base_dir/tftp/memdisk"; |
167 |
|
mkdir $dir unless -e $dir; |
168 |
|
|
169 |
|
symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; |
170 |
|
|
171 |
|
my $image = client::conf( $ip => 'memdisk.image' ); |
172 |
|
|
173 |
|
if ( ! $image ) { |
174 |
|
$image = 'freedos.gz'; |
175 |
|
upstream::mirror_file 'http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/unofficial/balder/balder10.imz' => "$dir/$image"; |
176 |
|
warn "using $image [default FreeDOS]\n"; |
177 |
|
} else { |
178 |
|
$image =~ s{^.+/tftp/memdisk/}{} && warn "using $image\n"; |
179 |
|
} |
180 |
|
|
181 |
|
pxelinux::config_for_ip( $ip, qq{ |
182 |
|
|
183 |
|
default $image |
184 |
|
label $image |
185 |
|
kernel memdisk |
186 |
|
append initrd=$image |
187 |
|
|
188 |
|
}); |
189 |
|
} |
190 |
|
|
191 |
sub in_chroot { |
sub in_chroot { |
192 |
my ( $dir, $command ) = @_; |
my ( $dir, $command ) = @_; |