Adding menu entries (and icons) with the package is slightly complicated. Here's how to do so. First of all we'll need to add two files to the DEBIAN folder to tell the system to update the menu after installation and removal of our package.
Create a file named 'postrm' and paste this into it:
Code: Select all
#!/bin/sh
set -e
# Automatically added by dh_installmenu
if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
# End automatically added section
Then create a file with the name 'postinst' with the content:
Code: Select all
#!/bin/sh
set -e
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
update-menus
fi
# End automatically added section
Now we're gonna start adding the .desktop files. Create the folder '/usr/share/applications' in the file system of our package. Then create a file named 'openra.desktop', with the following content:
Code: Select all
[Desktop Entry]
Type=Application
Version=20100907-1
Name=OpenRA - Red Alert
Comment=The OpenRA RTS engine running Red Alert
Icon=openra
Exec=/usr/bin/openra-ra
Terminal=false
Categories=Game;
This should be relative straightforward, we'll get to the "Icon" part later so don't worry about it.
We're also gonna add an almost straight clone of this with the name 'openra-cnc.desktop', this is how it looks like:
Code: Select all
[Desktop Entry]
Type=Application
Version=20100907-1
Name=OpenRA - Command & Conquer
Comment=The OpenRA RTS engine running Command & Conquer
Icon=openra
Exec=/usr/bin/openra-cnc
Terminal=false
Categories=Game;
So we only had to change the name and the command that will be executed.
We're now gonna add the menu entries. Create a folder '/usr/share/menu' under the file system of the package, and add a text file called 'openra', that looks like this:
Code: Select all
?package(openra):needs="X11" section="Games/Simulation" title="OpenRA - Red Alert"\
command="/usr/bin/openra" icon="/usr/share/pixmaps/openra.32.xpm"
Then create another one called 'openra-cnc' for the C&C mod. Yet again, the only difference is the command that's executed and the title:
Code: Select all
?package(openra):needs="X11" section="Games/Simulation" title="OpenRA - Command & Conquer"\
command="/usr/bin/openra-cnc" icon="/usr/share/pixmaps/openra.32.xpm"
Now we only need to do the icons for them. All Unix systems which adhere to the freedesktop.org standard have a "system icon cache" which it collects from multiple folders. The following folders in our package with the following content should be fine:
- /usr/share/pixmaps with a 32x32 XPM file called 'openra.32.xpm' (you can save to XPM with the GIMP)
- /usr/share/icons/hicolor/128x128/apps with a 128x128 PNG file called 'openra.png'
- /usr/share/icons/hicolor/64x64/apps with a 64x64 PNG file called 'openra.png'
- /usr/share/icons/hicolor/48x48/apps with a 48x48 PNG file called 'openra.png'
- /usr/share/icons/hicolor/32x32/apps with a 32x32 PNG file called 'openra.png'
- /usr/share/icons/hicolor/16x16/apps with a 16x16 PNG file called 'openra.png'
And then you're done.