LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 new snag with my updating script ... and a solution!

Posted 04-20-2010 at 02:16 PM by Lufbery
Updated 05-10-2010 at 02:54 PM by Lufbery

The script that I wrote (with a lot of help from the LQ crew) has worked exceptionally well. It is fast (download speed being the limiting factor), secure (it checks md5sums and GPG signatures), and fails in a sane way if something goes wrong.

It requires the user to be logged in as root, and works best when the user:
  1. Has a full installation of Slackware.
  2. Is running the -stable branch of Slackware.
  3. Has a directory set up on the hard drive for a persistent local mirror.
  4. Has a proper GPG personal key and has imported and signed the Slackware Security GPG key.
  5. Has not replaced packages from the default installation of Slackware with ones not maintained by the Slackware team.

The above list describes my installation pretty well. In the three and a half years that I've been running Slackware, starting with Slackware 11 in late 2006, I've only ever run a full installation of the stock -stable branch. I've added packages to Slackware that aren't included, but I've never replaced any until I decided to use the updated KDE 4.3.1 packages from Vincent Batts instead of the stock KDE 4.2.4 that comes with Slackware 13.

This last point is important for me because the Slackware developers released a a new patch for the kdebase-workspace-4.2.4 package today. So if I just run my script, I'll end up (most likely) breaking KDE! That's not a good thing.

The simple solution is to modify the lftp command in the script to exclude KDE patches, like so:

Code:
lftp -c "open slackware.mirrors.tds.net/pub/slackware/slackware64-13.0/patches/ ; mirror -e -n -X kde* packages"
One caveat: I need to test that command to make sure it does what I want it to do,

EDIT: I did, in fact, test the code and it worked, but then the script exited because it the MD5sum failed due to the missing packages. I needed to comment out the MD5sum checking of my script to complete the update.

The larger issue, though, is the fact that so much of this script is hard-coded. The mirror location is hard coded, and with it, the Slackware version. Now I'm going to hard-code the blacklist. When I upgrade to the next version of Slackware, I'll need to update the script with new values.

Personally, I'm not bothered by this state of affairs. This is, after all, a script and not a true application (like slackpkg ). To make this script more generally useful, I would need to set up variables for the mirror, Slackware version, and blacklist -- all passed to the lftp line of the script. The variables would probably need to be stored in an update_slackware.conf file that I would update from time to time, when needed.

Right now, there's two things stopping me from making the script more general:
  1. I'm not sure how to pass variables to a command with Bash scripting.
  2. Editing the script is as easy as editing a configuration file.

The first point is interesting because one of the major points of this exercise was to learn more about using Bash scripting to simplify the computer stuff that I do. So I'm probably going to continue hacking on this script as time permits and see if I can learn how to create and pass variables to it.

Mostly, though, my main future goals on this script are to improve the comments add a copyright, give credit to those who helped me and contributed code, better document the use assumptions, and add some disclaimers about causing problems with one's installation if one isn't careful.

I also want to refine the error-checking and provide more useful messages when something fails.
Posted in Uncategorized
Views 828 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 04:48 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration