hddOp
1	#!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 my $disk = "/dev/sdb1";
7 my $volume = "hddVolume";
8 my $mountpoint = "/mnt/hddDisk";
9
10 if ( ! defined $ARGV[0] ) {
11 print "Pass either --mount or --umount\n";
12 exit 1;
13 }
14
15 my $opt = $ARGV[0];
16
17 if ( $opt eq "mount" ) {
18 system("sudo cryptsetup luksOpen $disk $volume");
19 system("sudo mount /dev/mapper/$volume $mountpoint");
20 } elsif ( $opt eq "umount" ) {
21 system("sudo umount $mountpoint");
22 system("sudo cryptsetup luksClose /dev/mapper/$volume");
23 } else {
24 print "Did not recognize opt, exiting...\n";
25 }