[lug] debian package creator from existing tree?

Simos blug at chinesetearoom.com
Thu Feb 24 10:12:15 MST 2011


On Thursday 24 February 2011 09:28:25 am Bear Giles wrote:
> I seem to recall there's a debian package creator from an existing tree?...
> I've created a number of packages by hand but it's always a pain if it's
> static content that doesn't require compilation.
> 
> The specific need is fonts, gimp brushes and tools, wordpress themes and
> plugins, etc.  All static content that needs nothing more than 'deforma' or
> the like.
> 
> BTW I know about dpkg-repack but I don't think it's what I'm looking for.
> But I could be mistaken.
> 
> Thanks,
> 
> Bear

Here's a simple tutorial on how to do this:

http://ubuntuforums.org/showthread.php?t=910717

Basically you just need to create your directory tree, put together a simple
Debian control file, and run "dpkg-deb --build".

I've used this in the past to help a game developer package his Java game
for Ubuntu. I put together a write-up for him that I've attached, which also
includes pre- & post- scripts, rpm creation through alien, etc.

Regards,

Simos
-------------- next part --------------

 Ultratron Packaging
 ===================

- Decide on a name for the package, for example:

ultratron_2.3-1

The X in ultratron_2.3-X is the package revision (as opposed to the program
revision which is 2.3).

- Create a directory with the package name:

mkdir -m 0755 ultratron_2.3-1

- Create required sub-directories:

cd ultratron_2.3-1
mkdir -m 0755 DEBIAN
mkdir -p -m 0755 opt/ultratron
mkdir -p -m 0755 usr/share/applications usr/share/menu

This package will install Ultratron under /opt/ultratron, and some menu entries
under /usr/share.

- Add the Debian control file and scripts, for example:

vi DEBIAN/control DEBIAN/postinst DEBIAN/postrm
chmod 0644 DEBIAN/control
chmod 0755 DEBIAN/postinst DEBIAN/postrm

See example control, postinst, and postrm files below.

- Add the .jar, .so, .gif, etc. files top opt/ultratron, for example:

