12345678910111213141516171819202122232425 |
- #!/usr/bin/perl
- use strict;
- use warnings;
- my $disk = "/dev/sdb1";
- my $volume = "hddVolume";
- my $mountpoint = "/mnt/hddDisk";
- if ( ! defined $ARGV[0] ) {
- print "Pass either --mount or --umount\n";
- exit 1;
- }
- my $opt = $ARGV[0];
- if ( $opt eq "mount" ) {
- system("sudo cryptsetup luksOpen $disk $volume");
- system("sudo mount /dev/mapper/$volume $mountpoint");
- } elsif ( $opt eq "umount" ) {
- system("sudo umount $mountpoint");
- system("sudo cryptsetup luksClose /dev/mapper/$volume");
- } else {
- print "Did not recognize opt, exiting...\n";
- }
|