On Thu, Sep 24, 2015 at 04:07:18PM +0200, Petter Reinholdtsen wrote:
>
> Please submit the patch as a bug report to make sure it is not
> forgotten.
Will do so, but first...
> It would be great if it could be rewritten as perl instead of calling
> external programs.
Works for me, but might be smarter; please check it:
--- a/debian-edu-fsautoresize 2015-09-20 14:11:49.000000000 +0200
+++ b/debian-edu-fsautoresize 2015-09-25 11:34:51.859501842 +0200
@@ -14,6 +14,7 @@
use Getopt::Std;
use Sys::Syslog qw(openlog syslog closelog LOG_NOTICE);
+use File::Basename;
# Using this module (instead of Filesys::DiskSpace) to get a version
# providing the device size, and not only free and used.
@@ -194,6 +195,13 @@
chomp;
my @f = split(/\s+/);
my $device = $f[0];
+ # Always use mapper names instead of kernel ones.
+ if (index ($f[0], "/dev/dm-") != -1) {
+ for my $mapdevice (glob "/dev/mapper/*") {
+ my $dmdevice = basename(readlink $mapdevice) if -l $mapdevice;
+ $device = $mapdevice if defined($dmdevice) && $dmdevice =~ basename($f[0]);
+ }
+ }
my $mountpoint = $f[1];
my $typename = $f[2];
next unless (exists $fsops{$typename});
Wolfgang
Attachment:
signature.asc
Description: PGP signature