Logo

Package Management

This article covers two things:

  1. How to utilize the package management tools supplied with Slackware (pkgtool, upgradepkg, installpkg, removepkg)
  2. How to keep your Slackware box current by utilizing "slackpkg" and how to get important security patches

 

pkgtool

Pkgtool is the one used during setup. You can call it any time after setup with the command "pkgtool". Pkgtool provides only basic functions, as a consequence I have no use for it. Its main advantage is the ability to run setup scripts again.

pkgtool

 

upgradepkg

This is the tool I use quite often. I also recommend to use "upgradepkg" to upgrade to a new release. From the help:

Usage: upgradepkg newpackage [newpackage2 ... ]
upgradepkg oldpackage%newpackage [oldpackage2%newpackage2 ... ]

Upgradepkg upgrades a Slackware .tgz package from an older version to a newer one. It does this by INSTALLING the new package onto the system, and then REMOVING any files from the old package that aren't in the new package. If the old and new packages have the same name, a single argument is all that is required. If the packages have different names, supply the name of the old package followed by a percent symbol (%), then the name of the new package. Do not add any extra whitespace between pairs of old/new package names.

 

upgradepkg [ --dry-run ] [ --install-new ] [ --reinstall ] [ --verbose ] newpackagename

 

OPTIONS:

--dry-run

Output a report about which packages would be installed or upgraded but don't actually perform the upgrades.

--install-new

Normally upgradepkg only upgrades packages that are already installed on the system, and will skip any packages that do not already have a version installed. If --install-new is specified, the behavior is modified to install new packages in addition to upgrading existing ones.

--reinstall

Upgradepkg usually skips packages if the exact same package (matching name, version, arch, and build number) is already installed on the system. Use the --reinstall option if you want to upgrade all packages even if the same version is already installed.

--verbose

Show all the gory details of the upgrade.

 

installpkg

Installpkg installs single or multiple *.tgz binary packages.

 

installpkg [ -warn ] [ -root /otherroot ] [ -infobox ] [ -menu ] [ -ask ] [ -priority ADD|REC|OPT|SKP ] [-tagfile /somedir/tagfile ] packagename [ packagename2 ... ]

 

removepkg

From the man page:

Removepkg removes a previously installed Slackware package, while writing a progress report to the standard output. A package may be specified either by the full package name (as you'd see listed in /var/log/packages/), or by the base package name. For example, the package foo-1.0-i386-1.tgz may be removed with any of the following commands:

When deleting files, removepkg will analyze the contents of the other packages installed on your system, and will only delete the files that are unique to the package being removed. Similarly, the installation scripts for all the other packages will be considered when deciding whether or not to delete symbolic links from the package.

Removing a package (as well as installing one) can be a dangerous undertaking. For this reason, there is the -warn option available. When you use this, removepkg will not actually remove any files or links, but will output a detailed report of what it would do if you actually did remove the package. It's suggested that you do this (and maybe pipe the output to less ) before removing packages to make sure you've backed up anything that might be important.

When removing a package, it's original file index will be moved from /var/log/packages to /var/log/removed_packages. Likewise, it's installation script will be moved from /var/log/scripts to /var/log/removed_scripts.

 

removepkg [ -copy ] [ -keep ] [ -preserve ] [ -warn ] packagename

 

slackpkg

Slackpkg is part of the /extra folder. It is an excellent tool I use to watch for certain current software packages, but it can much more. From the descriptive file:

PACKAGE DESCRIPTION:
slackpkg: slackpkg
slackpkg:
slackpkg: Slackpkg is a package manager for Slackware. It can download,
slackpkg: upgrade, install and remove selected packages. With it, you
slackpkg: can search in the Slackware Package database and find which
slackpkg: package has the selected file.
slackpkg:
slackpkg: Slackpkg DOESN'T replace pkgtool. Actually, Slackpkg uses pkgtool
slackpkg: for all install|upgrade|remove functions.
slackpkg:

Slackpkg can install, remove, upgrade, reinstall, download, search for info and even clean your system. From the help:

 

slackpkg help

Pay attention to the "clean-system" switch, which allows you to remove all packages which are not present in the official Slackware set.

 

Configure slackpkg

After you have installed it, you must configure it for the first use. Change to /etc/slackpkg

  1. There is a file called mirrors. Edit it an define just one mirror that is close to you. Be aware that the file is divided into several sections (Releases and the "current" tree), so be sure to do this in the right section
  2. slackpkg.conf is the configuration file. Make yourself familiar with the various options. You can go with the default values, if that's ok for you, but you should always know what it means

 

Watch for certain packages

As I mentioned before, I use slackpkg to watch for certain packages, amongst other things. To do so I modified "slackpkg.conf" slightly:

 

# The lines below will set the download priority.
# Default values: /patches /slackware /extra /pasture /testing
#FIRST=patches
FIRST=slackware
SECOND=extra
#FOURTH=pasture
#FIFTH=testing

 

Furthermore I created a file "monitoring" with all the packages I like to watch:

 

#!/bin/sh
#
# list all packages here to monitor and downlaod with slackpkg
#
cd /etc/slackpkg;/usr/sbin/slackpkg download openssl
cd /etc/slackpkg;/usr/sbin/slackpkg download openssh
cd /etc/slackpkg;/usr/sbin/slackpkg download httpd
cd /etc/slackpkg;/usr/sbin/slackpkg download mozilla-firefox
cd /etc/slackpkg;/usr/sbin/slackpkg download mozilla-thunderbird
cd /etc/slackpkg;/usr/sbin/slackpkg download seamonkey
cd /etc/slackpkg;/usr/sbin/slackpkg download bind
cd /etc/slackpkg;/usr/sbin/slackpkg download iptables
cd /etc/slackpkg;/usr/sbin/slackpkg download mysql
cd /etc/slackpkg;/usr/sbin/slackpkg download php
cd /etc/slackpkg;/usr/sbin/slackpkg download gxine
cd /etc/slackpkg;/usr/sbin/slackpkg download xine-ui
cd /etc/slackpkg;/usr/sbin/slackpkg download xine-lib
cd /etc/slackpkg;/usr/sbin/slackpkg download gkrellm
cd /etc/slackpkg;/usr/sbin/slackpkg download slackpkg
cd /etc/slackpkg;/usr/sbin/slackpkg download slacktrack

 

FIle permissions of "monitoring": 744

I use "crontab" to execute the file each night:

 

# Download selected Slackware-Current packages to /var/tmp/slackpkg-current
55 1 * * * /usr/sbin/slackpkg update
00 2 * * * /etc/slackpkg/monitoring

 

Get security patches

Needless to say that it is important to patch your box. It is such an easy task:

  • Go to Slackware's Homepage and subscribe to the Slackware security mailing list
  • You could use "slackpkg" to get patches. Since I already use it for an other purpose, I use "ncftpget". Create a crontab entry similar to the one below

 

# Download Slackware patches with ncftpget to /var/tmp/slackpkg-current/patches
10 2 * * * /usr/bin/ncftpget mirror.switch.ch /var/tmp/slackpkg-current/patches /mirror/slackware/slackware-12.0/patches/packages/

 

  • Check the mail if there are new packages. If so, install them with "upgradepkg"

 

That's it!