summaryrefslogtreecommitdiffstats
path: root/tools/drakx-in-chroot
diff options
context:
space:
mode:
Diffstat (limited to 'tools/drakx-in-chroot')
-rwxr-xr-xtools/drakx-in-chroot17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index ec11965c6..a737bd200 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -9,6 +9,7 @@ my $prefix_ROOTED = '/mnt';
my $IMAGE_LOCATION_ROOTED = '/tmp/image';
my $MEDIA_LOCATION_ROOTED = '/tmp/media';
my $STAGE2_LOCATION_ROOTED = '/tmp/stage2';
+my $LOOP_MOUNT_POINT = "$SLASH_LOCATION/tmp/loop";
my $LIVE_LOCATION_REL = 'install/stage2/live/';
my $COMPRESSED_LOCATION_REL = 'install/stage2/';
my $COMPRESSED_FILE_REL = $COMPRESSED_LOCATION_REL . 'mdkinst.sqfs';
@@ -16,11 +17,12 @@ my $AUTO_INSTALL_ROOTED = '/tmp/auto_inst.cfg.pl';
my $DEFCFG_ROOTED = '/tmp/defcfg.pl';
my $RPMSRATE_ROOTED = '/tmp/rpmsrate';
my $resolution = '800x600';
-my $repository_uri;
+my ($disk_iso_repository, $repository_uri);
@ARGV >= 2 or die "usage: drakx-in-chroot <root of distrib> <dir to install to> [options]\n
\nOptions specific to drakx-in-chroot:
--flang XX use XX locale
+ --disk-iso path of a distro
--resolution=XXXxYYYY (eg: --resolution=1024x768)\n
--repository=<path> path of packages repository
--text text mode installer
@@ -31,6 +33,8 @@ foreach (@ARGV) {
$i++;
if (/--resolution=(.*)/) {
$resolution = $1;
+ } elsif (/--disk-iso=(.*)/) {
+ $disk_iso_repository = $1;
} elsif (/--repository=(.*)/) {
$repository_uri = $1;
}
@@ -76,6 +80,14 @@ sys("$sudo mount -o bind $repository_uri $SLASH_LOCATION$MEDIA_LOCATION_ROOTED")
sys("$sudo mount -t proc none $SLASH_LOCATION/proc");
sys("$sudo mount -t sysfs none $SLASH_LOCATION/sys");
+
+if ($disk_iso_repository) {
+ my $repository_arch = $repository_arch || 'i586';
+ mkdir_p($LOOP_MOUNT_POINT);
+ sys("$sudo mount -o loop,ro $disk_iso_repository $LOOP_MOUNT_POINT");
+ symlinkf('loop/' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); # FIXME: arch()
+}
+
symlinkf('media' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED");
create_initial_symlinks();
create_initial_devices();
@@ -123,6 +135,7 @@ if (my $pid = fork()) {
$ENV{URLPREFIX} = $repository;
}
my $cmd = join(' ', "/usr/bin/runinstall2 --local_install",
+ if_($disk_iso_repository, "--method disk-iso"),
if_($remote_repository, "--method $remote_repository"),
@ARGV);
exec "$sudo chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n";
@@ -154,7 +167,7 @@ sub umount_all() {
my $err;
clean_stage2_updates();
my @procs = ('/proc/bus/usb', '/proc', '/sys');
- foreach ((map { "$prefix_ROOTED$_" } @procs, ''), @procs, $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) {
+ foreach ((map { "$prefix_ROOTED$_" } @procs, ''), @procs, $STAGE2_LOCATION_ROOTED, $LOOP_MOUNT_POINT, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) {
my $dir = "$SLASH_LOCATION$_";
rmdir $dir;
if (-d $dir) {