diff options
author | Thierry Vignaud <tv@mandriva.org> | 2009-03-17 17:18:40 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2009-03-17 17:18:40 +0000 |
commit | e32b21a672fc1be9d01ebfa2dce9cc2447751b35 (patch) | |
tree | 3a7c4929f1c2561f9d5061f1c7c6f1e7e0ddd10e /tools | |
parent | 73bda5b472d388987bc405010b28623c79c53e99 (diff) | |
download | drakx-backup-do-not-use-e32b21a672fc1be9d01ebfa2dce9cc2447751b35.tar drakx-backup-do-not-use-e32b21a672fc1be9d01ebfa2dce9cc2447751b35.tar.gz drakx-backup-do-not-use-e32b21a672fc1be9d01ebfa2dce9cc2447751b35.tar.bz2 drakx-backup-do-not-use-e32b21a672fc1be9d01ebfa2dce9cc2447751b35.tar.xz drakx-backup-do-not-use-e32b21a672fc1be9d01ebfa2dce9cc2447751b35.zip |
enable to emulate iso-on-disk installation
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/drakx-in-chroot | 17 |
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) { |