views:

268

answers:

2

I'm in the process of creating a Ubuntu Installer and I need to register my own file extension I cant find any examples of how to do this.

Could people provide me with some script snippets on how to do this?

NB: Im using InstallJammer to help me create the installer, which allows me to call external scripts - so that is why a script would be beneficial.

+3  A: 

The recommended way is to write an ubuntu package, for example with CDBS (overview, docs, examples, bonus non-cdbs tutorial).

Then you add $PACKAGE.sharedmimeinfo and $APPNAME.desktop files in the debian/ directory. The sharedmimeinfo file describes the file type, the desktop file describes your app. The latter should contain a MimeType=application/x-$APPNAME; that matches the filetype.

Tobu
this might help also: http://standards.freedesktop.org/desktop-entry-spec/latest/
jldupont
+2  A: 

An InstallJammer installer won't integrate very well with the distribution, but here goes.

Use xdg-mime install and xdg-mime default to set up the mimetype and associate it.

Tobu
Thanks Ill have alook. When you say its wont integrate well with the distribution, what do you mean?
Dan
Debian packages can get installed, removed, upgraded (including conffile updates), and in general reliably managed. They have their files and documentation in certain expected places. Your installer is a one-off and it won't be as well supported or as convenient to administer.
Tobu