<chapter><title> Apcupsd -- RPM Packaging FAQ</title> <sect1><title>Answers</title> <variablelist> <varlistentry> <term><b>How do I build Apcupsd for platform xxx?</b></term> <listitem> <para> The apcupsd spec file contains defines to build for several platforms: RedHat 7.x (rh7), RedHat 8.0 (rh8), RedHat 9 (rh9), Fedora Core 1 (fc1), and Whitebox Enterprise Linux 3.0 (wb3). 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 </para> <programlisting> %define rh7 0</programlisting> <para>and edit it to read </para> <programlisting> %define rh7 1</programlisting> <para>Alternately you may pass the define on the command line when calling rpmbuild: </para> <programlisting> rpmbuild -ba --define "build_rh7 1" apcupsd.spec rpmbuild --rebuild --define build_rh7 1" apcupsd-x.x.x-x.src.rpm</programlisting> </listitem> </varlistentry> <varlistentry> <term><b>How do I control whether usb support gets built?</b></term> <listitem> <para> By default standard serial port support will be built and the apcupsd-std package will be produced. To get the usb package and support either set the <programlisting> %define usb 0</programlisting> to <programlisting> %define usb 1</programlisting> in the spec file directly or pass it to rpmbuild on the command line: <programlisting> rpmbuild -ba --define "build_rh7 1" --define "build_usb 1" apcupsd.spec</programlisting> </para> </listitem> </varlistentry> <varlistentry> <term><b>other defines are used?</b></term> <listitem> <para> The only other define is for the initdir for the daemon control script. On RedHat systems this is set to /etc/rc.d/init.d/. You would only need to edit this if packaging for a platform with uses a different directory. </para> </listitem> </varlistentry> <varlistentry> <term><b>I'm getting errors about not having permission when I try to build the packages. Do I need to be root?</b></term> <listitem> <para> No, you do not need to be root and, in fact, it is better practice to build rpm packages as a non-root user. Bacula 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 the following command as root: <programlisting> chmod -R 777 /usr/src/redhat</programlisting> 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 directory tree with all of it's subdirectories inside your home directory. Then create a file named <programlisting> .rpmmacros</programlisting> in your home directory (or edit the file if it already exists) and add the following line: <programlisting> %_topdir /home/myuser/redhat</programlisting> </para> </listitem> </varlistentry> </variablelist> </sect1> </chapter>