LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Blogs > The Slacker's Blog
User Name
Password

Notices

This is a semi-random collection of posts on nearly all things Slackware and Linux-related -- at least as I see it.
Rate this Entry

A Script for Keeping Slackware Up-to-date...

Posted 02-04-2010 at 08:38 AM by Lufbery
Updated 04-14-2010 at 11:40 AM by Lufbery

My last blog post explained how to use lftp to maintain a local mirror to keep Slackware -stable up-to-date. The next logical step is to write a script to do that.

I started a thread on LQ seeking feedback on the method and the script and the result was a wonderful discussion with a useful script at the end.

Be sure to check out H_TeXMeX_H's alternative script in the same thread. He took my original idea and did something pretty cool with it.

Here's the script:

It has MD5 checking, and in my tests so far, it works well. I created an error by adding some text to one of the packages text files and the script exits correctly on the failed MD5 check.

I've also added GPG signature checking for the individual packages based on code posted by GazL in the thread above. Naturally, this requires: having one's own GPG key, importing the proper Slackware GPG key, and signing the Slackware key with one's own.

Code:
#!/bin/bash
#update_slackware.sh
#Note: run this script as root from the local ./patches directory.

#Synchronize the local mirror with the remote mirror:
lftp -c "open slackware.mirrors.tds.net/pub/slackware/slackware64-13.0/patches/ ; mirror -e -n packages"

#Download the most recent CHECKSUMS.md5 file:
rm -f CHECKSUMS.md5
lftp -c "open slackware.mirrors.tds.net/pub/slackware/slackware64-13.0/patches/ ; get CHECKSUMS.md5"

#Check for MD5 checksum errors and exit if some are found.
if grep "\./packages/" CHECKSUMS.md5 | md5sum -c | grep -v OK$
   then echo "Script aborting. Try manually downloading the file(s) listed above"
   exit 1
fi

echo "No errors found; checking package signatures and updating packages."

#Check GPG signatures and upgrade Slackware with downloaded packages:
cd packages
for package in *.t?z.asc
do
  if gpg --verify "$package"
  then
    upgradepkg ${package%.asc}
  else
    echo "ERROR:  ${package%.asc} doesn't match signature file. Skipped!" 1>&2
  fi
done

#Find configuration files that need attention:
echo "Checking for new configuration files:"
find /etc -name "*.new"
Posted in Uncategorized
Views 1411 Comments 2
« Prev     Main     Next »
Total Comments 2

Comments

  1. Old Comment
    The general catch of Slackware, IMO is that you actually free to update whenever you want. And since that, I guess most users won't need that if they doing this manually.
    But that looks nice though i didn't test it Thanks!
    Posted 02-04-2010 at 09:40 AM by Web31337 Web31337 is offline
  2. Old Comment
    Quote:
    Originally Posted by Web31337 View Comment
    The general catch of Slackware, IMO is that you actually free to update whenever you want. And since that, I guess most users won't need that if they doing this manually.
    But that looks nice though i didn't test it Thanks!
    True enough. However, the updates often have more than one package, and this script saves a bunch of time downloading each package, checking their integrity, and upgrading with them.

    Thanks for looking!

    -Drew
    Posted 02-04-2010 at 12:06 PM by Lufbery Lufbery is offline
 

  



All times are GMT -5. The time now is 10:28 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration