Skip to content

Commit

Permalink
- skip device on errors
Browse files Browse the repository at this point in the history
- properly skip RAID devices
- skip already mounted partitions
  • Loading branch information
ajacoutot committed Dec 10, 2020
1 parent 8944a5a commit b815e7b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
v1.14 - UNRELEASED
------------------------------------

v1.13 - Mon Nov 30 20:48:33 CET 2020
------------------------------------
- skip device on errors
- properly skip RAID devices
- skip already mounted partitions

v1.12 - Mon Nov 30 20:48:33 CET 2020
------------------------------------
- remove some debug output
Expand Down
12 changes: 8 additions & 4 deletions toad.pl
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,8 @@ sub mount_device {
my @allparts;
my @parts;

# ignore softraid(4) crypto device attachment
my $sr_crypto = `/sbin/disklabel $devname 2>/dev/null | grep "SR CRYPTO"`;
if ($sr_crypto) {
# XXX skip device on error (e.g. DIOCGDINFO) or softraid(4) attachment
if (system ("set -o pipefail; /sbin/disklabel $devname 2>/dev/null | ! grep -qw RAID") != 0) {
return (0);
}

Expand All @@ -308,8 +307,13 @@ sub mount_device {
foreach my $part (@parts) {
$part =~ s/^\s+//;
my $device = "/dev/$devname$part";
my $devnum = get_mount_point ();

# skip already mounted partition
if (system ("/sbin/mount | grep -q $device") == 0) {
next;
}

my $devnum = get_mount_point ();
create_mount_point ($devnum);
create_pkrule ($devname, $devnum, $part);

Expand Down

0 comments on commit b815e7b

Please sign in to comment.