/[smecontribs]/rpms/smeserver-usbdisksmanager/contribs10/smeserver-usbdisksmanager-1.2-sme9fix.patch
ViewVC logotype

Annotation of /rpms/smeserver-usbdisksmanager/contribs10/smeserver-usbdisksmanager-1.2-sme9fix.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Oct 29 19:30:00 2020 UTC (4 years, 1 month ago) by brianr
Branch: MAIN
CVS Tags: smeserver-usbdisksmanager-1_2-8_el7_sme, smeserver-usbdisksmanager-1_2-10_el7_sme, smeserver-usbdisksmanager-1_2-9_el7_sme, HEAD
Initial import

1 brianr 1.1 --- smeserver-usbdisksmanager-1.2/root/etc/e-smith/web/functions/usbdisks.old 2015-09-25 14:55:33.000000000 -0400
2     +++ smeserver-usbdisksmanager-1.2/root/etc/e-smith/web/functions/usbdisks 2017-03-24 17:39:23.000000000 -0400
3     @@ -38,6 +38,23 @@
4     sub modifyConfig ($$);
5     sub GeneralMenu ($);
6     sub aide($);
7     +sub USBModifyConfig;
8     +sub validUSBModifyConfig;
9     +sub USBAddDisk;
10     +sub validUSBAddDisk;
11     +sub USBModifyDisk;
12     +sub validUSBModifyDisk;
13     +sub USBMountDisk;
14     +sub USBUnMountDisk;
15     +sub USBMounttoDisk;
16     +sub USBUnMounttoDisk;
17     +sub disable_entry;
18     +sub enable_entry;
19     +sub disable_mediaentry;
20     +sub enable_mediaentry;
21     +sub delete_entry;
22     +sub UUIDgenerate;
23     +
24    
25    
26    
27     @@ -117,7 +134,6 @@
28     my $tr_save_button = $fm->localise('tr_save_button');
29     my $tr_rapport = $fm->localise('tr_rapport');
30     my $tr_with = $fm->localise('tr_with');
31     -my $tr_removed = $fm->localise('tr_removed');
32     my $tr_disabled = $fm->localise('tr_disabled');
33     my $tr_enabled = $fm->localise('tr_enabled');
34    
35     @@ -338,36 +354,49 @@
36     ##
37     sub subdevices ($)
38     {
39     - my %mounted=`mount`;
40     + #my %mounted=`mount`;
41     my $mounted=`mount`;
42     - my %fstab= `cat /etc/fstab`;
43     + my @fstab= `cat /etc/fstab`;
44     my @blkid= `/sbin/blkid -c /dev/null `;
45     + my @swap= `cat /proc/swaps|grep '/' |cut -f1`; warn $swap[0];
46     + my @lvscan = `/sbin/lvscan`;
47     my %disques;
48     my $i = 0;
49     #my %hashes = (clef =>"valeur", clef2 => "valeur2", [%tablo], %table);
50     #verif usb
51     - #udevinfo -a -p /sys/block/sda
52     + #for SME8: udevinfo -a -p /sys/block/sda
53     + #for SME9: udevadm info -a -p /sys/block/sda
54     for (@blkid)
55     {
56     # chemin dev
57     - $disques{$i}{dev}= $_ =~ /^(\/dev\/[a-z\-]{2,3}[0-9]{1}):/ ? $1 : "$tr_unknown";
58     - my $device = $disques{$i}{dev};
59     + #$disques{$i}{dev}= $_ =~ /^(\/dev\/[a-z\-]{2,3}[0-9]{1}):/ ? $1 : "$tr_unknown";
60     + $disques{$i}{dev}= $_ =~ /^(\/dev\/[a-z0-9\-_\/]{2,}):/ ? $1 : "$tr_unknown";
61     + my $oridevice = $disques{$i}{dev};
62     + # for lvm /dev/mapper/main-root; change to /dev/main/root
63     + $disques{$i}{dev}= $disques{$i}{dev} =~ /^\/dev\/mapper\/([a-z0-9_]{2,})-([a-z0-9_]{2,})$/ ? "/dev/$1/$2" : $disques{$i}{dev};
64     + my $device = $disques{$i}{dev};
65     + my $good = "";
66     + $good = `/bin/readlink -f $device` if $device ne $oridevice;
67     # nom disque sda (not partition but hard drive)
68     - $disques{$i}{name}= $_ =~ /^\/dev\/([a-z\-]{2,3})[0-9]{1}:/ ? $1 : "$tr_unknown";
69     + $disques{$i}{name}= $_ =~ /^\/dev\/([a-z\-]{2,})[0-9]*:/ ? $1 : "$tr_unknown";
70     + #$disques{$i}{name}= $_ =~ /^\/dev\/([a-z0-9\-_\/]{2,}):/ ? $1 : "$tr_unknown";
71     # UUID
72     $disques{$i}{UUID}= $_ =~ /UUID="([0-9a-zA-Z\-]*)"/ ? $1 : "$tr_unknown";
73     # label for partition
74     $disques{$i}{LABEL}= $_ =~ /LABEL="([a-zA-Z0-9_\-]*)"/ ? $1 : "$tr_unknown";
75     # mouted or not
76     - $disques{$i}{mounted}= $mounted =~ /$device on (\/media\/[a-zA-Z0-9_]+) / ? $1 : "no" ;
77     + $disques{$i}{mounted}= $mounted =~ /$device on ([\/\-a-zA-Z0-9_]+) / ? $1 : "no" ;
78     + $disques{$i}{mounted}= $mounted =~ /$oridevice on ([\/\-a-zA-Z0-9_]+) / ? $1 : "no" if $oridevice ne $device;
79     + # the one under does not work with regex , do not know why : map (/$good/ , @swap) ,maybe the / in the device path
80     + $disques{$i}{mounted}= grep($good , @swap) ? 'swap' : "no" if $device =~ /swap/;
81     # is it in fstab
82     - $disques{$i}{fstab}= map ( /$device/, %fstab)? "yes" : "no";
83     + $disques{$i}{fstab}= map ( /$device/, @fstab)? "yes" : "no";
84     my $UUID= $disques{$i}{UUID};
85     my $label= $disques{$i}{LABEL};
86     if ( ($disques{$i}{fstab} eq "no") && (! $UUID eq "") )
87     - {$disques{$i}{fstab}= map ( /$UUID/, %fstab)? "yes" : "no";}
88     + {$disques{$i}{fstab}= map ( /$UUID/, @fstab)? "yes" : "no";}
89     if ( ($disques{$i}{fstab} eq "no") && (! $label eq "") )
90     - {$disques{$i}{fstab}= map ( /$label/, %fstab)? "yes" : "no";}
91     + {$disques{$i}{fstab}= map ( /$label/, @fstab)? "yes" : "no";}
92     # file system type ext2 ext3 swap vfat ...
93     if ( $_ =~ / SEC_TYPE="([a-zA-Z0-9_\-]*)"/ )
94     {$disques{$i}{FSTYPE}= $_ =~ / SEC_TYPE="([a-zA-Z0-9_\-]*)"/ ? $1 : "$tr_unknown";}
95     @@ -376,9 +405,19 @@
96     # device type : usb ide sata/scsi
97     $disques{$i}{DEVTYPE}= "$tr_unknown";
98     my $name = $disques{$i}{name};
99     - # my $udevinfo = `/usr/bin/udevinfo -a -p /sys/block/$name` ;
100     + # for SME8: my $udevinfo = `/usr/bin/udevinfo -a -p /sys/block/$name` ;
101     + # for SME9: my $udevinfo = `/sbin/udevadm info -a -p /sys/block/$name` ;
102     # small change in udevinfo between rhel 4 and 5
103     - my $udevinfo = `/usr/bin/udevinfo -p /sys/block/$name -q env|grep "ID_BUS="|sed -e 's/^ID_//g'` ;
104     + $disques{$i}{DEVTYPE}= "";
105     + #LVM
106     + $disques{$i}{DEVTYPE}= map ( /$device/, @lvscan)? "LVM" : "";
107     + #RAID
108     + my $infobis=`cat /proc/mdstat |grep -o md[0-9]*`;
109     + $disques{$i}{DEVTYPE}= "RAID" if ($infobis =~ /$name/);
110     + # real device
111     + if ( $disques{$i}{DEVTYPE} eq "" ) {
112     +
113     + my $udevinfo = `/sbin/udevadm info -p /sys/block/$name -q env |grep "ID_BUS="|sed -e 's/^ID_//g'` ;
114     if ($udevinfo =~ /BUS=ide/)
115     {
116     $disques{$i}{DEVTYPE}= "IDE";
117     @@ -411,8 +450,9 @@
118     $disques{$i}{DEVTYPE}= $udevinfo;
119     }
120     }
121     + }
122     $i++;
123     - }
124     + }
125     return %disques;
126     }
127    
128     @@ -593,7 +633,7 @@
129     my $blkid= `/sbin/blkid -t UUID=$pud_UUID`;
130     my $name= $blkid =~ /^\/dev\/([a-z\-]{2,3})[0-9]{1}:/ ? $1 : "$tr_unknown";
131     my $type;
132     - my $udevinfo = `/usr/bin/udevinfo -a -p /sys/block/$name` ;
133     + my $udevinfo = `/sbin/udevadm info -a -p /sys/block/$name` ;
134     if ($udevinfo =~ /BUS="ide"/)
135     {
136     $type= "IDE";
137     @@ -704,7 +744,7 @@
138     my $blkid= `/sbin/blkid -t UUID=$pud_UUID`;
139     my $name= $blkid =~ /^\/dev\/([a-z\-]{2,3})[0-9]{1}:/ ? $1 : "unknown";
140     my $type;
141     - my $udevinfo = `/usr/bin/udevinfo -a -p /sys/block/$name` ;
142     + my $udevinfo = `/sbin/udevadm info -a -p /sys/block/$name` ;
143     if ($udevinfo =~ /BUS="ide"/)
144     {
145     $type= "IDE";
146     @@ -794,7 +834,7 @@
147     #destination
148     my $dest= $mounted =~ /$dev on (\/media\/[a-zA-Z0-9_]+) / ? $1 : "unknown" ;
149     my $mount=`/bin/umount -f $dest`;
150     - my $mounted= `/bin/mount`=~ /$dev on (\/media\/[a-zA-Z0-9_]+)/ ? "$tr_failure" : "$tr_success";
151     + $mounted= `/bin/mount`=~ /$dev on (\/media\/[a-zA-Z0-9_]+)/ ? "$tr_failure" : "$tr_success";
152     showInitial ($q, "<b><font size='+1'>$tr_rapport umount :</font></b><br>$mounted<BR>
153     <B>$dev : $dest</B>: $mount<BR><BR>");
154     }

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed