From 7cd6040f7101a94c006cc6360ea2f2c7f80051b9 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Thu, 20 Nov 2003 22:54:39 +0000 Subject: allow testing with a virtual key (a given file on a given partition), that will be faster, easier (and more reliable ;p) that will maybe allow future normal (but strange) use of MandrakeMove with a file on an existing ext2 or a vfat partition, who knows? gael's gonna be happy with his motto "our users find unpredictable usage of our products, ya-hoo!" --- move/move.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'move/move.pm') diff --git a/move/move.pm b/move/move.pm index a0f9ac5f6..7d625286b 100644 --- a/move/move.pm +++ b/move/move.pm @@ -15,6 +15,7 @@ use Digest::MD5 qw(md5_hex); my @ALLOWED_LANGS = qw(en_US fr es it de); our ($using_existing_user_config, $using_existing_host_config); my $key_sysconf = '/home/.sysconf'; +my $virtual_key_part; sub symlinkf_short { my ($dest, $file) = @_; @@ -40,6 +41,20 @@ sub handle_etcfiles { } +sub handle_virtual_key { + if (my ($device, $file) = cat_('/proc/cmdline') =~ /\bvirtual_key=(\S+),(\S+)/) { + log::l("using device=$device file=$file as a virtual key"); + my $dir = '/virtual_key_mount'; + mkdir $dir; + run_program::run('mount', $device, $dir); + require devices; + my $loop = devices::find_free_loop(); + run_program::run('losetup', $loop, "$dir$file"); + run_program::run('mount', $loop, '/home', '-o', 'umask=077,uid=501,gid=501,shortname=mixed'); + $virtual_key_part = { device => $loop, mntpoint => '/home', type => 0xc, isMounted => 1 }; + } +} + #- run very soon at stage2 start, setup things on tmpfs rw / that #- were not necessary to start stage2 itself (there were setup #- by stage1 of course) @@ -108,6 +123,7 @@ sub init { system('sysctl -w kernel.hotplug="/bin/true"'); modules::load_category('bus/usb'); eval { modules::load('usb-storage', 'sd_mod') }; + handle_virtual_key(); install_steps::setupSCSI($o); system('sysctl -w kernel.hotplug="/sbin/hotplug"'); @@ -194,6 +210,10 @@ sub key_mount { $o->{all_hds} = fsedit::empty_all_hds(); install_any::getHds($o, $o); } + if ($virtual_key_part) { + #- :/ merge_from_mtab didn't got my virtual key, need to add it manually + push @{$o->{fstab}}, $virtual_key_part; + } require fs; fs::mount_part($_) foreach key_parts($o); -- cgit v1.2.1