#!../perl

my $dir = `pwd`;
chomp $dir;
$dir .= "/../../..";

$ENV{PERL5LIB} = join ":", map { "$dir/$_" } @INC;
$ENV{LD_LIBRARY_PATH} = "$dir/lib:$dir/usr/lib:$dir/usr/lib/perl5/5.6.0/i386-linux/CORE";
$ENV{PATH} = join(":", map { "$dir/$_" } split ":", "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin") . ":$ENV{PATH}";
$ENV{SHARE_PATH} = "$dir/usr/share";

system "../../../lib/ld-linux.so.2", "../perl", "./install2", "--live", @ARGV;

$ENV{DISPLAY} and system "xset", "-fp", "/tmp/drakx/mdkinst/usr/X11R6/lib/X11/fonts/";
foreach (qw(misc PEX Speedo Type1 mdk 75dpi 100dpi cyrillic)) {
    -d "/usr/X11R6/lib/X11/fonts/$_" or next;
    -e "/usr/X11R6/lib/X11/fonts/$_/fonts.dir" and next;
    chdir "/usr/X11R6/lib/X11/fonts/$_";
    system "mkfontdir";
}
$ENV{DISPLAY} and system "xset", "fp", "rehash";

system "/bin/rm", "-rf", "/tmp/drakx";
system "/bin/rm", "-rf", "/tmp/rhimage";

exec "/bin/sync";