7 use LWP::Simple qw/mirror RC_NOT_MODIFIED/;
12 my ( $url, $file ) = @_;
13 print STDERR "mirror $url";
16 && warn(" not modified\n")
17 || warn(" done ", -s $file, " bytes\n")
21 my $once_path = '/tmp/pxelator.once';
22 our $just_once = retrieve $once_path;
25 return if $just_once->{$what}++;
26 store $just_once, $once_path;
33 return if ! first_time($url);
35 my $name = (caller(1))[3];
36 $name =~ s{config::}{} || die "caller isn't package config !";
40 my $dir = "$server::base_dir/iso";
41 mkdir $dir unless -e $dir;
43 my $file = $1 if $url =~ m{/([^/]+\.iso$)}i;
44 die "can't find iso file in $url" unless $file;
46 my $iso = "$dir/$file";
48 mirror_file( $url, $iso );
50 $file =~ s{\.iso$}{}i;
51 my $mnt = "$server::base_dir/tftp/$name";
52 mkdir $mnt unless -d $mnt;
54 mkdir $mnt unless -d $mnt;
56 system("mount -t iso9660 | grep $name/iso || sudo mount $iso $mnt -o loop -t iso9660 -v") == 0;
62 my $name = (caller(1))[3];
63 $name =~ s{config::}{} || die "caller isn't package config !";
65 my $path = "$server::base_dir/tftp/$name";
67 foreach my $file ( @_ ) {
68 mirror_file "$url/$file", "$path/$file"
69 if first_time( "$url/$file" );
76 my @file_parts = split m{/}, $file;
77 foreach ( 1 .. $#file_parts - 1 ) {
78 my $path = splice @file_parts, 0, $_;
80 mkdir $path unless -e $path;