This just covers the rpm specification and its format. See http://vipe.technion.ac.il/~shlomif/lecture/Autotools/slides/issues/rpm-spec.html elaboration.
More good links to peruse...
To install a package:
russ@taliesin:~> rpm -ivh package-path
To upgrade an existing package:
russ@taliesin:~> rpm -Uvh package-path
Get the package-name via inspection (see “Inquiring about a package’ below). To remove (uninstall) a package:
russ@taliesin:~> rpm -e package-name
Presently loaded?
russ@taliesin:~> rpm -qa | grep vas libgnomecanvas-2.12.0-2 vasyp-3.1.0-19 vasclnts-3.1.0-19 kdebindings3-javascript-3.4.2-8 libgnomecanvas-doc-2.12.0-2 libgnomecanvas-devel-2.12.0-2 vasproxy-3.1.0-19 vasgps-3.1.0-19
Can a package be unloaded? Try it with option -e (as expected) accompanied by --test.
russ@taliesin:~> rpm -e --test vasclnts-3.1.0-19 error: Failed dependencies: libvas.so.4 is needed by (installed) vasgps-3.1.0-19 libvas.so.4 is needed by (installed) vasyp-3.1.0-19 libvas.so.4 is needed by (installed) vasproxy-3.1.0-19
Package-query options are preceded/accompanied by option -q.
--provides: package(s) provide(s) vasclnts-3.1.0-19? Some of what is in parentheses constitutes “capabilities” for the --whatrequires and whatprovides options, but not all.
russ@taliesin:> rpm -q --provides vasclnts-3.1.0-19 libgcc_s.so.1 libgcc_s.so.1(GCC_3.0) libgcc_s.so.1(GLIBC_2.0) libgcc_s.so.1(libgcc_s.so.1) libnss_vas3.so.2 libstdc++.so.5 libstdc++.so.5(CXXABI_1.2) libstdc++.so.5(GLIBCPP_3.2) libstdc++.so.5(GLIBCPP_3.2.1) libstdc++.so.5(GLIBCPP_3.2.2) libstdc++.so.5(libstdc++.so.5) libvas-gssapi.so.2 libvas.so.4 pam_vas3.so vasclnts = 3.1.0-19
--requires: lists packages on which vasclnts-3.1.0-19 depends...
russ@taliesin:~> rpm -q --requires vasclnts-3.1.0-19 pam >= 0.66-5 /bin/sh /bin/sh ld-linux.so.2 libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.1.2) libc.so.6(GLIBC_2.1.3) libc.so.6(GLIBC_2.2) libc.so.6(GLIBC_2.2.3) libc.so.6(GLIBC_2.2.4) libcrypt.so.1 libcrypt.so.1(GLIBC_2.0) libdl.so.2 libdl.so.2(GLIBC_2.0) libdl.so.2(GLIBC_2.1) libgcc_s.so.1 libgcc_s.so.1(GCC_3.0) libm.so.6 libncurses.so.5 libpam.so.0 libresolv.so.2 libresolv.so.2(GLIBC_2.2) libstdc++.so.5 libstdc++.so.5(CXXABI_1.2) libstdc++.so.5(GLIBCPP_3.2) libvas.so.4
These next two are a joke outside a given shop’s own packages. “Capabilities” are something a package can make up to say it supports. So, unless you know the name of a capability, this is useless.
--whatprovides: package provides some capability...
russ@taliesin:> rpm -q --whatprovides crapola no package provides crapola
--whatrequires: package require some capability...
russ@taliesin:> rpm -q --whatrequires crapola no package requires crapola
Nevertheless, on my SuSE Linux box, some of what is in parentheses up above are capabilities including libgcc_s.so.1 and libstdc++.so.5.
Get a list of everything in the package including version information, paths, files, etc. This is for the VAS site-license client. (Some slight reformatting here including wrapping.)
russ@taliesin:~> rpm -qil vasclnts-3.1.0-19 Name : vasclnts Relocations : (not relocatable) Version : 3.1.0 Vendor : Quest Software, Inc. Release : 19 Build Date : Wed 13 Sep 2006 02:30:17 PM MDT Install date: Thu 14 Sep 2006 10:16:04 AM MDT Build Host : vassuse81.vintela.com Group : System Environment/Applications Source RPM : vas-3.1.0-19.src.rpm Size : 6610630 License : Commercial Signature : (none) URL : http://www.quest.com Summary : The VAS client components (site licensed) Description : The client components of VAS: vasd, nss_vas, pam_vas, and vastool. This version of the vasclnt package does not require a license. Distribution: (none) /etc/init.d/vasd /etc/opt /etc/opt/quest /etc/opt/quest/vas /etc/opt/quest/vas/.licenses /etc/opt/quest/vas/access.d /etc/opt/quest/vas/group-override.sample /etc/opt/quest/vas/user-override.sample /etc/opt/quest/vas/users.allow.sample /etc/opt/quest/vas/users.deny.sample /etc/opt/quest/vas/vas.conf /opt/quest /opt/quest/bin /opt/quest/bin/.uptool-site /opt/quest/bin/.vastool-site /opt/quest/bin/klist /opt/quest/bin/ktutil /opt/quest/lib /opt/quest/lib/libvas-gssapi.so /opt/quest/lib/libvas-gssapi.so.2 /opt/quest/lib/libvas-gssapi.so.2.0.0 /opt/quest/lib/libvas.so.4 /opt/quest/lib/libvas.so.4.2.0 /opt/quest/lib/nss /opt/quest/lib/nss/libnss_vas3.so.2 /opt/quest/lib/security /opt/quest/lib/security/pam_vas3.so /opt/quest/lib/support /opt/quest/lib/support/libgcc_s.so.1 /opt/quest/lib/support/libstdc++.so.5 /opt/quest/lib/support/libstdc++.so.5.0.2 /opt/quest/libexec /opt/quest/libexec/vas /opt/quest/libexec/vas/homedir-create.sh /opt/quest/libexec/vas/manconfig-environment.sh /opt/quest/libexec/vas/manconfig-man.sh /opt/quest/libexec/vas/manconfig-man_config.sh /opt/quest/libexec/vas/manconfig-manpath.sh /opt/quest/libexec/vas/manconfig-manpath_config.sh /opt/quest/libexec/vas/scripts /opt/quest/libexec/vas/scripts/deleted_check.sh /opt/quest/libexec/vas/scripts/vas_snapshot.sh /opt/quest/libexec/vas/scripts/vasjoin.sh /opt/quest/libexec/vas/sqlite3 /opt/quest/libexec/vas/uptool /opt/quest/libexec/vas/uptool/gecos_fullname /opt/quest/libexec/vas/uptool/grnam_PARAM_cn /opt/quest/libexec/vas/uptool/grnam_PARAM_samacc /opt/quest/libexec/vas/uptool/grnam_cn /opt/quest/libexec/vas/uptool/grnam_samacc /opt/quest/libexec/vas/uptool/pwnam_cn /opt/quest/libexec/vas/uptool/pwnam_samacc /opt/quest/libexec/vas/uptool/pwnam_upnpre /opt/quest/libexec/vas/vasd /opt/quest/libexec/vas/vasd/delusercheck /opt/quest/libexec/vas/vasd/vas_muupd /opt/quest/libexec/vas/vasd/vas_ovrdupd /opt/quest/libexec/vas/vasd/vasac_helper /opt/quest/libexec/vas/vasd/vasdis_helper /opt/quest/man /opt/quest/man/man1 /opt/quest/man/man1/uptool.1 /opt/quest/man/man1/vasd.1 /opt/quest/man/man1/vastool.1 /opt/quest/man/man5 /opt/quest/man/man5/nss_vas.5 /opt/quest/man/man5/pam_vas.5 /opt/quest/man/man5/vas.conf.5 /opt/quest/sbin /opt/quest/sbin/.vasd-site
In some package scripts such as the post-install, the passed argument contains “the number of packages we’re dealing with.” In other words, 1 if we’re only dealing with the package to install afresh, 2 if both a new and an old (existing) package.
This fact can be useful in writing such a script, for example, in knowing whether or not to restart a dæmon. Below are the first few lines to put in this script which is also used for Debian/Ubuntu packaging:
case "$1" in configure|upgrade) # Debian-only if [ -f /tmp/vasclnt_upgrade ]; then pkg_count=2 else pkg_count=1 fi ;; remove) # Debian-only, but should not occur here: pkg_count=0 # this is only to keep the script from bombing ;; *) # rpm only passes an integer value pkg_count=$1 # Linux (rpm) passes an integer 1 or 2 ;; esac
To generate an rpm specification, include a template as package-name.spec.in in the main project (package) directory. The template is identical to any rpm specification except that the version field should contain @VERSION@ so that when built, it gets changed appropriately.
Add package-name.spec to the AC_OUTPUT macro in configure.in and both package-name.spec and package-name.spec.in to the EXTRA_DIST macro in Makefile.am.
At this point, the following command may be issued:
# rpm -tb package-name.spec
For Debian/Ubuntu, see documentation at http://www.opensourcemanuals.org/manual/dpkg. These are the commands we’re going to use in an installation script...
Install:
dpkg -i package-file.deb
Uninstall (remove):
dpkg -r package-name
Update:
dpkg -A package-file.deb
Information/ontology (search):
dpkg -C
List information (less than clearly indicated in the man page):
dpkg -l package-name