Rss Feed Tweeter button Facebook button Technorati button Reddit button Linkedin button Webonews button Delicious button Digg button Flickr button Stumbleupon button Newsvine button

A Waage Blog

Ruby, Rails, Life

Archive for September, 2009

OpenOffice Headless Mode Installation Word doc to pdf conversion

with 7 comments

How to set up OpenOffice to run in headless mode on Fedora 9

What we wanted was a system set up to convert any OpenOffice document to PDF. Most importantly, we needed to convert Word .doc files to .pdf, but in fact, any OpenOffice file types (.xls, .odt, .txt, .rtf, etc) will work, as long as you install the proper packages / dependencies!

Also important:
We will be starting OpenOffice in headless mode, which means no GUI. This should be started on boot up, and should just run in the background.

You don’t need to install all the OpenOffice packages if you don’t need them. We are mainly concerned with Word docs, so OoWriter is a must. We are running in headless mode, which means we don’t have a GUI to openoffice. So we can leave out a bunch of unnecessary packages.

- Here’s what we have installed:  1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 1:2.4.2-18.3.fc9 installed 0.5-2.fc9 installed

If you need to convert Excel spreadsheets, ppt Powerpoint presentations to pdf, you will need to install the corresponding package (ie.,, etc.)

After you have these packages installed, be sure you have the soffice command. By default it is here:

Next, try to start up the service with this command:

$ /usr/lib64/ -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard &

#Note: the ampersand (&) allows the command to run in background so you get your shell back.
You can specify whichever port you would like. The -nofirststartwizard flag does exactly that.

Next step is to find a script (client) that can interact with this OpenOffice service.
A few options are:
1. dag’s unoconv (Available from yum)
2. PyODConverter – a cool Python script to do conversions
3. Write your own!

We chose to use PyODConverter. It’s simple to use:

$ example.doc example.pdf

Lastly, I mentioned that we want this soffice to start up everytime we reboot.

Simply add the line to your /etc/rc.d/rc.local

# Start up openoffice for fax conversion
$ /usr/lib64/ -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard

And there you have it. Hope that helps somebody. Happy Conversions!

Hint: If you are getting strange unintelligible errors about “URL seems to be an unsupported one”, it may be that you have not installed a necessary openoffice package. That’s how I discovered I needed OoWriter …

Written by Andrew Waage

September 17th, 2009 at 2:30 pm

Migrate an SVN repository to Git While Maintaining Branches and Tags Structure

with 3 comments

Git is awesome, but for our Rails projects, we like to follow a similar “centralized repository model” that SVN makes use of.
We want to use distributed Git repositories, with one central “shared” repository to use for deployments, etc.
We don’t want to use Git with a shared SVN repository. (git-svn)
And, we have a bunch of SVN repositories already that we need to migrate to Git repositories.

I’ll describe what I did to make this happen:

Notes, quotes, credits all from:

This is a great post to follow, and accounts for most everything I did here.
The difference is that I’m using svn2git, instead of doing manual git clone commands.
The above post will only set up remote branches, and what I wanted was to have all branches and tags local to my new Git repository.
Svn2git will copy all of your branches / tags from the original SVN repository into your new Git repository as well.
(Check it out here [thanks to nirvdrum]:

Let’s say I have an SVN repository structured as:


Our goal is to have a git repository with native tags/branches taken from our SVN repository.
At the end of my migration, I want my Git repo to look like:

$ git branch
* master
$ git tag -l

#Make sure Git is installed:
#If you don’t have the epel yum repository enabled by default, you must specify to enable it at the command line:
#For other distributions, you know the drill (apt-get, port, etc.)

yum --enablerepo epel install 'git'
yum --enablerepo epel install 'git-svn'

#Now, create a system git user and group

sudo adduser git

#Now edit /etc/group, and add any users who’ll need to access the Git repository to the git group:


#Make a directory for Git repositories
#We chose: /usr/local/git_root

sudo mkdir /usr/local/git_root
sudo chown git.git /usr/local/git_root
sudo chmod 2770 /usr/local/git_root

#Create your svn-authors.txt in /usr/local/git_root/svn-authors.txt to tell Git how to convert SVN usernames in the logs:
#Place *ALL* SVN authors in this file so that git doesn’t complain when it cannot find a particular user to convert.

pbunyan = Paul Bunyan <>
jbond = James Bond <>

On the left are the Subversion user names; on the right are the Git equivalents.

#Make sure your gem sources include (if necessary)

sudo gem sources -a

#Install the svn2git gem

sudo gem install nirvdrum-svn2git

#Verify that you have svn2git in your PATH

which svn2git

#We will create a temporary directory in /tmp/
#This is where we will fetch the SVN repo into a git repo.
#We’ll then use this temporary repo to create our bare repository.

mkdir /tmp/foo-project
cd /tmp/foo-project

#I’m assuming you have the standard SVN setup of


If not, you can look into the options of svn2git to match your SVN repo structure.

#Run the command given your svn-authors file:

svn2git https://svn-repo/foo-project --authors /usr/local/git_root/svn-authors.txt

#You can go into this folder and verify that you see all your local branches and tags by running:

git branch
git tag -l

This should print out the lists of your branches and tags if everything is working right so far!

Next, we want to create our bare repository in /usr/local/git_root.

#Become git user and set permissions

sudo su - git
cd /usr/local/git_root/
umask 007

#Clone the temporary repository created by svn2git to a bare repository.
#<project>.git is a local convention.

git clone --bare /tmp/foo-project foo-project.git
cd foo-project.git/

#Make sure permissions are set properly

git config core.sharedrepository 1
git config receive.denyNonFastforwards true
find objects -type d -exec chmod 02770 {} \;

The core.sharedrepository flag tells git to keep everything group readable and writable.
The receive.denyNonFastforwards flag makes sure that merges can’t happen when you push to the repo. You have to do the merges on your local machine, and then push the result.

#Try to do a git clone from your workstation (another computer)

git clone ssh://git-repo:22/usr/local/git_root/foo-project.git

#Clean up
Once you’re happy that everything is working, delete the temporary repo that you created in /tmp, and you’re done!

Written by Andrew Waage

September 3rd, 2009 at 6:02 pm

Posted in Git and SVN

Tagged with , , , , , ,