9 |
use client; |
use client; |
10 |
use file; |
use file; |
11 |
use ssh; |
use ssh; |
12 |
|
use upstream; |
13 |
|
|
14 |
use File::Slurp; |
use File::Slurp; |
15 |
|
|
18 |
our $server; |
our $server; |
19 |
our $server_ip; |
our $server_ip; |
20 |
|
|
21 |
sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt clonezilla ubuntu memdisk vyatta/ }; |
sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt clonezilla ubuntu memdisk vyatta android/ }; |
22 |
|
|
23 |
sub debian_live { |
sub debian_live { |
24 |
my ($ip) = @_; |
my ($ip) = @_; |
25 |
|
|
26 |
upstream::files( qw{ |
my $from = 'http://cdimage.debian.org/cdimage/release/current-live/i386/web/'; |
27 |
http://cdimage.debian.org/cdimage/release/current-live/i386/web/ |
$from = 'http://cdimage.debian.org/cdimage/squeeze_live_alpha2/i386/web/'; |
28 |
vmlinuz1 |
my $variant = 'standard'; |
29 |
initrd1.img |
|
30 |
debian-live-501-i386-standard.squashfs |
my $dir = upstream::files $from => 'MD5SUMS'; |
31 |
}); |
|
32 |
|
my ( $vmlinuz, $initrd, $squashfs ); |
33 |
|
|
34 |
|
my @md5sum = read_file "$dir/MD5SUMS"; |
35 |
|
|
36 |
|
foreach ( @md5sum ) { |
37 |
|
$vmlinuz = $1 if m/\s+(\S*vmlinuz\S*)/; |
38 |
|
$initrd = $1 if m/\s+(\S*$variant\S*initrd\S*)/; |
39 |
|
$squashfs = $1 if m/\s+(\S*$variant\S*\.squashfs)$/; |
40 |
|
warn "# MD5SUM: $_\n"; |
41 |
|
} |
42 |
|
|
43 |
|
upstream::files $from => $vmlinuz, $initrd, $squashfs; |
44 |
|
|
45 |
my $hostname = client::conf( $ip => 'hostname' ) || 'debian-live'; |
my $hostname = client::conf( $ip => 'hostname' ) || 'debian-live'; |
46 |
|
|
47 |
|
# FIXME drop in shell because users doesn't work in current image |
48 |
|
my $custom_init = 'init=/bin/hash'; |
49 |
|
|
50 |
|
if ( my $custom_squashfs = client::conf( $ip => 'squashfs' ) ) { |
51 |
|
$squashfs = $custom_squashfs; |
52 |
|
$custom_init = ''; |
53 |
|
} |
54 |
|
|
55 |
pxelinux::config_for_ip( $ip, qq{ |
pxelinux::config_for_ip( $ip, qq{ |
56 |
|
|
57 |
default debian_live |
default debian_live |
58 |
label debian_live |
label debian_live |
59 |
kernel vmlinuz1 |
kernel $vmlinuz |
60 |
append initrd=initrd1.img fetch=http://$server_ip:7777/debian_live/debian-live-501-i386-standard.squashfs boot=live nopersistent hostname=$hostname union=aufs noprompt |
append initrd=$initrd fetch=http://$server_ip:7777/debian_live/$squashfs boot=live nopersistent hostname=$hostname union=aufs noprompt autologin username=user debug $custom_init |
61 |
}); |
}); |
62 |
|
|
63 |
} |
} |
64 |
|
|
|
use upstream; |
|
|
|
|
65 |
=head1 webconverger |
=head1 webconverger |
66 |
|
|
67 |
Webconverger - the opensource Web Kiosk |
Webconverger - the opensource Web Kiosk |
135 |
|
|
136 |
sub tinycore { |
sub tinycore { |
137 |
my $ip = shift; |
my $ip = shift; |
138 |
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' ); |
139 |
pxelinux::config_for_ip( $ip, qq{ |
pxelinux::config_for_ip( $ip, qq{ |
140 |
|
|
141 |
default linux |
default linux |
214 |
|
|
215 |
sub vyatta { |
sub vyatta { |
216 |
my $ip = shift; |
my $ip = shift; |
217 |
upstream::iso( 'http://www.vyatta.com/downloads/vc6.0/vyatta-livecd-virt_VC6.0-2010.06.01_i386.iso' ); |
upstream::iso( 'http://www.vyatta.com/downloads/vc6.1/vyatta-livecd_VC6.1-2010.08.20_i386.iso' ); |
218 |
|
|
219 |
my $dir = "$server::base_dir/tftp/vyatta"; |
my $dir = "$server::base_dir/tftp/vyatta"; |
220 |
symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; |
symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; |
230 |
}); |
}); |
231 |
} |
} |
232 |
|
|
233 |
|
sub android { |
234 |
|
my $ip = shift; |
235 |
|
my $path = upstream::iso( 'http://android-x86.googlecode.com/files/android-x86-1.6-r2.iso' ); |
236 |
|
|
237 |
|
my $dir = "$server::base_dir/tftp/android"; |
238 |
|
symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; |
239 |
|
|
240 |
|
client::conf $ip => 'kvm.boot' => "n -cdrom $path"; |
241 |
|
|
242 |
|
pxelinux::config_for_ip( $ip, qq{ |
243 |
|
|
244 |
|
default android-1.6-donut |
245 |
|
label android-1.6-donut |
246 |
|
|
247 |
|
kernel iso/kernel |
248 |
|
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 |
249 |
|
|
250 |
|
}); |
251 |
|
} |
252 |
|
|
253 |
sub in_chroot { |
sub in_chroot { |
254 |
my ( $dir, $command ) = @_; |
my ( $dir, $command ) = @_; |
255 |
write_file "$dir/tmp/inside.sh", $command; |
write_file "$dir/tmp/inside.sh", $command; |
351 |
$server = server::as_hash_for $ip; |
$server = server::as_hash_for $ip; |
352 |
$server_ip = $server->{ip} || die "no server ip"; |
$server_ip = $server->{ip} || die "no server ip"; |
353 |
my $config = client::conf( $ip => 'config' ) || return; |
my $config = client::conf( $ip => 'config' ) || return; |
354 |
eval $config . '($ip)'; # must be last |
my $ret = eval $config . '($ip)'; # must be last |
355 |
|
if ( $@ ) { |
356 |
|
warn "ERROR in executing $config($ip): $@\n"; |
357 |
|
$ret .= qq{<pre style="color:red">$@</pre>}; |
358 |
|
} |
359 |
|
return $ret; |
360 |
} |
} |
361 |
|
|
362 |
warn 'loaded'; |
warn 'loaded'; |