theo@ubuntucy.org has asked for the wisdom of the Perl Monks concerning the following question:
After you successfully give the passphrase you get /dev/mapper/dec-DATA which is the unencrypted volume I want to automate this using Expect.pm I came up with this code:# cryptsetup luksOpen /dev/VG/DATA dec-DATA Enter passphrase for /dev/VG/DATA:
Now I have the following peculiarity. When $Expect::Debug is set to 0 it does not work; when set to 1 it does!#!/usr/bin/perl use strict; use warnings; use Expect; use Getopt::Std; $Expect::Debug = 0; $Expect::Log_Stdout = 1; my $command = "/sbin/cryptsetup"; my $timeout = 5; my $exp = Expect->spawn( $command, 'luksOpen', '/dev/VG/DATA', 'dec-DATA' ) or die "Cannot spawn $command: $!\n"; my $idx = $exp->expect($timeout, [qr/Enter\s+passphrase\s+for/, sub { my $exp =shift; $exp->send("secret\n"); }] ); $exp->soft_close();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Expect for cryptsetup
by kcott (Archbishop) on Aug 20, 2013 at 07:02 UTC | |
|
Re: Expect for cryptsetup
by grondilu (Friar) on Aug 20, 2013 at 22:02 UTC | |
|
Re: Expect for cryptsetup
by theo@ubuntucy.org (Initiate) on Aug 21, 2013 at 06:59 UTC |