14 |
|
|
15 |
our $mounted; |
our $mounted; |
16 |
|
|
17 |
sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt/ }; |
our $server; |
18 |
|
our $server_ip; |
19 |
|
|
20 |
|
sub available { qw/katalog debian_live webconverger debirf tinycore nfsroot openvz printer wrt clonezilla ubuntu freedos/ }; |
21 |
|
|
22 |
sub debian_live { |
sub debian_live { |
23 |
my ($ip) = @_; |
my ($ip) = @_; |
36 |
default debian_live |
default debian_live |
37 |
label debian_live |
label debian_live |
38 |
kernel vmlinuz1 |
kernel vmlinuz1 |
39 |
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=initrd1.img fetch=http://$server_ip:7777/debian_live/debian-live-501-i386-standard.squashfs boot=live nopersistent hostname=$hostname union=aufs noprompt |
40 |
}); |
}); |
41 |
|
|
42 |
} |
} |
59 |
my $hostname = client::conf( $ip => 'hostname' ) || 'webconverger'; |
my $hostname = client::conf( $ip => 'hostname' ) || 'webconverger'; |
60 |
|
|
61 |
my $homepage = client::conf( $ip => 'webconverger/homepage' |
my $homepage = client::conf( $ip => 'webconverger/homepage' |
62 |
, default => "http://${server::ip}:7777/client" ); |
, default => "http://$server_ip:7777/client" ); |
63 |
my $fetch = client::conf( $ip => 'webconverger/fetch' |
my $fetch = client::conf( $ip => 'webconverger/fetch' |
64 |
, default => "http://${server::ip}:7777/webconverger/iso/live/filesystem.squashfs" ); |
, default => "http://$server_ip:7777/webconverger/iso/live/filesystem.squashfs" ); |
65 |
|
|
66 |
pxelinux::config_for_ip( $ip, qq{ |
pxelinux::config_for_ip( $ip, qq{ |
67 |
|
|
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 |
|
|
79 |
$mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-5.5.iso' ); |
$mounted->{"webconverger/$ip"} ||= upstream::iso( 'http://download.webconverger.com/webc-5.5.iso' ); |
80 |
my $hostname = client::conf( $ip => 'hostname' ) || 'katalog'; |
my $hostname = client::conf( $ip => 'hostname' ) || 'katalog'; |
81 |
my $homepage = client::conf( $ip => 'webconverger/homepage' => "http://koha.ffzg.hr" ); |
my $homepage = client::conf( $ip => 'webconverger/homepage' => "http://koha.ffzg.hr" ); |
82 |
my $fetch = client::conf( $ip => 'webconverger/fetch' => "http://${server::ip}:7777/webconverger/custom.squashfs" ); |
my $fetch = client::conf( $ip => 'webconverger/fetch' => "http://$server_ip:7777/webconverger/custom.squashfs" ); |
83 |
|
|
84 |
pxelinux::config_for_ip( $ip, qq{ |
pxelinux::config_for_ip( $ip, qq{ |
85 |
|
|
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 freedos { |
164 |
|
my $ip = shift; |
165 |
|
|
166 |
|
my $dir = "$server::base_dir/tftp/freedos"; |
167 |
|
mkdir $dir unless -e $dir; |
168 |
|
|
169 |
|
symlink '/usr/lib/syslinux/memdisk', "$dir/memdisk" unless -e "$dir/memdisk"; |
170 |
|
|
171 |
|
my $floppy = 'freedos.img'; |
172 |
|
|
173 |
|
upstream::mirror_file 'http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/unofficial/balder/balder10.img' => "$dir/$floppy"; |
174 |
|
|
175 |
|
pxelinux::config_for_ip( $ip, qq{ |
176 |
|
|
177 |
|
default freedos |
178 |
|
label freedos |
179 |
|
kernel memdisk |
180 |
|
append initrd=freedos.imz |
181 |
|
|
182 |
|
}); |
183 |
|
} |
184 |
|
|
185 |
sub in_chroot { |
sub in_chroot { |
186 |
my ( $dir, $command ) = @_; |
my ( $dir, $command ) = @_; |
187 |
write_file "$dir/tmp/inside.sh", $command; |
write_file "$dir/tmp/inside.sh", $command; |
240 |
|
|
241 |
} |
} |
242 |
|
|
243 |
my $server = server::as_hash_for $ip; |
my $exported = `exportfs | grep $export`; |
244 |
|
if ( $exported ne $export ) { |
245 |
|
warn "exportfs $exported\n"; |
246 |
|
system "sudo exportfs -i -o rw,async,no_root_squash,no_subtree_check,fsid=999 $ip:$export"; |
247 |
|
} |
248 |
|
|
249 |
my $hostname = client::conf( $ip => 'hostname' ) || 'nfsroot'; |
my $hostname = client::conf( $ip => 'hostname' ) || 'nfsroot'; |
250 |
file::replace "$export/etc/hostname", $hostname; |
file::replace "$export/etc/hostname", $hostname; |
280 |
|
|
281 |
sub for_ip { |
sub for_ip { |
282 |
my $ip = shift || return; |
my $ip = shift || return; |
283 |
|
$server = server::as_hash_for $ip; |
284 |
|
$server_ip = $server->{ip} || die "no server ip"; |
285 |
my $config = client::conf( $ip => 'config' ) || return; |
my $config = client::conf( $ip => 'config' ) || return; |
286 |
eval $config . '($ip)'; |
eval $config . '($ip)'; # must be last |
|
# $tftp::dir = "$server::base_dir/tftp/$pxelinux::path_prefix"; |
|
287 |
} |
} |
288 |
|
|
289 |
warn 'loaded'; |
warn 'loaded'; |