diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-01-15 21:18:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-01-15 21:18:00 +0000 |
commit | b62b2f3dc75d15d570344656f950502afeb2dc8d (patch) | |
tree | 21437772d3da2b4743788d70cf97e25887d5197a /perl-install/devices.pm | |
parent | 936db376c2f856166a9cbb52268bb751ac2745d8 (diff) | |
download | drakx-b62b2f3dc75d15d570344656f950502afeb2dc8d.tar drakx-b62b2f3dc75d15d570344656f950502afeb2dc8d.tar.gz drakx-b62b2f3dc75d15d570344656f950502afeb2dc8d.tar.bz2 drakx-b62b2f3dc75d15d570344656f950502afeb2dc8d.tar.xz drakx-b62b2f3dc75d15d570344656f950502afeb2dc8d.zip |
encrypted filesystem handling:
- using losetup
- add "Options" for partitions in diskdrake (expert mode)
Diffstat (limited to 'perl-install/devices.pm')
-rw-r--r-- | perl-install/devices.pm | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/perl-install/devices.pm b/perl-install/devices.pm index 7228f9410..4ccac4901 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -32,17 +32,38 @@ sub size($) { $low + 1; } +sub del_loop { + my ($dev) = @_; + run_program::run("losetup", "-d", $dev); +} +sub find_free_loop { + foreach (0..7) { + my $dev = make("loop$_"); + { + local *F; + sysopen F, $dev, 2 or next; + !ioctl(F, c::LOOP_GET_STATUS(), my $tmp) && $! == 6 or next; #- 6 == ENXIO + close F; + } + return $dev; + } + die "no free loop found"; +} sub set_loop { - my ($file) = @_; + my ($file, $encrypt_key, $encryption) = @_; + my $dev = find_free_loop(); - foreach (0..7) { + if ($encrypt_key && $encryption) { + my $cmd = "losetup -p 0 -e $encryption $dev $file"; + log::l("calling $cmd"); local *F; - my $dev = make("loop$_"); - sysopen F, $dev, 2 or next; - !ioctl(F, c::LOOP_GET_STATUS(), my $tmp) && $! == 6 or next; #- 6 == ENXIO - log::l("trying with loop $dev"); - return c::set_loop(fileno F, $file) && $dev; + open F, "|$cmd"; + print F $encrypt_key; + close F or die "losetup failed"; + } else { + run_program::run("losetup", $dev, $file) or return; } + $dev; } sub entry { |