next up previous contents index
Next: Credits Up: Apcupsd User's Guide Previous: APC smart protocol   Contents   Index

Subsections

Apcupsd -- RPM Packaging FAQ


Answers

How do I build Apcupsd for platform xxx?
The apcupsd spec file contains defines to build for several platforms: RedHat 7.x (rh7), RedHat 8.0 (rh8), RedHat 9 (rh9), Fedora Core (fedora_core), RedHat Enterprise Linux and clones (rhel3 and rhel4), SuSE 9 & 10 (suse), and Mandrake (mdk). The package build is controlled by a define set at the beginning of the file. These defines basically just control the dependancy information that gets coded into the finished rpm package. So while you could technically build a package without defining a platform, or with an incorrect platform, and have it install and run it would not contain correct dependancy information for the rpm database. The platform define may be edited in the spec file directly (by default all defines are set to 0 or ``not set''). For example, to build the RedHat 7.x package find the line in the spec file which reads

              %define rh7 0
     

and edit it to read

              %define rh7 1
     

Alternately you may pass the define on the command line when calling rpmbuild:

              rpmbuild -ba --define "build_rh7 1" apcupsd.spec
              rpmbuild --rebuild --define build_rh7 1" apcupsd-x.x.x-x.src.rpm

How do I control whether usb support gets built?
Up through version 3.12, by default standard serial port support was built and the apcupsd-std package was produced. The usb package pre-configured the configuration files for usb devices and installed a couple additional tools in /etc/apcupsd but the usb driver was built regardless. To get the usb package and support in those versions either set the

              %define usb 0
     

to

              %define usb 1
     

in the spec file directly or pass it to rpmbuild on the command line:

              rpmbuild -ba --define "build_rh7 1" --define "build_usb 1" apcupsd.spec

With the release of 3.14 USB support is now considered standard and the apcupsd-std and apcupsd-usb packages are obsoleted in favor of a single apcupsd package configured for usb connected UPS's. The serial port driver is still built and can be configured accordingly after installation. If you are performing an upgrade it will of course not replace your current config file.

The build directive:

              --define "build_usb 1"

is no longer recognized.

What other defines are used?
There is a define for the initdir for the daemon control script. On RedHat or Mandrake systems this is set to /etc/rc.d/init.d/. On SuSE systems this is set to /etc/rc.d. You would only need to edit this if packaging for a platform that uses a different directory.

A second define controls whether the Gnome monitoring application, new in the 3.14 release, is built. This application requires the Gtk2 version to be >= 2.4. If you want to build the apcupsd-gapcmon package add:

              --define "build_gapcmon 1"

A third define controls whether the SNMP driver is built. If you want to build the net-snmp driver add:

              --define "build_snmp 1"

Can I supply packages for other platforms you do not publish?
Yes, there are tools provided for contributors to supply rpm packages for platforms for which support is provided in the spec file but for which the development team chooses not to release binary packages, usually due to lack of interest or lack of an available platform. Please see platforms/contrib/README in the source package.

I'm getting errors about not having permission when
I try to build the packages. Do I need to be root? No, you do not need to be root and, in fact, it is better practice to build rpm packages as a non-root user. Apcupds packages are designed to be built by a regular user but you must make a few changes on your system to do this. If you are building on your own system then the simplest method is to add write permissions for all to the build directory (/usr/src/redhat/). To accomplish this execute one of the following commands as root depending on your distribution, RedHat, SuSE or Mandriva, respectively:

              chmod -R 777 /usr/src/redhat
              chmod -R 777 /usr/src/packages
              chmod -R 777 /usr/src/RPM

If you are working on a shared system where you can not use the method above then you need to recreate the /usr/src/redhat (or other) directory tree with all of it's subdirectories inside your home directory. Then create a file named

              .rpmmacros

in your home directory (or edit the file if it already exists) and add the following line:

              %_topdir /home/myuser/redhat
     


next up previous contents index
Next: Credits Up: Apcupsd User's Guide Previous: APC smart protocol   Contents   Index
2009-03-11