Archive for the ‘Development’ Category

How To: Make McCoy Portable

Wednesday, December 2nd, 2009

I’m in a Firefox extension development phase at the moment, brought on by significant changes at NBA.com. While I’ve been developing, I’ve come across some handy short-cuts for the process. These will make a series of ‘How To’ posts and this is the first – How to make McCoy portable.

McCoyI host my NBA Scoreboard extension at my own site. I’m assuming that you are already familiar with the requirements for hosting an extension at a location other than AMO. However, you may want to look at the article “Extension Versioning, Update and Compatibility” for a refresher.

McCoy is a tool developed by Mozilla for providing secure updates by signing update manifests. It is distributed as a ZIP file for Windows and so I thought that there was a chance that I could run McCoy from my USB stick.

Why McCoy Portable?

I don’t use just one PC. Depending on where I am, I could use any of four or five PCs for development. However, if I can’t take McCoy with me, then I cannot provide updates on the run. The trouble is that McCoy stores its profile information in the %appdata% directory and not the directory that McCoy resides in.

To make McCoy portable, I need to move the profile directory from %APPDATA%\Mozilla\McCoy\Profiles to my local McCoy directory.

Make McCoy Portable

McCoy DirectoryTo make your version of McCoy portable, follow the steps below. Remember, you must have already created a public/private RSA cryptographic key pair for your profile to be valid.

1. Move the McCoy directory (that you unzipped and that contains mccoy.exe) to its own directory on your USB stick.

2. Move your Profiles directory from %APPDATA%\Mozilla\McCoy to the McCoy directory that you have just created on your USB stick. The files should now look like the picture to the right.

3. Now we have to tell McCoy that the profile is in a different location. Look inside the Profiles directory and make note of the profile name. Mine is 8uai2oez.default, and yours will be similar.

4. Create a shortcut in the same directory as mccoy.exe. For the shortcut, we have to tell McCoy the new profile location by using the -profile switch. For example, I write

H:\Firefox\McCoy\mccoy.exe -profile Profiles\8uai2oez.default

In this, H:\ is my USB drive letter, \Firefox\McCoy is the directory that I created in step 1, and Profiles\8uai2oez.default is the directory that I moved in step 2.

5. Save the shortcut and double-click. You’re away. But BE PATIENT. McCoy does take a while to load up on a USB stick.

But there’s a problem

Shortcut PropertiesWhen I plug my USB into different computers, it is assigned different drive letters. Some give it H:\ and others J:\ and others F:\.  So the short cut only works when the drive letter is H. However, there is a nifty solution on the way that works for WinNT, WinXP and Vista. (Read the article at FreewareGenius for more inspiration.)

Edit the properties of the new shortcut. Remember, it must be in the same directory as mccoy.exe. Change the target from

H:\Firefox\McCoy\mccoy.exe -profile Profiles\8uai2oez.default

to

%windir%\system32\cmd.exe “/C start mccoy.exe -profile Profiles\8uai2oez.default”

Now set the ‘Start In:’ property to %cd% and click OK. Double-click – there will be a short flash of the console and then McCoy will load. And it will load on any computer irrespective of the drive letter assigned.