Fixed pre-built modules to be recognized with proper name 'lufs'.
[lufs.git] / kernel / Linux / prepmod.in
index d6870a7..27adcd2 100755 (executable)
@@ -44,6 +44,8 @@ my $lufsmnt_bin;
 if ($0 eq "lufsmnt" || $0=~m#/lufsmnt$#) {
        $quiet=1;
        $lufsmnt_bin='@bindir@/lufsmnt-bin';
+       $lufsmnt_bin=~s#\$\Q{exec_prefix}\E#'@exec_prefix@';#ge;
+       $lufsmnt_bin=~s#\$\Q{prefix}\E#'@prefix@';#ge;
        }
 else {
        die if !GetOptions(
@@ -116,6 +118,8 @@ if (!$kernel) {
        print STDERR "Failed to find kernel headers for $uname_r" if !$kernel && !$quiet;
        }
 else {
+       # We need /usr/include/lufs/* for standard package compilation.
+       # There is no sense to make separate 'devel' package.
        for ("$vardir/lufs.o") {
                next if !$vardir;
                # Create the 'lufs.o' in our /var/lib directory and only link it
@@ -130,9 +134,9 @@ else {
        }
 
 local $_;
-for (<$modbindir/*-$uname_r.o>,<$modbindir/*-${uname_r_base}*.o>,<$modbindir/*.o>) {
+for (<$modbindir/*-$uname_r/*.o>,<$modbindir/*-${uname_r_base}/*.o>,<$modbindir/*/*.o>) {
        next if _system "rmmod lufs 2>/dev/null; insmod -o lufs -p $_ 2>/dev/null";
-       do { cluck "Failed to symlink $_"; next; } if _system "mkdir -p $moduledir; ln -s $_ $moduledir/lufs.o";
+       do { cluck "Failed to symlink $_"; next; } if _system "rm -rf $moduledir; mkdir -p $moduledir; ln -s $_ $moduledir/lufs.o";
        _pass 1;
        }
 confess "lufs module not loaded: $basedir not compilable and no module of $modbindir/*.o usable";