Documentation formats and speaker interviews

In lieu of actual content on this blog, allow me to introduce you to some recent posts I’ve done for Opensource.com:

Upgrading to Fedora 14 with yum

Fedora 14 was released two weeks ago.  I normally wait a day or two to install to let the mirrors cool down, but that put the target date right before I left for the LISA conference.  Like any good sysadmin, I’m sufficiently paranoid to not upgrade systems right before I leave, even if said system is only my own desktop.  So now that I’m back, I decided today was a good day to upgrade my home desktop.

As in the past, the recommended method was not for me — I opted to go with the Yum-based upgrade.  For Fedora 14, there’s a new feature that significantly reduces the amount of effort involved in live upgrades.  Using the –releasever argument and distro-sync command, it’s now possible to upgrade without having to manually install the updated version RPMs.  As Chris Siebenmann wrote, it can also be used to downgrade components.

I started the process doing what the instructions said, but as always it didn’t go quite perfectly.  After a little while, I noticed that yum was in an infinite loop of upgrades.

--> Running transaction check
--> Processing Dependency: texlive = 2007-51.fc13 for package: texlive-utils-2007-51.fc13.x86_64
--> Processing Dependency: texlive-dvips = 2007-51.fc13 for package: texlive-utils-2007-51.fc13.x86_6
---> Package xorg-x11-drv-nvidia.x86_64 1:260.19.12-1.fc13 set to be erased
---> Package xorg-x11-drv-nvidia-libs.x86_64 1:260.19.12-1.fc13 set to be erased
--> Processing Dependency: /usr/bin/dvips for package: openoffice.org-ooolatex-4.0.0-0.7.beta2.fc12.1.noarch
--> Processing Dependency: /usr/bin/texconfig-sys for package: linuxdoc-tools-0.9.66-5.fc13.x86_64
--> Finished Dependency Resolution

I noticed that it seemed to be related to either the nvidia drivers or the LaTeX package, so I opted to remove the drivers first:

yum remove xorg-x11-drv-nvidia

That made the loop a bit shorter, but it didn’t quite fix it, so I removed the LaTeX package:

yum remove `rpm -q --whatprovides /usr/bin/latex`

Then yum reported there were a few broken packages it couldn’t fix, so I removed them, too:

yum remove VirtualBox-3.1 perl-MythTV system-config-display python-MythTV

Finally, the upgrade was on its way.  When it finished and grub was installed, I rebooted into a nice, shiny Fedora 14 install.  (Note: to re-install VirtualBox, you’ll need to install the VirtualBox-3.2 package.)

The hard way to print an EPS

Last week, I got an interesting ticket from one of the professors in my department.  An EPS file that she had would not print before I stood up our new print server.  After the new server was set up (eat that, Solaris!) the file would print, but the image was not properly centered on the page, causing much of it to be lost in printing.  My first thought was “oh, I’ll just use the page-left and page-top options to lpr to adjust the margins until it worked”.  Oddly enough, it didn’t shift the image at all.  I checked the image with the Evince document viewer.  Everything looked okay there, so I tried printing from Evince.  No dice.

Fortunately, at the same time I was banging my head against this I was also working on another problem for the same professor.  She had a TeX file that wasn’t properly displaying the EPS files embedded in it.  So once I got that working (the simple solution was to upgrade to RHEL 5), I got a brilliant idea: what if I created a TeX file with the EPS as the only content.

The only difficulty is that I don’t know how to use TeX.  Fortunately, I found Andrew Bennieston’s book Writing Scientific Documents Using LaTeX.  After a few minutes of tinkering, I was able to print the EPS image in the correct size and placement.  Of course, that doesn’t fix the root cause, which still bothers me, but at least there’s a suitable workaround.  I was able to write a Bash script that automates the process into a single command to make life easier on the users.  I document it here because there might be somebody else who is having problems printing EPS files, and because if I post it on my blog someone will come along and tell me all of the ways I could have done it better.

#!/bin/bash

##########
#
# lpreps
#
#   A script to wrap EPS file in TeX so they'll print correctly
#
#
#  Usage: lpreps filename
#       (If you want to change the default behavior of lpr, use
#         the PRINTER and LPOPTIONS environment variables.)
#
##########

# Check to make sure we were called correctly
if [ $# -ne 1 ]; then
  echo Usage: lpreps filename
  echo "(If you want to change the default behavior of lpr, use"
  echo "  the PRINTER and LPOPTIONS environment variables.)"
  exit 1
fi

# Check to make sure the file we want to print exists
if [ ! -f $1 ]; then
  echo "File $1 not found"
  exit 2
fi

#
# Find the commands we need
#
if [ -f /usr/bin/latex ]; then
  latex='/usr/bin/latex'
else
  # Take a wild guess, I suppose
  latex=`which latex`
fi

if [ -f /usr/bin/dvips ]; then
  dvips='/usr/bin/dvips'
else
  # Take a wild guess, I suppose
  dvips=`which dvips`
fi

cat >lpreps-$$.tex <<EOF
\documentclass[12pt]{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\centering
\includegraphics[scale=0.95]{$1}
\end{figure}

\end{document}
EOF

$latex lpreps-$$.tex
$dvips lpreps-$$.dvi

# Clean up afer ourselves
rm -v lpreps-$$*

exit 0
# End script