12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

144CHAPTER 5Working with RPM Softwareand the spec file in it, and using the following command to create the compressed archivefile whose filename also includes the package name and version number:tar czvf -.tar.gz -In our example, the command would betar czvf startvpn-1.1.tar.gz startvpn-1.1Notice that the startvpn-1.1/ directory is retained for the files in the tarball. When thetarball is uncompressed and unarchived, this directory must be created. To test the tarball,execute the tar tzvf startvpn-1.1.tar.gz command. You should see the following:startvpn-1.1/startvpn-1.1/startvpnstartvpn-1.1/startvpn.specstartvpn-1.1/MakefileBuilding the PackageNow that the spec file has been created, the Makefile has been written, and the sourcefiles have been archived and compressed into a source tarball, it is time to build thesource RPM (also referred to as the SRPM) and the RPM used to install the software.The rpmbuild command is used to actually build the SRPM and RPM files. It is providedby the rpm-build package, so make sure the rpm-build package is installed. Notice thatthe Makefile in our example from Listing 5.10 includes srpm and rpm targets that executethe rpmbuild command for building the SRPM and RPM for our package. So, to build theSRPM file, make sure you are in the directory that contains the Makefile, the spec file, andthe source tarball you just created, and execute the make srpm command. Listing 5.11shows the output when building the SRPM, assuming the user building the package istfox. If you are using the .rpmmacros file from Listing 5.7, the SRPM file will be saved tothe /home//SRPMS/ directory.LISTING 5.11Building the SRPMWrote: /home/tfox/RPMBUILD/SRPMS/startvpn-1.1-1.src.rpmTo build the RPM used to install the software, execute the make rpm command. The RPMwill be saved in the /home//RPMS/ directory, where is the architecturespecified by the BuildArch parameter in the spec file. In our example, the is noarch. Listing 5.12 shows the output while building the RPM, assuming the user buildingthe package is tfox.LISTING 5.12Building the RPMExecuting(%prep): /bin/sh -e /var/tmp/rpm-tmp.38985+ umask 022

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!