/[smecontribs]/rpms/smeserver-usbdisksmanager/contribs9/smeserver-usbdisksmanager-1.2-sme9fix2.patch
ViewVC logotype

Annotation of /rpms/smeserver-usbdisksmanager/contribs9/smeserver-usbdisksmanager-1.2-sme9fix2.patch

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


Revision 1.1 - (hide annotations) (download)
Sat Mar 25 05:40:27 2017 UTC (7 years, 8 months ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-usbdisksmanager-1_2-7_el6_sme, smeserver-usbdisksmanager-1_2-5_el6_sme, smeserver-usbdisksmanager-1_2-6_el6_sme, HEAD
* Sat Mar 25 2017 Jean-Philipe Pialasse <tests@pialasse.com> 1.2-5.sme
- fix mount does not work [SME: 8597]
- new default for mounting options

1 unnilennium 1.1 --- smeserver-usbdisksmanager-1.2/root/etc/e-smith/web/functions/usbdisks.old 2017-03-24 18:06:42.000000000 -0400
2     +++ smeserver-usbdisksmanager-1.2/root/etc/e-smith/web/functions/usbdisks 2017-03-25 01:31:02.000000000 -0400
3     @@ -308,7 +308,7 @@
4     if ( ( "$disques{$clef}{DEVTYPE}" eq "USB" ) ||("$disques{$clef}{DEVTYPE}" eq "FireWire" ) )
5     {
6     my %disque = %{$disques{$clef}};
7     - my $options= OptionMenu(\%disque);
8     + my $options= OptionMenu(\%disque) || "";
9     print "<td><font color=black>$options</font></td>";
10     }
11     else
12     @@ -358,7 +358,7 @@
13     my $mounted=`mount`;
14     my @fstab= `cat /etc/fstab`;
15     my @blkid= `/sbin/blkid -c /dev/null `;
16     - my @swap= `cat /proc/swaps|grep '/' |cut -f1`; warn $swap[0];
17     + my @swap= `cat /proc/swaps|grep '/' |cut -f1`;
18     my @lvscan = `/sbin/lvscan`;
19     my %disques;
20     my $i = 0;
21     @@ -586,8 +586,8 @@
22     my $temp_status =db_get_prop(\%usbdisks, $UUID , "status");
23     my $temp_status_media = $_=db_get_prop(\%usbdisks, $UUID , "status_media") ? db_get_prop(\%usbdisks, $UUID , "status_media") : "disabled";
24     my $temp_mountto=db_get_prop(\%usbdisks, $UUID , "mountto");
25     - my $temp_options_mountto= $_=db_get_prop(\%usbdisks, $UUID , "options") ? db_get_prop(\%usbdisks, $UUID , "options") : "pamconsole,exec,noauto,managed";
26     -
27     + my $temp_options_mountto= $_=db_get_prop(\%usbdisks, $UUID , "options") ? db_get_prop(\%usbdisks, $UUID , "options") : "default,noauto";
28     + # pamconsole managed should be removed if present
29     esmith::cgi::genHeaderNonCacheable ($q, \%conf, $tr_titre_modifier.' '.$UUID.'<br><br>');
30     GeneralMenu ($q);
31     print $q->hr;
32     @@ -602,7 +602,7 @@
33     esmith::cgi::genSmallCell ($q, "<input type=\"text\" size=\"45\" name=\"usbd_mountto\" value=\"$temp_mountto\">(".$temp_mountto.")"));
34     print $q->Tr (esmith::cgi::genSmallCell ($q, "$tr_options_mount_to :"),
35     esmith::cgi::genSmallCell ($q, "<input type=\"text\" size=\"45\" name=\"usbd_options_mountto\" value=\"$temp_options_mountto\">(".$temp_options_mountto.")
36     - <br>defaults / pamconsole,exec,noauto,managed"));
37     + <br>defaults : defaults,noauto"));
38     print $q->Tr (esmith::cgi::genSmallCell ($q, "$tr_status :"),
39     esmith::cgi::genSmallCell ($q, "<SELECT name=\"usbd_status\"><option value =\"$temp_status\">$temp_status</option><option value =\"disabled\">disabled</option><option value =\"enabled\">enabled</option</SELECT>(".$temp_status.")"));
40     print $q->Tr (esmith::cgi::genSmallCell ($q, "$tr_status_media :"),
41     @@ -668,7 +668,7 @@
42     if ($pud_status_media eq "enabled") {db_set_prop(\%usbdisks, $pud_UUID , "status_media", "enabled");} else{db_set_prop(\%usbdisks, $pud_UUID , "status_media", "disabled");};
43    
44     #options
45     - if ($pud_options_mountto eq "") {db_set_prop(\%usbdisks, $pud_UUID , "options", "pamconsole,exec,noauto,managed");} else{db_set_prop(\%usbdisks, $pud_UUID , "options",$pud_options_mountto );};
46     + if ($pud_options_mountto eq "") {db_set_prop(\%usbdisks, $pud_UUID , "options", "default,noauto");} else{db_set_prop(\%usbdisks, $pud_UUID , "options",$pud_options_mountto );};
47    
48    
49     $pud_mountto =~ s/\\/\//g; # au cas ou un windowzien viens à taper le chemin de la ressource partagée à la mode Win$
50     @@ -717,8 +717,8 @@
51     print $q->Tr (esmith::cgi::genSmallCell ($q, "mount to"),
52     esmith::cgi::genSmallCell ($q, "<input type=\"text\" size=\"45\" name=\"usbd_mountto\">"));
53     print $q->Tr (esmith::cgi::genSmallCell ($q, "$tr_options_mount_to :"),
54     - esmith::cgi::genSmallCell ($q, "<input type=\"text\" size=\"45\" name=\"usbd_options_mountto\" value=\"pamconsole,exec,noauto,managed\">
55     - <br>defaults / pamconsole,exec,noauto,managed"));
56     + esmith::cgi::genSmallCell ($q, "<input type=\"text\" size=\"45\" name=\"usbd_options_mountto\" value=\"default,noauto\">
57     + <br>defaults : default,noauto"));
58     print $q->Tr (esmith::cgi::genSmallCell ($q, "Status"),
59     esmith::cgi::genSmallCell ($q, "<SELECT name=\"usbd_status\"><option value =\"disabled\">disabled</option><option value =\"enabled\">enabled</option</SELECT>"));
60     print $q->Tr (esmith::cgi::genSmallCell ($q, "$tr_status_media :"),
61     @@ -780,7 +780,7 @@
62     if ($pud_status_media eq "enabled") {db_set_prop(\%usbdisks, $pud_UUID , "status_media", "enabled");} else{db_set_prop(\%usbdisks, $pud_UUID , "status_media", "disabled");};
63    
64     #options
65     - if ($pud_options_mountto eq "") {db_set_prop(\%usbdisks, $pud_UUID , "options", "pamconsole,exec,noauto,managed");} else{db_set_prop(\%usbdisks, $pud_UUID , "options",$pud_options_mountto );};
66     + if ($pud_options_mountto eq "") {db_set_prop(\%usbdisks, $pud_UUID , "options", "default,noauto");} else{db_set_prop(\%usbdisks, $pud_UUID , "options",$pud_options_mountto );};
67     #mount to
68     $pud_mountto =~ s/\\/\//g; # au cas ou un windowzien viens à taper le chemin de la ressource partagée à la mode Win$
69     if (-e $pud_mountto) {
70     @@ -811,13 +811,14 @@
71    
72     sub USBMountDisk($)
73     {
74     - my ($q) = @_;
75     - my $UUID = $q->param ('UUID') || return showInitial ($q,"");
76     + my ($q) = @_;
77     + my $UUID = $q->param ('UUID') || return showInitial ($q,"");
78     + ($UUID) = $UUID =~ m/^([A-Z0-9-]+)$/ig ;
79     my $blkid= `/sbin/blkid -t UUID=$UUID`;
80     - my $dev= $blkid =~ /^(\/dev\/[a-z\-]{2,3}[0-9]{1}):/ ? $1 : "unknown";
81     + my $dev= $blkid =~ /^(\/dev\/[a-z0-9_\-\/]{2,}):/ ? $1 : "unknown";
82     # essaie de montage par UUID ne semble pas correcte pour vfat
83     #my $mount=`/bin/mount -U $UUID`;
84     - my $mount=`/bin/mount $dev `;
85     + my $mount=`/bin/mount $dev 2>&1`;
86     my $mounted= `/bin/mount`=~ /$dev/ ? "$tr_success" : "$tr_failure";
87     print " $dev :mount $mounted <br>";
88     showInitial ($q, "<b><font size='+1'>$tr_rapport mount :</font></b><br>$mounted<BR>
89     @@ -826,14 +827,15 @@
90    
91     sub USBUnMountDisk($)
92     {
93     - my ($q) = @_;
94     - my $UUID = $q->param ('UUID') || return showInitial ($q,"");
95     + my ($q) = @_;
96     + my $UUID = $q->param ('UUID') || return showInitial ($q,"");
97     + ($UUID) = $UUID =~ m/^([A-Z0-9-]+)$/ig ;
98     my $blkid= `/sbin/blkid -t UUID=$UUID`;
99     - my $dev= $blkid =~ /^(\/dev\/[a-z\-]{2,3}[0-9]{1}):/ ? $1 : "unknown";
100     + my $dev= $blkid =~ /^(\/dev\/[a-z0-9_\-\/]{2,}):/ ? $1 : "unknown";
101     my $mounted=`mount`;
102     #destination
103     my $dest= $mounted =~ /$dev on (\/media\/[a-zA-Z0-9_]+) / ? $1 : "unknown" ;
104     - my $mount=`/bin/umount -f $dest`;
105     + my $mount=`/bin/umount -f $dest 2>&1`;
106     $mounted= `/bin/mount`=~ /$dev on (\/media\/[a-zA-Z0-9_]+)/ ? "$tr_failure" : "$tr_success";
107     showInitial ($q, "<b><font size='+1'>$tr_rapport umount :</font></b><br>$mounted<BR>
108     <B>$dev : $dest</B>: $mount<BR><BR>");
109     @@ -845,7 +847,7 @@
110    
111     my $OUT= "<h1>".$tr_known_mounts."</h1>";
112     $OUT .= "<table border='1' cellpadding='3' cellspacing='3'>\n";
113     - $OUT .= "<tr><td>$tr_uuid</td><td>$tr_device_type</td><td>$tr_status_mountto</td><td>$tr_status_mountmedia</td><td>$tr_mount_to</td><td>$tr_connected</td><td>$tr_mounted_to</td><td>$tr_action</td></tr>\n";
114     + $OUT .= "<tr><td>$tr_uuid</td><td>$tr_device_type</td><td>$tr_status_mountmedia</td><td>$tr_status_mountto</td><td>$tr_mount_to</td><td>$tr_connected</td><td>$tr_mounted_to</td><td>$tr_action</td></tr>\n";
115     my $clef;
116     my $disque;
117    
118     @@ -860,8 +862,28 @@
119     $OUT .= "<tr>\n";
120     $OUT .= "<td><font color=black>$clef</font></td>";
121     $OUT .= "<td><font color=blue>".db_get_type(\%usbdisks, $clef )."</font></td>";
122     + # status auto mount media
123     + $OUT .= "<td> ";
124     + if ( $usbd_status_mediaG eq "disabled")
125     + {
126     + $OUT.= "Globally disabled"
127     + }
128     + else
129     + {
130     + if ( (db_get_type(\%usbdisks, $clef ) eq "USB") || (db_get_type(\%usbdisks, $clef ) eq "FireWire") )
131     + {
132     + if (db_get_prop(\%usbdisks, $clef , "status_media")eq "enabled")
133     + {$OUT .="<a href=usbdisks?state=disable_mediaentry&UUID=$clef>".db_get_prop(\%usbdisks, $clef , "status_media")." </a>"; }
134     + elsif (db_get_prop(\%usbdisks, $clef , "status_media")eq "disabled")
135     + {$OUT .="<a href=usbdisks?state=enable_mediaentry&UUID=$clef>".db_get_prop(\%usbdisks, $clef , "status_media")." </a>"; }
136     + else
137     + {$OUT .="<a href=usbdisks?state=enable_mediaentry&UUID=$clef>not set</a>"; }
138     + }
139     + else {$OUT.= db_get_prop(\%usbdisks, $clef , "status_media");};
140     + }
141     + $OUT.= "</td>";
142     # status auto mount_to
143     - $OUT .= "<td> ";
144     + $OUT .= "<td> ";
145     if ( (db_get_type(\%usbdisks, $clef ) eq "USB") || (db_get_type(\%usbdisks, $clef ) eq "FireWire") )
146     {
147     if (db_get_prop(\%usbdisks, $clef , "status")eq "enabled")
148     @@ -871,19 +893,6 @@
149     }
150     else {$OUT.= db_get_prop(\%usbdisks, $clef , "status");};
151     $OUT.= "</td>";
152     - # status auto mount media
153     - $OUT .= "<td> ";
154     - if ( (db_get_type(\%usbdisks, $clef ) eq "USB") || (db_get_type(\%usbdisks, $clef ) eq "FireWire") )
155     - {
156     - if (db_get_prop(\%usbdisks, $clef , "status_media")eq "enabled")
157     - {$OUT .="<a href=usbdisks?state=disable_mediaentry&UUID=$clef>".db_get_prop(\%usbdisks, $clef , "status_media")." </a>"; }
158     - elsif (db_get_prop(\%usbdisks, $clef , "status_media")eq "disabled")
159     - {$OUT .="<a href=usbdisks?state=enable_mediaentry&UUID=$clef>".db_get_prop(\%usbdisks, $clef , "status_media")." </a>"; }
160     - else
161     - {$OUT .="<a href=usbdisks?state=enable_mediaentry&UUID=$clef>not set</a>"; }
162     - }
163     - else {$OUT.= db_get_prop(\%usbdisks, $clef , "status_media");};
164     - $OUT.= "</td>";
165     #mount to
166     $OUT .= "<td><font color=black>".db_get_prop(\%usbdisks, $clef , "mountto")."</font></td>";
167     # connecté
168     @@ -970,13 +979,16 @@
169     {
170     my ($q) = @_;
171     my $UUID = $q->param ('UUID') || return showInitial ($q,"");
172     - my $blkid= `/sbin/blkid -t UUID=$UUID`;
173     - my $dev= $blkid =~ /^(\/dev\/[a-z\-]{2,3}[0-9]{1}):/ ? $1 : "$tr_unknown";
174     - my $dest= db_get_prop(\%usbdisks, $UUID, "mountto");
175     - my $options= $_=db_get_prop(\%usbdisks, $UUID, "options")? db_get_prop(\%usbdisks, $UUID, "options") : "pamconsole,exec,noauto,managed";
176     + ($UUID) = $UUID =~ m/^([A-Z0-9-]+)$/ig ;
177     + my $blkid= `/sbin/blkid -t UUID=$UUID -c /dev/null`;
178     + my $dev= $blkid =~ /^(\/dev\/[a-z0-9_\-\/]{2,}):/ ? $1 : "$tr_unknown";
179     + #my $dev = `/bin/readlink -f /dev/disk/by-uuid/$UUID`;#with line return at the end
180     + my $dest= db_get_prop(\%usbdisks, $UUID, "mountto");
181     + my $options= $_=db_get_prop(\%usbdisks, $UUID, "options")? db_get_prop(\%usbdisks, $UUID, "options") : "default,noauto";
182     # mount par le UUID pas supporté pour vfat
183     - #my $mount=`/bin/mount -U $UUID $dest -o pamconsole,exec,noauto,managed`;
184     - my $mount=`/bin/mount $dev -t auto $dest -o $options`;
185     + #my $mount=`/bin/mount -U $UUID $dest -o default,noauto`;
186     + # to get filesystem type : blkid -o value -s TYPE /dev/sdc1
187     + my $mount=`/bin/mount $dev -t auto $dest -o $options 2>&1`;
188     my $mounted= `/bin/mount`=~ /$dev/ ? "$tr_success" : "$tr_failure";
189     showInitial ($q, "<b><font size='+1'>$tr_rapport mount : </font></b><br>$mounted<BR>
190     <B>$dev</B>: $mount<BR><BR>");
191     @@ -985,12 +997,13 @@
192    
193     sub USBUnMounttoDisk($)
194     {
195     - my ($q) = @_;
196     - my $UUID = $q->param ('UUID') || return showInitial ($q,"");
197     + my ($q) = @_;
198     + my $UUID = $q->param ('UUID') || return showInitial ($q,"");
199     + ($UUID) = $UUID =~ m/^([A-Z0-9-]+)$/ig ;
200     my $blkid= `/sbin/blkid -t UUID=$UUID`;
201     - my $dev= $blkid =~ /^(\/dev\/[a-z\-]{2,3}[0-9]{1}):/ ? $1 : "unknown";
202     + my $dev= $blkid =~ /^(\/dev\/[a-z0-9_\-\/]{2,}):/ ? $1 : "unknown";
203     my $dest= db_get_prop(\%usbdisks, $UUID, "mountto");
204     - my $mount=`/bin/umount -f $dest`;
205     + my $mount=`/bin/umount -f $dest 2>&1`;
206     my $mounted= `/bin/mount`=~ /$dev/ ? "$tr_failure" : "$tr_success";
207     showInitial ($q, "<b><font size='+1'>$tr_rapport umount :</font></b><br>$mounted<BR>
208     <B>$dest</B>: $mount<BR><BR>");

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