1 # Platform configuration
3 # Select the platform by setting the define below either by command
5 # e.g. rpmbuild -ba --define "build_suse 1" apcupsd.spec
6 # or by manually setting it to 1 in this file,
9 # If you want the gapcmon package, use:
10 # e.g. rpmbuild -ba --define "build_gapcmon 1" --define "build_suse 1" apcupsd.spec
11 # or by manually setting it to 1 in this file,
12 # e.g. %define gapcmon 1
14 # If you want the (obsolete) NET-SNMP driver, use:
15 # e.g. rpmbuild -ba --define "build_snmp 1" --define "build_suse 1" apcupsd.spec
16 # or by manually setting it to 1 in this file,
18 # The modern SNMP driver is always enabled since it has no dependencies.
20 # Note, to build, you need:
21 # Release_Notes-%{version}-%{release}.tar.gz in your
22 # rpm SOURCES directory, and the tar file must contain
23 # Release_Notes-%{version}-%{release}.txt
26 # basic defines for every build
27 %define _version @VERSION@
30 #--------------------------------------------------------------------------
31 # it should not be necessary to change anything below here for a release
32 # except for patch macros in the setup section if used
33 #--------------------------------------------------------------------------
35 %define pwrfaildir @PWRFAILDIR@
36 %define halpolicydir
/usr
/share
/hal
/fdi
/policy
/20thirdparty
38 # third party packagers
39 %define _packager D. Scott Barninger
<barninger@fairfieldcomputers.com
>
40 %{?contrib_packager:%define _packager %{contrib_packager}}
43 %{?build_rh7:%define rh7 1}
46 %{?build_rh8:%define rh8 1}
49 %{?build_rh9:%define rh9 1}
51 # all FC releases to date
53 %{?build_fedora_core:%define fedora_core 1}
55 # RedHat Enterprise and all clones
57 %{?build_rhel3:%define rhel3 1}
59 %{?build_rhel4:%define rhel4 1}
61 %{?build_rhel5:%define rhel5 1}
65 %{?build_suse:%define suse 1}
67 # Mandrake and Mandriva
69 %{?build_mdk:%define mdk 1}
72 %define suse_version
0
76 %define initdir
/etc
/rc.d
78 %define initdir
/etc
/rc.d
/init.d
81 # set destination directories for multimon
82 %define cgidir
/var
/www
/cgi
-bin
84 %define cgidir
/srv
/www
/cgi
-bin
87 # set ownership of files
90 %define dataowner apache
91 %define datagroup apache
93 %define dataowner wwwrun
97 # should we build gapcmon, requires gtk2 >= 2.4
99 %{?build_gapcmon:%define gapcmon 1}
101 # should we build net-snmp driver
103 %{?build_snmp:%define snmp 1}
105 Summary: APC UPS Power Control Daemon
for Linux
109 Vendor: APC UPS Daemon Team
110 Distribution: The apcupsd Team
111 Packager: %{_packager}
112 URL: http
://www.apcupsd.com
113 Source0: http
://www.spcupsd.com
/%{name}-%{version}.tar.gz
114 Source1: Release_Notes
-%{version}-%{release}.tar.gz
115 Group: System Environment
/Daemons
117 BuildRoot: %{_tmppath}/%{name}-root
118 BuildRequires
: gd
-devel
, ncurses
-devel
, ghostscript
, libstdc
++-devel
120 BuildRequires
: glibc
-devel
>= 2.2, libjpeg
-devel
, libpng
-devel
, zlib
-devel
, freetype
-devel
122 BuildRequires
: glibc
-devel
>= 2.3
125 BuildRequires
: glibc
-devel
, gtk2
-devel
>= 2.4, glib2
-devel
, atk
-devel
126 BuildRequires
: ORBit2
, pango
-devel
, pkgconfig
128 %if %{suse} && %{gapcmon}
129 BuildRequires
: bonobo
-activation
, freetype2
-devel
, cairo
-devel
, fontconfig
-devel
130 BuildRequires
: gconf2
-devel
, gnome
-vfs2
-devel
, libpng
-devel
, glitz
-devel
, xorg
-x11
-libs
131 BuildRequires
: libbonobo
-devel
, libbonoboui
-devel
133 %if %{fedora_core} && %{gapcmon}
134 BuildRequires
: libbonobo
-devel
, libbonoboui
-devel
, freetype
-devel
, GConf2
-devel
136 %if %{mdk} && %{gapcmon}
137 BuildRequires
: libbonobo2_0
-devel
, libbonoboui2_0
-devel
, freetype2
-devel
, libGConf2_4
-devel
139 %if %{rhel4} && %{gapcmon}
140 BuildRequires
: libbonobo
-devel
, libbonoboui
-devel
, freetype
-devel
, GConf2
-devel
142 %if %{rhel5} && %{gapcmon}
143 BuildRequires
: libbonobo
-devel
, libbonoboui
-devel
, freetype
-devel
, GConf2
-devel
146 BuildRequires
: net
-snmp
-devel
150 Obsoletes
: apcupsd
-std apcupsd
-usb
152 Requires: perl
, ncurses
154 Requires: glibc
>= 2.2
156 Requires: glibc
>= 2.3
163 Apcupsd can be used
for controlling most APC UPSes. During a
164 power failure
, apcupsd will inform the users about the power
165 failure and that a shutdown may occur. If power is not restored
,
166 a system shutdown will follow when the battery is exausted
, a
167 timeout
(seconds
) expires
, or the battery runtime expires based
168 on internal APC calculations determined by power consumption
169 rates. If the power is restored before one of the above shutdown
170 conditions is met
, apcupsd will inform users about this fact.
171 Some features depend on what UPS model you have
(simple or smart
).
172 This package is configured
for USB but can be reconfigured
for
173 standard serial port UPS models. See the manual.
176 Summary: APC UPS Power Control Daemon
for Linux
177 Group: Applications
/Internet
180 %if %{fedora_core} || %{suse} || %{mdk} || %{rhel4} || %{rhel5}
186 Requires: glibc
>= 2.2, libjpeg
, libpng
, zlib
, freetype
188 Requires: glibc
>= 2.3
191 %description multimon
192 apcupsd Network Monitoring
(CGI
) Programs which will give you the
193 status of your UPS or UPSes over the network.
197 Summary: APC UPS Power Control Daemon
for Linux
198 Group: Applications
/System
200 Requires: glibc
, gtk2
>= 2.4, glib2
, atk
, libbonobo
, libbonoboui
, ORBit2
, pango
203 %if %{suse} && %{gapcmon}
204 Requires: bonobo
-activation
, freetype2
, cairo
, fontconfig
, gconf2
, gnome
-vfs2
, libpng
, glitz
, xorg
-x11
-libs
206 %if %{fedora_core} && %{gapcmon}
207 Requires: freetype
, GConf2
209 %if %{mdk} && %{gapcmon}
210 Requires: freetype2
, GConf2
212 %if %{rhel4} && %{gapcmon}
213 Requires: freetype
, GConf2
215 %if %{rhel5} && %{gapcmon}
216 Requires: freetype
, GConf2
221 A Gnome application to monitor the status of your UPS.
224 # SuSE turns off stripping of binaries by default. In order to get
225 # stripped packages we must generate debug package. RedHat and Mandriva
226 # turn debug packages on by default but strip binaries regardless.
238 --prefix
=%{_prefix} \
240 --sysconfdir
=%{_sysconfdir}/apcupsd \
241 --with
-cgi
-bin
=%{cgidir} \
257 --with
-halpolicydir
=%{halpolicydir} \
267 [ "$RPM_BUILD_ROOT"
!= "
/"
] && rm -rf $RPM_BUILD_ROOT
269 mkdir -p $RPM_BUILD_ROOT
%{initdir}
270 mkdir -p $RPM_BUILD_ROOT
%{_sysconfdir}/apcupsd
/cgi
273 DESTDIR
=$RPM_BUILD_ROOT \
276 install -m744 platforms
/apccontrol \
277 $RPM_BUILD_ROOT
%{_sysconfdir}/apcupsd
/apccontrol
279 %if ! %{suse} && ! %{mdk}
280 install -m755 platforms
/redhat
/apcupsd $RPM_BUILD_ROOT
%{initdir}
283 install -m755 platforms
/suse
/apcupsd $RPM_BUILD_ROOT
%{initdir}
286 install -m755 platforms
/mandrake
/apcupsd $RPM_BUILD_ROOT
%{initdir}
290 rm $RPM_BUILD_ROOT
%{initdir}/halt
291 rm $RPM_BUILD_ROOT
%{initdir}/halt.old
294 install -m744 examples
/hid
-ups \
295 $RPM_BUILD_ROOT
%{_sysconfdir}/apcupsd
/hid
-ups
296 install -m744 examples
/make-hiddev \
297 $RPM_BUILD_ROOT
%{_sysconfdir}/apcupsd
/make-hiddev
300 [ "$RPM_BUILD_ROOT"
!= "
/"
] && rm -rf $RPM_BUILD_ROOT
301 rm -f $RPM_BUILD_DIR
/Release_Notes
-%{version}-%{release}.txt
304 %defattr(-,root
,root
)
305 %{_sysconfdir}/apcupsd
/make-hiddev
306 %{_sysconfdir}/apcupsd
/hid
-ups
307 %{halpolicydir}/80-apcupsd
-ups
-policy.fdi
308 %doc COPYING DISCLAIMER ReleaseNotes ChangeLog ..
/Release_Notes
-%{version}-%{release}.txt doc
/manual
/manual.html doc
/manual
/*.png
309 %dir %{_sysconfdir}/apcupsd
311 %config(noreplace
) %{_sysconfdir}/apcupsd
/apccontrol
312 %config(noreplace
) %{_sysconfdir}/apcupsd
/changeme
313 %config(noreplace
) %{_sysconfdir}/apcupsd
/commfailure
314 %config(noreplace
) %{_sysconfdir}/apcupsd
/commok
315 %config(noreplace
) %{_sysconfdir}/apcupsd
/onbattery
316 %config(noreplace
) %{_sysconfdir}/apcupsd
/offbattery
317 %config(noreplace
) %{_sysconfdir}/apcupsd
/apcupsd.conf
319 %attr(-,root
,man
) %{_mandir}/*/*
322 %defattr(-,root
,root
)
323 %dir %{_sysconfdir}/apcupsd
325 %attr(-,%{dataowner},%{datagroup}) %{_sysconfdir}/apcupsd
/apcupsd.css
326 %attr(-,%{binowner},%{bingroup}) %{cgidir}/*
327 %attr(-,%{dataowner},%{datagroup}) %config(noreplace) %{_sysconfdir}/apcupsd
/hosts.conf
328 %attr(-,%{dataowner},%{datagroup}) %config(noreplace) %{_sysconfdir}/apcupsd
/multimon.conf
332 %defattr(-,root
,root
)
333 %{_prefix}/bin
/gapcmon
334 %{_prefix}/share
/applications
/gapcmon.desktop
335 %{_prefix}/share
/pixmaps
/apcupsd.png
336 %{_prefix}/share
/pixmaps
/charging.png
337 %{_prefix}/share
/pixmaps
/gapc_prefs.png
338 %{_prefix}/share
/pixmaps
/onbatt.png
339 %{_prefix}/share
/pixmaps
/online.png
340 %{_prefix}/share
/pixmaps
/unplugged.png
345 # get rid of any 3.6.2 stuff
346 rm -f
/etc
/rc.d
/rc
[0-6].d
/[KS
]20apcups
347 rm -f
%{initdir}/apcups
350 if [ "$
1"
-ge
1 ] ; then
351 /sbin
/chkconfig
--add apcupsd
354 # are we Red Hat or SuSE?
355 # Mandrake already handles apcupsd
356 if [ -s
/etc
/redhat
-release
-o
-s
/etc
/SuSE
-release
-o
-s
/etc
/whitebox
-release
]; then
357 cp
-f
%{initdir}/halt %{initdir}/halt.old
358 awk '
# Stuff left over from a previous apcupsd, remove it
359 /^
# See if this is a powerfail situation\./ {
362 } while (length
($
0) != 0)
365 # We insert the new apcupsd code just before the following line
366 /^
# Now halt or reboot\./ {
367 print "
# See if this is a powerfail situation. # ***apcupsd***"
368 print "
if [ -f
%{pwrfaildir}/powerfail
]; then # ***apcupsd***"
369 print "
echo # ***apcupsd***"
370 print "
echo \"APCUPSD will now power off the UPS\"
# ***apcupsd***"
371 print "
echo # ***apcupsd***"
372 print "
%{pwrfaildir}/apccontrol killpower
# ***apcupsd***"
373 print "
echo # ***apcupsd***"
374 print "
echo \"Please ensure that the UPS has powered off before rebooting\"
# ***apcupsd***"
375 print "
echo \"Otherwise
, the UPS may cut the power during the reboot
!!!\"
# ***apcupsd***"
376 print "
echo # ***apcupsd***"
377 print "
fi # ***apcupsd***"
380 # Everything else is duplicated
381 { print
} '
%{initdir}/halt.old > %{initdir}/halt
383 chmod
744 %{initdir}/halt
386 # restart the daemon if we are upgrading
387 if [ "$
1"
-ge "
2"
] ; then
388 %{initdir}/apcupsd restart
395 if [ "$
1"
= 0 ] ; then
397 # remove startup links
398 /sbin
/chkconfig
--del apcupsd
400 # are we Red Hat or SuSE?
401 # Mandrake already handles apcupsd
402 if [ -s
/etc
/redhat
-release
-o
-s
/etc
/SuSE
-release
-o
-s
/etc
/whitebox
-release
]; then
404 cp
-f
%{initdir}/halt %{initdir}/halt.old
405 awk '
# Stuff added by apcupsd, remove it
406 /^
# See if this is a powerfail situation\./ {
409 } while (length
($
0) != 0)
412 # Everything else is duplicated
413 { print
} '
%{initdir}/halt.old > %{initdir}/halt
415 chmod
744 %{initdir}/halt
420 * Sun Jan
10 2010 Adam Kropelin
<akropel1 at rochester.rr.com
>
421 - changes
for new snmp driver
422 * Sat Aug
01 2009 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
423 - fix restart on upgrade using $
1 variable. remove previously commented out code
424 * Sat May
16 2009 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
425 - comment out latex build
426 * Fri May
15 2009 Adam Kropelin
<akropel1 at rochester.rr.com
>
427 - changes
for new user manual location and format
428 * Sat May
31 2008 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
429 - add check
for upgrade and restart daemon
430 * Sun May
11 2008 Adam Kropelin
<akropel1 at rochester.rr.com
>
432 * Sun Feb
03 2008 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
433 - add debug package to strip suse
434 * Sat Nov
17 2007 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
435 - add hal policy file
436 * Sat Nov
10 2007 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
437 - SuSE
10.3 replaces tetex with texlive
-latex package
438 * Sun May
27 2007 Adam Kropelin
<akropel1 at rochester.rr.com
>
439 - add support
for rhel5
440 * Sun Jan
28 2007 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
441 - remove
/etc
/apcupsd
/masterconnect and mastertimeout files
442 * Sat Jan
27 2007 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
444 - fix location of
Requires for base package
445 * Sun Jan
21 2007 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
446 - correct gapcmon dependancies
447 * Sat Jan
20 2007 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
448 - restructure
for 3.14 release
449 - merge std and ups packages
450 - remove
--enable-pthreads and
--enable-master
-slave
452 - break out multimon into separate package
453 - add gapcmon package
454 * Sat Aug
19 2006 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
455 - add third party packager tag
456 * Fri May
05 2006 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
457 - update build requirments to include ghostscript
458 - update fedora_core build requirements to include latex2html
459 * Sun Apr
23 2006 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
460 - add pdf manual to doc package
461 - remove redundant code
for std and usb packages
463 * Sat Apr
22 2006 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
464 - clean up build defines
, add rhel4
465 * Sat Jan
21 2006 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
466 - release
3.12.2 update docs
467 * Sun Sep
18 2005 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
468 - Change deprecated
Copyright tag to
License
469 * Tue Jun
07 2005 Adam Kropelin
<akropel1@rochester.rr.com
>
470 - Rename mainsback.
in to offbattery.
in so default power loss
/return actions
472 * Sat Apr
30 2005 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
473 - fix typo
in rh7 dependencies
474 * Sat Mar
12 2005 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
475 - clean up halt insertion code
, add check
for whitebox
-release
476 - remove cruft that has been commented out
for a long
time
477 - add pwrfaildir as variable
478 - correct SuSE initdir
479 - add libjpeg libpng zlib freetype dependencies
for RH7
480 * Sun Nov
28 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
481 - correct awk insertion
in halt script
for SuSE
482 * Fri Nov
05 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
483 - change Mandrake logic
in preun and post scriptlets to
if;then;fi
484 * Sun Oct
31 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
485 - add Mandrake support
486 * Wed Aug
04 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
487 - changed location of apcupsd.css to
/etc
/apcupsd from
/etc
/apcupsd
/cgi
488 - corrected typo introduced
in SuSE configuration
for initdir definition
489 * Sun Apr
25 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
490 - add SuSE configuration
491 * Sat Apr
24 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
492 - tidy up doc includes
, add release notes
493 * Mon Mar
08 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
494 - added additional clean of buildroot to beginning of
install section
495 - corrected post
install routines
for nicer chkconfig
496 * Sat Jan
17 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
497 - added build of net driver to configure
498 - moved usb driver build into both packages
499 - set --with
-serial
-dev
= to blank so will find any device and removed rh7 patch
500 * Sat Jan
10 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
501 - added build tags
for rh8 rh9 fedora_core and wb3
502 - cleaned up dependancies and
Requires by platform
503 * Thu Jan
1 2004 D. Scott Barninger
<barninger at fairfieldcomputers.com
>
504 - removed rh_version from package names
505 - added platform build configuration section to beginning of file
506 * Sat Nov
08 2003 Scott at fairfieldcomputers dot com
507 - expanded usb devices from
0-9 to
0-15
508 * Fri Nov
07 2003 Scott at fairfieldcomputers dot com
509 - corrected device path
for usb devices to
/dev
/usb and added patch
for
510 - rh7 builds to
make it
/dev
/usb
/hid
in /etc
/apcupsd
/apcupsd.conf
511 * Sat Oct
18 2003 Scott at fairfieldcomputers dot com
512 - added master
-slave
, apcsmart and dumb to configure options
513 * Sun Sep
14 2003 Scott at fairfieldcomputers dot com
514 - added
rm commands during
install to remove halt scripts created
516 * Mon May
11 2003 Scott at fairfieldcomputers dot com
517 - combined layout
for usb
/serial builds
518 * Thu Jan
16 2003 Scott at fairfieldcomputers dot com
519 - Update spec to new
source layout
520 - Added masterconnect and mastertimout to files section
521 - Changed
make install-apcupsd and
make install-cgi to
make install
522 * Wed Sep
05 2001 kern at sibbald dot com
523 - Applied very nice patch to this spec by Giulio Orsero
<giulioo@pobox.com
>
524 * Thu Sep
14 2000 kern at sibbald dot com
525 - Many thanks to Fredrik Persson and Neil Darlow
for helping me write this spec file.
526 - Basic spec by Kern Sibbald