summaryrefslogtreecommitdiffstats
path: root/move/move.pm
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-20 22:54:39 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-20 22:54:39 +0000
commit7cd6040f7101a94c006cc6360ea2f2c7f80051b9 (patch)
tree9049e0b3c03d6f6f7afa9f1dd800c154e0e00c6b /move/move.pm
parente802ef13dec3e2e6707c7e8feadb72c7e8ffbcd4 (diff)
downloaddrakx-7cd6040f7101a94c006cc6360ea2f2c7f80051b9.tar
drakx-7cd6040f7101a94c006cc6360ea2f2c7f80051b9.tar.gz
drakx-7cd6040f7101a94c006cc6360ea2f2c7f80051b9.tar.bz2
drakx-7cd6040f7101a94c006cc6360ea2f2c7f80051b9.tar.xz
drakx-7cd6040f7101a94c006cc6360ea2f2c7f80051b9.zip
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!"
Diffstat (limited to 'move/move.pm')
-rw-r--r--move/move.pm20
1 files changed, 20 insertions, 0 deletions
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);