pdff.diff
Posted: Thu 29 Dec 2011, 01:19
With partview it turned out to be a technical logical problem assigning the already mounted flag to the right partitions , so no sort problem .
diff with [[:blank:]] reductions :
NOTE : THE IMPORTANT PART IS :
- $j=0;
+ for($i=0;$i<@all;$i++){ $kmt[$i]=1 }
+ for($j=0;$j<@mnt;$j++){
+ for($i=0;$i<@all;$i++){
+ if($all[$i] eq $mnt[$j]){ $kmt[$i]=0 }
+ }
+ }
- $kmt[$i]=1;
- if(($j < @mnt) && ($all[$i] eq $mnt[$j])){ $kmt[$i]=0; $j++ }
- }
The original code checks if all@i=mnt@i but the mounts might be not in the all@all order .
My hacked code looks for the mnt@all as many times partitions are mounted .
I have no solution for the rootpartition though . But it does not seem to hurt to mount and unmount it another time @/mnt/$rootpartition .
Maybe some rdev code to filter would do it .
[edit]
Want to mention , that
pdff.pl does not support /dev/hd names for IDE kernels !
[edit]
To debug it i found out to alter
/usr/sbin/partview
like
and add several
into /usr/local/Partview/pdff.pl
diff with [[:blank:]] reductions :
Code: Select all
--- /usr/local/Partview/pdff.pl.orig 2010-05-10 19:49:28.000000000 +0100
+++ /usr/local/Partview/pdff.pl 2011-12-29 01:49:05.676488379 +0100
@@ -1,8 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -w
# pdff.pl Partition Viewer. 2009-10-22 Ecube
# 2010-04-08 Single window
# 2010-04-11 Wait message
-# 2010-05-07 Converted to Glade format
+# 2010-05-07 Converted to Glade format
# gtkdialog3 --glade-xml=/tmp/partview.glade --program=dialog1
# 2010-05-10 signal handler="exit:Quit" corrected
#
@@ -17,28 +17,27 @@ if($view_all){
$title="All Drives"; $winpos=0;
open(FH,"probepart|") or die "cannot run command probepart\n";
- $i=0;
+ $i=0;
while(<FH>){ if(/\/dev\/(sd\w+)\|(\w+)\|/){
if($2 eq "swap" || $2 eq "none"){next};
$all[$i]="$1"; $typ[$i++]="$2"; }
}
close FH;
-
+
open(FH,"mount | grep /dev/ | grep /mnt/ | sort |") or die "cannot run command mount\n";
- $i=0;
+ $i=0;
while(<FH>){ if(/\/dev\/(sd\w+)/){ $mnt[$i++]="$1";} }
close FH;
-
- $j=0;
+ for($i=0;$i<@all;$i++){ $kmt[$i]=1 }
+ for($j=0;$j<@mnt;$j++){
+ for($i=0;$i<@all;$i++){
+ if($all[$i] eq $mnt[$j]){ $kmt[$i]=0 }
+ }
+ }
for($i=0;$i<@all;$i++){
- $kmt[$i]=1;
- if(($j < @mnt) && ($all[$i] eq $mnt[$j])){ $kmt[$i]=0; $j++ }
- }
-
- for($i=0;$i<@all;$i++){
if($kmt[$i]){
- $all[$i]=~/\/dev\/(\w+)/;
+ $all[$i]=~/\/dev\/(\w+)/;
unless( -e "/mnt/$all[$i]"){ system "mkdir /mnt/$all[$i]\n"}
system "mount -t $typ[$i] /dev/$all[$i] /mnt/$all[$i]\n";
}
@@ -48,7 +47,7 @@ if($view_all){
open(FH,"df | sort -r |") or die "cannot run command df -h\n";
if($view_all){
- for($i=0;$i<@all;$i++){
+ for($i=0;$i<@all;$i++){
if($kmt[$i]){ system "umount /dev/$all[$i]\n"; }
}
}
- $j=0;
+ for($i=0;$i<@all;$i++){ $kmt[$i]=1 }
+ for($j=0;$j<@mnt;$j++){
+ for($i=0;$i<@all;$i++){
+ if($all[$i] eq $mnt[$j]){ $kmt[$i]=0 }
+ }
+ }
- $kmt[$i]=1;
- if(($j < @mnt) && ($all[$i] eq $mnt[$j])){ $kmt[$i]=0; $j++ }
- }
The original code checks if all@i=mnt@i but the mounts might be not in the all@all order .
My hacked code looks for the mnt@all as many times partitions are mounted .
I have no solution for the rootpartition though . But it does not seem to hurt to mount and unmount it another time @/mnt/$rootpartition .
Maybe some rdev code to filter would do it .
[edit]
Want to mention , that
pdff.pl does not support /dev/hd names for IDE kernels !
[edit]
To debug it i found out to alter
/usr/sbin/partview
like

#!/bin/sh
#2010-05-08 ecube
#`/usr/local/Partview/pdff.pl `
#/usr/local/Partview/pdff.pl
#J=`gtkdialog3 --glade-xml=/tmp/partview.glade --program=dialog1`
#if [ "${J:0:3}" = "all" ]; then
yaf-splash -close never -bg orange -placement center -text "Please wait, processing..." &
XPID=$!
#`/usr/local/Partview/pdff.pl -all $XPID > /dev/null`
/usr/local/Partview/pdff.pl -all $XPID
#`gtkdialog3 --glade-xml=/tmp/partview.glade --program=dialog1`
gtkdialog3 --glade-xml=/tmp/partview.glade --program=dialog1
#fi

and add several
Code: Select all
print("kmt$i=$kmt[$i] $all[$i]\n");