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 |
|
|
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 |
70 |
|
|
71 |
=cut |
=cut |
72 |
|
|
73 |
|
sub _glob_first { |
74 |
|
my ( $dir, $path ) = @_; |
75 |
|
my @glob = glob "$dir/$path"; |
76 |
|
my $first = $glob[0] || die "no $dir/$path"; |
77 |
|
$dir =~ s{iso/*$}{}; |
78 |
|
$first =~ s{^\Q$dir\E}{}g; |
79 |
|
return $first; |
80 |
|
} |
81 |
|
|
82 |
sub webconverger { |
sub webconverger { |
83 |
my ($ip) = @_; |
my ($ip) = @_; |
84 |
|
|
85 |
$mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-5.5.iso' ); |
$mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-6.2.iso' ); |
86 |
|
|
87 |
my $hostname = client::conf( $ip => 'hostname' ) || 'webconverger'; |
my $hostname = client::conf( $ip => 'hostname' ) || 'webconverger'; |
88 |
|
|
91 |
my $fetch = client::conf( $ip => 'webconverger/fetch' |
my $fetch = client::conf( $ip => 'webconverger/fetch' |
92 |
, default => "http://$server_ip:7777/webconverger/iso/live/filesystem.squashfs" ); |
, default => "http://$server_ip:7777/webconverger/iso/live/filesystem.squashfs" ); |
93 |
|
|
94 |
|
my $mnt = "$server::base_dir/tftp/webconverger/iso"; |
95 |
|
warn "# mnt: $mnt\n"; |
96 |
|
my $kernel = _glob_first $mnt => 'live/vmlinuz*'; |
97 |
|
my $initrd = _glob_first $mnt => 'live/initrd.img*'; |
98 |
|
|
99 |
pxelinux::config_for_ip( $ip, qq{ |
pxelinux::config_for_ip( $ip, qq{ |
100 |
|
|
101 |
default webconverger |
default webconverger |
102 |
label webconverger |
label webconverger |
103 |
kernel iso/live/vmlinuz-2.6.30-backports.1-486 |
kernel $kernel |
104 |
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 |
append initrd=$initrd 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 |
105 |
|
|
106 |
}); |
}); |
107 |
|
|