2

I have made a game and I want to make debian installer for Ubuntu. Could you reccomend me app, that allows me to make directory and save my game data in it, than packs it in .deb. Most important, so after install, it adds shortcut in Unity dash and side bar. Please, reccomend me a good, free software to make this.

  • 1
    If you never made a .deb file before, this is an easy start: http://ubuntuforums.org/showthread.php?t=910717 t. A .desktop file, you will have to make yourself (tons of posts about that here) and include in the directory to install. – Jacob Vlijm Dec 31 '14 at 22:14
  • OK! It looks hopeful, when I get my own computer. But does that package install shortcut in Dash and does where does it builid .deb file? – Adrians Netlis Dec 31 '14 at 22:30
  • The .deb is created in the same directory as your "scaled" directory. The .desktop file, you should store in /usr/share/applications (inside your scaled directory). That will make the application available in Dash. The principle of a debian package is that it is a scaled version of your system, "projected" on your system on install. Look into a .deb file (with archive manager), you will see all files in the directories where they will be installed. – Jacob Vlijm Dec 31 '14 at 22:35
  • I'll be happy to make an answer here, based on an edited version of the comments, but it is locally 15 minutes before 2015 here now :), need to join in the champagne :). – Jacob Vlijm Dec 31 '14 at 22:49
  • It is 2015 now and it shows 00:51 now:D – Adrians Netlis Dec 31 '14 at 22:51
  • Here... In Latvia... – Adrians Netlis Dec 31 '14 at 23:18
  • See the link: http://askubuntu.com/questions/1345/what-is-the-simplest-debian-packaging-guide – Muzaffar Jan 01 '15 at 00:28

1 Answers1

2

There is a lot to say about (creating) Debian packages, and information can be overwhelming.

The example below is to make the (very) first start, and create a Debian installer, as basic as it possibly gets, suited for "home" purposes.

Debian packages

A Debian package is in principle a scaled version of your system, seen from the perspective of the root directory. Directories are exactly organized like on your computer.
Looking inside a .deb installer file with archive manager, you can see where files and (possibly) directories will be installed:

enter image description here

In this example, files will be installed in /etc, /usr and /opt (the folder DEBIAN contains installation files, see further below)

Browsing deeper into /usr, you can see the .desktop file (represening your application in Dash) is installed in /usr/share/applications/

enter image description here

When an application is installed, the contents of this scaled version is "projected" on to your "real" system.

A simple example; create a first installer

Say you have a small application (script in this case), that you want to install into the directory /opt, together with its application icon. To represent the applications in Dash, you will also need a .desktop file.

Our example application will only show you a window, saying you succeeded:

enter image description here

  1. The "application":

    Copy the script below into an empty file, save it as ididit (don't use the sh extension)

    #!/bin/sh
    zenity --info --text 'It seems you succeeded making your first Debian installer...'
    
  2. The icon:

    Simply download the icon below as ididit.png

    enter image description here

  3. The .desktop file

    [Desktop Entry]
    Name=I did it!
    Exec=/opt/ididit/ididit
    Icon=/opt/ididit/ididit.png
    Type=Application
    

    Copy it and save it as ididit.desktop

Now create the scaled directory:

  • Create an empty project folder somehwere, named (e.g.) ididit_1.0-1
  • Inside this project folder, create the directories:

    /opt/ididit
    /usr/share/applications
    /DEBIAN
    

    The last directory will not be installed, but contains files, needed by the package manager (see further below).

  • Copy both your script, named ididit (no sh extension), and the icon, named ididtit.png into your newly created directory:

    [.../ididit_1.0-1]  /opt/ididit
    

    Make the script executable.

  • Copy the .desktop file into the directory:

     [.../ididit_1.0-1]  /usr/share/applications
    
  • The /DEBIAN directory contains files, used by the package manager. It can contain a varying number of files, postinst scripts etc. (look here and here for more information). Since this is meant to be an example as simple as possible, we'll keep it to just one necessary (minimized) file: the control file:

    Package: ididit
    Version: 1.0-1
    Section: unknown
    Architecture: amd64
    Depends: zenity
    Maintainer: Your Name <your_email>
    Description: This is my first Debian installer.
    

    Copy it into an empty file, save it as control in the DEBIAN folder.

    note: replace Architecture: amd64 by Architecture: i386 if you use 32bit.

  • Run the following command to make your first installer:

    dpkg-deb --build /path/to/ididit_1.0-1
    

    The Debian installer will be created in the same directory as your project folder.

Now you can install it by:

sudo dpkg -i <package>

And uninstall it by:

 sudo dpkg -r <package>

If all went well, you can run it from Dash.

enter image description here

If you install it by Software Center, it will complain about the "bad quality" of the package, since we skipped a number of files etc. To see exactly what the complaints are, you can run in a terminal:

lintian /path/to/package

As mentioned, this is only a small instruction on how to make a first working Debian installer. It might encourage you to develop your skills further into creating lintian- proof Debian installers.

More to read: Ubuntu packaging guide (and many, many other sources.)

Jacob Vlijm
  • 83,767