7 use LWP::Simple qw/mirror RC_NOT_MODIFIED/;
11 my ( $url, $file ) = @_;
12 print STDERR "mirror $url";
15 && warn(" not modified\n")
16 || warn(" done ", -s $file, " bytes\n")
25 return if $just_once->{$url}++;
27 my $name = (caller(1))[3];
28 $name =~ s{config::}{} || die "caller isn't package config !";
32 my $dir = "$server::base_dir/iso";
33 mkdir $dir unless -e $dir;
35 my $file = $1 if $url =~ m{/([^/]+\.iso$)}i;
36 die "can't find iso file in $url" unless $file;
38 my $iso = "$dir/$file";
40 mirror_file( $url, $iso );
42 $file =~ s{\.iso$}{}i;
43 my $mnt = "$server::base_dir/tftp/$name";
44 mkdir $mnt unless -d $mnt;
46 mkdir $mnt unless -d $mnt;
48 system("mount -t iso9660 | grep $name/iso || sudo mount $iso $mnt -o loop -t iso9660 -v") == 0;
52 my ( $url, $file ) = @_;
53 my $path = "$server::base_dir/$file";
54 my @file_parts = split m{/}, $file;
55 foreach ( 1 .. $#file_parts - 1 ) {
56 my $path = splice @file_parts, 0, $_;
58 mkdir $path unless -e $path;
60 mirror_file( $url, "$server::base_dir/$file" );