October 19, 2006

Updating Slackware using Swaret

Author: Joel Nahrgang

Now that Slackware 11.0 is out, you may wonder what is the best way to update the distribution. Swaret is an open source project that aims to keep various versions of Slackware up-to-date. I use Swaret and some cron scripts to keep my servers current automatically.

Download the stable version (1.6.2, from October 2004) or the development version of Swaret and rename the downloaded file so that you can install it using installpkg:

$ cp swaret-1.6.2-noarch-1.tgz.tar swaret-1.6.2-noarch-1.tgz

From there you need to become superuser or log in as root to install the software using the installpkg command:

# installpkg swaret-1.6.2-noarch-1.tgz

Rename the conf file located in the /etc folder:

# cp /etc/swaret.conf.new /etc/swaret.conf

Next, set the version of Slackware you wish to keep on your computer. You can set it to 11.0 or current. Current is the most up-to-date version, and it may be unstable and could pose problems, but it should be easier to upgrade to the next version when it rolls out. I keep some servers on current and others, the ones I consider critical, on 11.0:

# swaret --set VERSION=11.0

Now you can update the list of packages Swaret uses:

# swaret --update

When that command completes successfully you can run the upgrades. You can use the -a switch to automatically install all new updates without being prompted, or use no switch to be prompted for each package update:

# swaret --upgrade

Since version 11.0 has just come out there won't be many updates right away, so don't expect much at first.

You can also use Swaret to install programs that were not installed originally by using this command (replace package-name with the actual name of the package):

# swaret --install package-name

Here is a simple script you can place in one of your cron folders to run Swaret on a regular schedule:

#!/bin/bash
#
#swaret-update.sh
#
# this will download the update files needed to upgrade
#
swaret --update
#
#
# this will update all the packages automatically
#
swaret --upgrade -a
#
# send an email notifying that the update was complete
#
echo "The updates were completed" | mail -s "Swaret Update" username
#
#eof

I have this script in my weekly cron folder under /etc/cron.weekly. Be aware that this will install all the update packages automatically, whether you want them or not.

Click Here!