cp Ultratron.jar jorbis.jar common.jar liblwjgl.so [etc.] opt/ultratron
chmod 0644 opt/ultratron/*

Also add a startup script like the one I wrote:

cp ultratron.sh opt/ultratron
chmod 0755 opt/ultratron/ultratron.sh

See below for example opt/ultratron contents.

- Create basic menu entry files:

vi usr/share/applications/ultratron.desktop
chmod 0644 usr/share/applications/ultratron.desktop

vi usr/share/menu/ultratron
chmod 0644 usr/share/menu/ultratron

See example files below.

- You can also optionally put some documentation files either in opt/ultratron
or under usr/share/doc/ultratron (which is the standard doc location).

- Create the deb package - you need to run these steps as root if you want the
package files to be installed with root ownership:

cd ..
sudo chown -R root:root ultratron_2.3-1
sudo dpkg-deb --build ultratron_2.3-1

This should create ultratron_2.3-1.deb - check its contents (see example below):

dpkg-deb -c ultratron_2.3-1.deb

This is the deb package that you can distribute.

- You can also generate an simple rpm from the deb, for example:

alien -r -k --scripts ultratron_2.3-1.deb

This should create ultratron-2.3-1.noarch.rpm - check with:

rpm -qpl ultratron-2.3-1.noarch.rpm


 Example Files
 -------------

- DEBIAN control file example:

Package: ultratron
Version: 2.3-1
Section: unknown
Priority: optional
Architecture: all
Maintainer: Puppy Games <puppygames at gmail.com>
Homepage: http://www.puppygames.net/
Description: Ultratron from Puppy Games
 Destroy the robots, avenge the human race!

- DEBIAN postinst script:

#!/bin/sh
set -e
if test -x /usr/bin/update-menus; then update-menus; fi

- DEBIAN postrm script:

#!/bin/sh
set -e
if test -x /usr/bin/update-menus; then update-menus; fi

- Example usr/share/applications/ultratron.desktop file:

[Desktop Entry]
Name=Ultratron
Comment=Ultratron
Exec=/opt/ultratron/ultratron.sh
Icon=/opt/ultratron/ultratron.png
Terminal=false
Type=Application
Categories=Game;

- Example usr/share/menu/ultratron file:

?package(local.ultratron):\
  needs="X11"\
  section="Games"\
  title="Ultratron"\
  command="/opt/ultratron/ultratron.sh"\
  icon="/opt/ultratron/ultratron.png"

- /opt/ultratron contents:

$ ls -l opt/ultratron
-rw-r--r--  1 root root  238897 2010-10-13 18:54 common.jar
-rw-r--r--  1 root root  116744 2010-10-10 19:34 gamecommerce.jar
-rw-r--r--  1 root root  232863 2010-08-27 09:56 jinput.jar
-rw-r--r--  1 root root   72178 2010-08-27 09:56 jorbis.jar
-rw-r--r--  1 root root   14512 2010-07-02 10:42 libjinput-linux64.so
-rw-r--r--  1 root root   13824 2010-07-02 10:42 libjinput-linux.so
-rw-r--r--  1 root root  476168 2010-07-02 10:42 liblwjgl64.so
-rw-r--r--  1 root root  366552 2010-07-02 10:42 liblwjgl.so
-rw-r--r--  1 root root  304661 2010-07-02 10:42 libopenal64.so
-rw-r--r--  1 root root  292803 2010-07-02 10:42 libopenal.so
-rw-r--r--  1 root root  787096 2010-08-27 09:56 lwjgl.jar
-rw-r--r--  1 root root    1263 2010-08-27 09:57 lwjgl.jnlp
-rw-r--r--  1 root root  442907 2010-08-27 09:56 lwjgl-linux.jar
-rw-r--r--  1 root root  141693 2010-08-27 09:56 lwjgl_util.jar
drwxr-xr-x  2 root root    4096 2010-11-25 10:58 META-INF
-rw-r--r--  1 root root    1360 2010-08-27 09:57 puppytron_icon.gif
-rw-r--r--  1 root root  631992 2010-10-10 19:34 spgl-lite.jar
-rw-r--r--  1 root root  734495 2010-11-01 21:13 ultratron_cover.png
-rw-r--r--  1 root root   49479 2010-11-01 21:13 ultratron_cover_thumb.png
-rw-r--r--  1 root root 5776996 2010-10-11 15:11 Ultratron.jar
-rw-r--r--  1 root root    1413 2010-11-01 18:44 ultratron.jnlp
-rw-r--r--  1 root root    1392 2010-11-12 19:51 ultratron.png
-rwxr-xr-x  1 root root    1047 2010-11-12 20:33 ultratron.sh

- Example ultratron package contents:

$ dpkg-deb -c ultratron_2.3-1_all.deb
drwxr-xr-x root/root         0 2010-11-12 19:50 ./
drwxr-xr-x root/root         0 2010-11-12 19:50 ./usr/
drwxr-xr-x root/root         0 2010-11-12 20:21 ./usr/share/
drwxr-xr-x root/root         0 2010-11-12 20:22 ./usr/share/applications/
-rw-r--r-- root/root       165 2010-11-12 20:22 ./usr/share/applications/ultratron.desktop
drwxr-xr-x root/root         0 2010-11-12 20:23 ./usr/share/menu/
-rw-r--r-- root/root       162 2010-11-12 20:23 ./usr/share/menu/ultratron
drwxr-xr-x root/root         0 2010-11-12 18:21 ./opt/
drwxr-xr-x root/root         0 2010-11-12 20:33 ./opt/ultratron/
-rw-r--r-- root/root    787096 2010-08-27 09:56 ./opt/ultratron/lwjgl.jar
-rw-r--r-- root/root     14512 2010-07-02 10:42 ./opt/ultratron/libjinput-linux64.so
-rw-r--r-- root/root    141693 2010-08-27 09:56 ./opt/ultratron/lwjgl_util.jar
-rw-r--r-- root/root     72178 2010-08-27 09:56 ./opt/ultratron/jorbis.jar
-rw-r--r-- root/root    232863 2010-08-27 09:56 ./opt/ultratron/jinput.jar
-rw-r--r-- root/root      1392 2010-11-12 19:51 ./opt/ultratron/ultratron.png
-rw-r--r-- root/root      1413 2010-11-01 18:44 ./opt/ultratron/ultratron.jnlp
-rw-r--r-- root/root      1360 2010-08-27 09:57 ./opt/ultratron/puppytron_icon.gif
-rw-r--r-- root/root     49479 2010-11-01 21:13 ./opt/ultratron/ultratron_cover_thumb.png
-rw-r--r-- root/root    292803 2010-07-02 10:42 ./opt/ultratron/libopenal.so
-rw-r--r-- root/root    238897 2010-10-13 18:54 ./opt/ultratron/common.jar
-rw-r--r-- root/root    631992 2010-10-10 19:34 ./opt/ultratron/spgl-lite.jar
-rw-r--r-- root/root    116744 2010-10-10 19:34 ./opt/ultratron/gamecommerce.jar
drwxr-xr-x root/root         0 2010-11-01 18:48 ./opt/ultratron/META-INF/
-rw-r--r-- root/root       753 2010-07-26 22:52 ./opt/ultratron/META-INF/PUPPYGAM.SF
-rw-r--r-- root/root       622 2010-07-26 22:52 ./opt/ultratron/META-INF/MANIFEST.MF
-rw-r--r-- root/root      2817 2010-07-26 22:52 ./opt/ultratron/META-INF/PUPPYGAM.RSA
-rw-r--r-- root/root    366552 2010-07-02 10:42 ./opt/ultratron/liblwjgl.so
-rw-r--r-- root/root    442907 2010-08-27 09:56 ./opt/ultratron/lwjgl-linux.jar
-rw-r--r-- root/root    476168 2010-07-02 10:42 ./opt/ultratron/liblwjgl64.so
-rw-r--r-- root/root     13824 2010-07-02 10:42 ./opt/ultratron/libjinput-linux.so
-rw-r--r-- root/root    734495 2010-11-01 21:13 ./opt/ultratron/ultratron_cover.png
-rw-r--r-- root/root    304661 2010-07-02 10:42 ./opt/ultratron/libopenal64.so
-rw-r--r-- root/root   5776996 2010-10-11 15:11 ./opt/ultratron/Ultratron.jar
-rwxr-xr-x root/root      1047 2010-11-12 20:33 ./opt/ultratron/ultratron.sh
-rw-r--r-- root/root      1263 2010-08-27 09:57 ./opt/ultratron/lwjgl.jnlp

-------------------------------------------------------------------------------



More information about the LUG mailing list