1 |
robbat2 14/01/05 20:37:52 |
2 |
|
3 |
Modified: nut.powerfail.initd |
4 |
Added: nut-2.7.1-snmpusb-order.patch |
5 |
nut-2.7.1-fix-scanning.patch |
6 |
Log: |
7 |
Bug #493814: version bump; Bug #480664: NUT_DRIVERS hidden variable converted to UPS_DRIVERS local use family; Bug #485568: Respect AR. Bug #486640: partial fix. |
8 |
|
9 |
(Portage version: 2.2.7/cvs/Linux x86_64, unsigned Manifest commit) |
10 |
|
11 |
Revision Changes Path |
12 |
1.4 sys-power/nut/files/nut.powerfail.initd |
13 |
|
14 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/nut/files/nut.powerfail.initd?rev=1.4&view=markup |
15 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/nut/files/nut.powerfail.initd?rev=1.4&content-type=text/plain |
16 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/nut/files/nut.powerfail.initd?r1=1.3&r2=1.4 |
17 |
|
18 |
Index: nut.powerfail.initd |
19 |
=================================================================== |
20 |
RCS file: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut.powerfail.initd,v |
21 |
retrieving revision 1.3 |
22 |
retrieving revision 1.4 |
23 |
diff -p -w -b -B -u -u -r1.3 -r1.4 |
24 |
--- nut.powerfail.initd 25 Jun 2010 17:21:03 -0000 1.3 |
25 |
+++ nut.powerfail.initd 5 Jan 2014 20:37:52 -0000 1.4 |
26 |
@@ -1,7 +1,7 @@ |
27 |
#!/sbin/runscript |
28 |
-# Copyright 1999-2009 Gentoo Foundation |
29 |
+# Copyright 1999-2014 Gentoo Foundation |
30 |
# Distributed under the terms of the GNU General Public License v2 |
31 |
-# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut.powerfail.initd,v 1.3 2010/06/25 17:21:03 robbat2 Exp $ |
32 |
+# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut.powerfail.initd,v 1.4 2014/01/05 20:37:52 robbat2 Exp $ |
33 |
|
34 |
description='Signal the UPS to kill power in a power failure condition' |
35 |
|
36 |
@@ -21,7 +21,7 @@ start() { |
37 |
fi |
38 |
local UPS_CTL UPS_POWERDOWN |
39 |
|
40 |
- if [ -f /etc/killpower ]; then |
41 |
+ if [ -f /etc/killpower -o -f /etc/nut/killpower ]; then |
42 |
UPS_CTL=/sbin/upsdrvctl |
43 |
UPS_POWERDOWN="${UPS_CTL} shutdown" |
44 |
elif [ -f /etc/apcupsd/powerfail ]; then |
45 |
|
46 |
|
47 |
|
48 |
1.1 sys-power/nut/files/nut-2.7.1-snmpusb-order.patch |
49 |
|
50 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch?rev=1.1&view=markup |
51 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch?rev=1.1&content-type=text/plain |
52 |
|
53 |
Index: nut-2.7.1-snmpusb-order.patch |
54 |
=================================================================== |
55 |
The code that generates the SNMP and USB headers to compile against does not |
56 |
have a deterministic order, leading to different results at times. |
57 |
|
58 |
Signed-off-by: Robin H. Johnson <robbat2@g.o> |
59 |
|
60 |
diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-snmpinfo.py nut-2.7.1/tools/nut-snmpinfo.py |
61 |
--- nut-2.7.1.orig/tools/nut-snmpinfo.py 2014-01-04 19:08:19.117150636 -0800 |
62 |
+++ nut-2.7.1/tools/nut-snmpinfo.py 2013-07-26 12:41:11.000000000 -0700 |
63 |
@@ -78,7 +78,9 @@ |
64 |
output_file.write( "/* SNMP IDs device table */\n" ) |
65 |
output_file.write( "static snmp_device_id_t snmp_device_table[] = {\n" ) |
66 |
|
67 |
-for filename in glob.glob('../drivers/*-mib.c'): |
68 |
+mibs = glob.glob('../drivers/*-mib.c') |
69 |
+mibs.sort() |
70 |
+for filename in mibs: |
71 |
list_of_line = open(filename,'r').read().split(';') |
72 |
for line in list_of_line: |
73 |
if "mib2nut_info_t" in line: |
74 |
diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-usbinfo.pl nut-2.7.1/tools/nut-usbinfo.pl |
75 |
--- nut-2.7.1.orig/tools/nut-usbinfo.pl 2014-01-04 19:12:45.595949760 -0800 |
76 |
+++ nut-2.7.1/tools/nut-usbinfo.pl 2013-11-17 11:27:38.000000000 -0800 |
77 |
@@ -75,7 +75,12 @@ |
78 |
|
79 |
################# MAIN ################# |
80 |
|
81 |
-find(\&find_usbdevs,$scanPath); |
82 |
+find({ |
83 |
+ wanted => \&find_usbdevs, |
84 |
+ follow => 1, |
85 |
+ preprocess => sub { return sort @_ }, |
86 |
+ }, |
87 |
+ $scanPath); |
88 |
&gen_usb_files; |
89 |
|
90 |
################# SUB METHOD ################# |
91 |
|
92 |
|
93 |
|
94 |
|
95 |
1.1 sys-power/nut/files/nut-2.7.1-fix-scanning.patch |
96 |
|
97 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/nut/files/nut-2.7.1-fix-scanning.patch?rev=1.1&view=markup |
98 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-power/nut/files/nut-2.7.1-fix-scanning.patch?rev=1.1&content-type=text/plain |
99 |
|
100 |
Index: nut-2.7.1-fix-scanning.patch |
101 |
=================================================================== |
102 |
Search for correct libusb in testing. |
103 |
|
104 |
There may be many libusb libraries on a system, and we need to iterate until we |
105 |
find the correct one. |
106 |
|
107 |
Signed-off-by: Robin H. Johnson <robbat2@g.o> |
108 |
|
109 |
diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-scanner/scan_usb.c nut-2.7.1/tools/nut-scanner/scan_usb.c |
110 |
--- nut-2.7.1.orig/tools/nut-scanner/scan_usb.c 2014-01-04 18:38:22.496816444 -0800 |
111 |
+++ nut-2.7.1/tools/nut-scanner/scan_usb.c 2014-01-04 19:05:04.598647935 -0800 |
112 |
@@ -28,7 +28,7 @@ |
113 |
#include <ltdl.h> |
114 |
|
115 |
/* dynamic link library stuff */ |
116 |
-static char * libname = "libusb"; |
117 |
+static char * libname = "libusb-0.1"; |
118 |
static lt_dlhandle dl_handle = NULL; |
119 |
static const char *dl_error = NULL; |
120 |
static int (*nut_usb_close)(usb_dev_handle *dev); |
121 |
@@ -41,6 +41,8 @@ |
122 |
static usb_dev_handle * (*nut_usb_open)(struct usb_device *dev); |
123 |
static int (*nut_usb_find_devices)(void); |
124 |
|
125 |
+int nutscan_test_usb_library(const char*,void*); |
126 |
+ |
127 |
/* return 0 on error */ |
128 |
int nutscan_load_usb_library() |
129 |
{ |
130 |
@@ -58,6 +60,22 @@ |
131 |
return 0; |
132 |
} |
133 |
|
134 |
+ int ret = lt_dlforeachfile(NULL, nutscan_test_usb_library, libname); |
135 |
+ if(ret == 0) { |
136 |
+ dl_handle = (void *)1; |
137 |
+ lt_dlexit(); |
138 |
+ } |
139 |
+ |
140 |
+ return ret; |
141 |
+} |
142 |
+ |
143 |
+int nutscan_test_usb_library(const char *filename, void* data) { |
144 |
+ char prefix[64]; |
145 |
+ char *libname = (char*) data; |
146 |
+ sprintf(prefix, "/%s", libname); |
147 |
+ if(strstr(filename, prefix) == NULL) |
148 |
+ return 0; |
149 |
+ |
150 |
- dl_handle = lt_dlopenext(libname); |
151 |
+ dl_handle = lt_dlopenext(filename); |
152 |
if (!dl_handle) { |
153 |
dl_error = lt_dlerror(); |
154 |
goto err; |
155 |
@@ -100,16 +118,15 @@ |
156 |
goto err; |
157 |
} |
158 |
|
159 |
*(void **)(&nut_usb_find_devices) = lt_dlsym(dl_handle,"usb_find_devices"); |
160 |
if ((dl_error = lt_dlerror()) != NULL) { |
161 |
goto err; |
162 |
} |
163 |
|
164 |
+ fprintf(stderr, "Loaded USB library (%s from %s) : USB search enabled.\n", libname, filename); |
165 |
return 1; |
166 |
err: |
167 |
- fprintf(stderr, "Cannot load USB library (%s) : %s. USB search disabled.\n", libname, dl_error); |
168 |
- dl_handle = (void *)1; |
169 |
- lt_dlexit(); |
170 |
+ fprintf(stderr, "Cannot load USB library (%s from %s) : %s. USB search disabled.\n", libname, filename, dl_error); |
171 |
return 0; |
172 |
} |
173 |
/* end of dynamic link library stuff */ |