wok view ocsinventory-agent/stuff/Drives.pm.u @ rev 4053

Add: gnustep APIs (Free Software version of OpenStep)
author Christophe Lincoln <pankso@slitaz.org>
date Wed Sep 09 21:48:33 2009 +0200 (2009-09-09)
parents
children
line source
1 --- Ocsinventory-Agent-1.0.1.ori/lib/Ocsinventory/Agent/Backend/OS/Linux/Drives.pm Fri Mar 6 19:02:57 2009
2 +++ Ocsinventory-Agent-1.0.1/lib/Ocsinventory/Agent/Backend/OS/Linux/Drives.pm Sun Jul 12 22:29:32 2009
3 @@ -1,9 +1,11 @@
4 package Ocsinventory::Agent::Backend::OS::Linux::Drives;
5 +# Modified bye Erjo <erjo@slitaz.org>
6 +# Busybox df applet as no -T -P options.
8 use strict;
9 sub check {
10 return unless can_run ("df");
11 - my $df = `df -TP`;
12 + my $df = `df -k`;
13 return 1 if $df =~ /\w+/;
14 0
15 }
16 @@ -19,14 +21,14 @@
17 my $volumn;
20 - foreach(`df -TP`) { # TODO retrive error
21 - if(/^(\S+)\s+(\S+)\s+(\S+)\s+(?:\S+)\s+(\S+)\s+(?:\S+)\s+(\S+)\n/){
22 + foreach(`df -k`) { # TODO retrive error
23 + if(/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){
24 $free = sprintf("%i",($4/1024));
25 - $filesystem = $2;
26 - $total = sprintf("%i",($3/1024));
27 - $type = $1;
28 - $volumn = $5;
29 -
30 + $filesystem = $1;
31 + $total = sprintf("%i",($2/1024));
32 + $type = `grep ^$1 /etc/mtab | cut -d " " -f 3`;;
33 + $volumn = $6;
34 +
35 # no virtual FS
36 next if ($type =~ /^(tmpfs|usbfs|proc|devpts|devshm|udev)$/);
37 next if ($filesystem =~ /^(tmpfs)$/);
38 @@ -36,8 +38,7 @@
39 FILESYSTEM => $filesystem,
40 TOTAL => $total,
41 TYPE => $type,
42 - VOLUMN =>
43 - $volumn
44 + VOLUMN => $volumn
45 })
46 }
47 }