18.2 Package Utilities

There are four main utilities for package management. They perform installation, removal, and upgrades of packages.

18.2.1 pkgtool

pkgtool(8) is a menu-driven program that allows installation and removal of packages. The main menu is shown in Figure 18-1.

Figure 18-1. Pkgtool's main menu.

Installation is offered from the current directory, another directory, or from floppy disks. Simply select the installation method you want and pkgtool will search that location for valid packages to install.

You may also view a list of installed packages, as shown in Figure 18-2.

Figure 18-2. Pkgtool view mode

If you want to remove packages, select the remove option and you will be presented with a checklist of all the installed packages. Flag the ones you want to remove and select OK. pkgtool will remove them.

Some users prefer this utility to the command line utilities. However, it should be noted that the command line utilities offer many more options. Also, the ability to upgrade packages is only offered through the command line utilities.

18.2.2 installpkg

installpkg(8) handles installation of new packages on the system. The syntax is as follows:

# installpkg option package_name

Three options are provided for installpkg. Only one option can be used at a time.

Table 18-1. installpkg Options

Option Effects
-m Performs a makepkg operation on the current directory.
-warn Shows what would happen if you installed the specified package. This is useful for production systems so you can see exactly what would happen before installing something.
-r Recursively install all packages in the current directory and down. The package name can use wildcards, which would be used as the search mask when recursively installing.

If you pass the ROOT environment variable before installpkg, that path will be used for the root directory. This is useful for setting up new drives for your root directory. They will typically be mounted to /mnt or something other than /.

The installed package database entry is stored in /var/log/packages. The entry is really just a plain text file, one for each package. If the package has a postinstallation script, it is written to /var/log/scripts/.

You may specify several packages or use wildcards for the package name. Be advised that installpkg will not tell you if you are overwriting an installed package. It will simply install right on top of the old one. If you want to ensure that old files from the previous package are safely removed, use upgradepkg.

18.2.3 removepkg

removepkg(8) handles removing installed packages from the system. The syntax is as follows:

# removepkg option package_name

Four options are provided for removepkg. Only one option may be used at a time.

Table 18-2. removepkg Options

Option Effects
-copy The package is copied to the preserved packages directory. This creates a tree of the original package without removing it.
-keep Saves temporary files created during the removal. Really only useful for debugging purposes.
-preserve The package is removed, but copied to the preserved packages directory at the same time.
-warn Shows what would happen if you removed the package.

If you pass the ROOT environment variable before removepkg, that path will be used for the root directory. This is useful for setting up new drives for your root directory. They will typically be mounted to /mnt or something other than /.

removepkg looks at the other installed packages and only removes files unique to the package you specify. It will also scan the postinstallation script for the specified package and remove any symbolic links that were created by it.

During the removal process, a status report is displayed. After the removal, the package database entry is moved to /var/log/removed_packages and the postinstallation script is moved to /var/log/removed_scripts.

Just as with installpkg, you can specify several packages or use wildcards for the package name.

18.2.4 upgradepkg

upgradepkg(8) will upgrade an installed Slackware package. The syntax is as follows:

# upgradepkg package_name

or

# upgradepkg old_package_name%new_package_name

upgradepkg works by first installing the new package and then removing the old package so that old files are no longer around on the system. If the upgraded package name has changed, use the percent sign syntax to specify the old package (the one that is installed) and the new package (the one you are upgrading it to).

If you pass the ROOT environment variable before upgradepkg, that path will be used for the root directory. This is useful for setting up new drives for your root directory. They will typically be mounted to /mnt or something other than /.

upgradepkg is not flawless. You should always back up your configuration files. If they get removed or overwritten, you'll want a copy of the originals for any needed repair work.

Just as with installpkg and removepkg, you can specify several packages or use wildcards for the package name.

18.2.5 rpm2tgz/rpm2targz

The Red Hat Package Manager is a popular packaging system available today. Many software distributors are offering their products in RPM format. Since this is not our native format, we do not recommend people rely on them. However, some things are only available as an RPM (even the source).

We provide a program that will convert RPM packages to our native .tgz format. This will allow you to extract the package (perhaps with explodepkg) to a temporary directory and examine its contents.

The rpm2tgz program will create a Slackware package with a .tgz extension, while rpm2targz creates an archive with a .tar.gz extension.