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 vyatta android/ }; |
21 |
|
|
22 |
sub debian_live { |
sub debian_live { |
23 |
my ($ip) = @_; |
my ($ip) = @_; |
68 |
default webconverger |
default webconverger |
69 |
label webconverger |
label webconverger |
70 |
kernel iso/live/vmlinuz-2.6.30-backports.1-486 |
kernel iso/live/vmlinuz-2.6.30-backports.1-486 |
71 |
append initrd=iso/live/initrd.img-2.6.30-backports.1-486 fetch=$fetch boot=live quiet nosudo splash video=vesa:ywrap,mtrr vga=788 nopersistent username=webc hostname=$hostname union=aufs homepage=$homepage locale=hr noprompt |
append initrd=iso/live/initrd.img-2.6.30-backports.1-486 fetch=$fetch boot=live quiet nosudo splash video=vesa:ywrap,mtrr vga=788 nopersistent username=webc hostname=$hostname union=aufs homepage=$homepage locale=hr noprompt kioskresetstation=10 |
72 |
|
|
73 |
}); |
}); |
74 |
|
|
116 |
|
|
117 |
sub tinycore { |
sub tinycore { |
118 |
my $ip = shift; |
my $ip = shift; |
119 |
upstream::iso( 'http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore_2.2.iso' ); |
upstream::iso( 'http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/3.x/release/tinycore-current.iso' ); |
120 |
pxelinux::config_for_ip( $ip, qq{ |
pxelinux::config_for_ip( $ip, qq{ |
121 |
|
|
122 |
default linux |
default linux |
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 |
|
symlink "$dir/$image", client::ip_path $ip . '/memdisk.image'; |
178 |
|
} else { |
179 |
|
$image =~ s{^.+/tftp/memdisk/}{} && warn "using $image\n"; |
180 |
|
} |
181 |
|
|
182 |
|
if ( my $kvm = client::conf $ip => 'kvm' ) { |
183 |
|
client::conf $ip => 'kvm.bin', 'qemu-system-i386'; # FIXME kvm doesn't seem to work |
184 |
|
} |
185 |
|
|
186 |
|
pxelinux::config_for_ip( $ip, qq{ |
187 |
|
|
188 |
|
default $image |
189 |
|
label $image |
190 |
|
kernel memdisk |
191 |
|
append initrd=$image |
192 |
|
|
193 |
|
}); |
194 |
|
} |
195 |
|
|
196 |
|
sub vyatta { |
197 |
|
my $ip = shift; |
198 |
|
upstream::iso( 'http://www.vyatta.com/downloads/vc6.1/vyatta-livecd_VC6.1-2010.08.20_i386.iso' ); |
199 |
|
|
200 |
|
my $dir = "$server::base_dir/tftp/vyatta"; |
201 |
|
symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; |
202 |
|
|
203 |
|
pxelinux::config_for_ip( $ip, qq{ |
204 |
|
|
205 |
|
default vyatta |
206 |
|
label vyatta |
207 |
|
|
208 |
|
kernel iso/live/vmlinuz1 |
209 |
|
append initrd=iso/live/initrd1.img boot=live nopersistent noautologin nonetworking nouser hostname=vyatta fetch=http://$server_ip:7777/vyatta/iso/live/filesystem.squashfs |
210 |
|
|
211 |
|
}); |
212 |
|
} |
213 |
|
|
214 |
|
sub android { |
215 |
|
my $ip = shift; |
216 |
|
my $path = upstream::iso( 'http://android-x86.googlecode.com/files/android-x86-1.6-r2.iso' ); |
217 |
|
|
218 |
|
my $dir = "$server::base_dir/tftp/android"; |
219 |
|
symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; |
220 |
|
|
221 |
|
client::conf $ip => 'kvm.boot' => "n -cdrom $path"; |
222 |
|
|
223 |
|
pxelinux::config_for_ip( $ip, qq{ |
224 |
|
|
225 |
|
default android-1.6-donut |
226 |
|
label android-1.6-donut |
227 |
|
|
228 |
|
kernel iso/kernel |
229 |
|
append initrd=iso/initrd.img root=/dev/ram0 androidboot_hardware=eeepc acpi_sleep=s3_bios,s3_mode quiet SRC= DATA= SDCARD= vga=788 DEBUG=1 |
230 |
|
|
231 |
|
}); |
232 |
|
} |
233 |
|
|
234 |
sub in_chroot { |
sub in_chroot { |
235 |
my ( $dir, $command ) = @_; |
my ( $dir, $command ) = @_; |
236 |
write_file "$dir/tmp/inside.sh", $command; |
write_file "$dir/tmp/inside.sh", $command; |
289 |
|
|
290 |
} |
} |
291 |
|
|
292 |
|
my $exported = `exportfs | grep $export`; |
293 |
|
if ( $exported ne $export ) { |
294 |
|
warn "exportfs $exported\n"; |
295 |
|
system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export"; |
296 |
|
} |
297 |
|
|
298 |
my $hostname = client::conf( $ip => 'hostname' ) || 'nfsroot'; |
my $hostname = client::conf( $ip => 'hostname' ) || 'nfsroot'; |
299 |
file::replace "$export/etc/hostname", $hostname; |
file::replace "$export/etc/hostname", $hostname; |