Posts: 1,062
Dave
Joined: 20 Jan 2010
#1
I know there is a fair bit more that can be done with a debian package, but here is a basic step by step guide.

For neatness, I always make a new directory in ~/ EG: ~/deb-files
1) once this is done make another folder in ~/deb-files with the same name as the intended package ( exclude the .deb )
EG: antix-app_1.0.0_all
2) change directories to this new folder, the folder location should now be ~/deb-files/antix-apps_1.0.0_all. From here make a folder name"DEBIAN" ( case sensitive )
3) change directories to the DEBIAN folder and make a file named"control". This file controls the package functions, here is an example of the control file.

Code: Select all

Package: antix-apps
Version: 1.0.0
Section: system
Priority: optional
Architecture: all
Essential: no
Depends: zenity, gtkdialog
Recommends: antix-cc-utils | antix-wm-utils | antix-misc-utils
Installed-Size: 
Maintainer: antix community (www.antix.freeforums.org)
Description: applications developed in the antiX community for antiX
 Included:
 -> antix-system ( system management for antix )
 -> antix2usb ( make a live install on usb )
 -> exitantix.sh ( shutdown, restart, logout, etc...)
 -> inxi-gui ( view system information, inxi included )
 -> ps_mem.py ( view memory usage )
 -> mountbox ( mounting / unmounting devices )
 -> remaster.sh ( remasters antiX .iso file )
 -> user-management ( user management for antix ) 
 
 This package is included in the full version of antiX. It is meant 
 for people who wish to have or upgrade the antix utilities. This
 package is not included by default in the base or core versions of
 antiX. 
Control file break down
Package --> this is the name of the package as shown via apt EG: apt-get install antix-apps
Version --> this is the package version, this is a factor in determining an update to a package
Section --> this determines in which section of your system this package is shown
Priority --> this determines in which order a group of packages needs to be installed EG: package1 --> package2 --> package3 instead of package3 --> package1 --> package2
Architecture --> this is where you specify which architecture the package is intended for
Essential --> basically is this package essential to system operation
Depends --> this is where you write the depends for your package, so they will be installed first
Recommends --> this is where the recommended packages are written ( they to will be installed )
Installed-size --> this is where the size of all the files is recorded. ( leave this till the package is ready to be built
Maintainer --> this is where the maintainer of the package is written
Description --> this is the package description, this takes a little bit of written formatting
1st line directly behind Description is the description title
2nd line ( after pressing enter, or return ) this is the beginning of the description, needs to be indented with a space
3rd line to end, all lines after the second line that are indented 1 space are part of the description. If there is a spacing line as above, there also needs to be a indenting space. ( even though the line is blank )

That is it for a control file, there can be a little less, and there is a lot more for one, but this is the majority of control functions.

Now from here on it is just information gathering
1) change directories to ~/deb-files/antix-apps_1.0.0_all
2) make a file structure the same as your system for all the files you wish to include. EG: for antixcc.sh, location on system /usr/local/bin/antixcc.sh, location for .deb file ~/deb-files/antix-apps_1.0.0_all/usr/local/bin/antixcc.sh.

*NOTE: make sure that the file structure for your deb has the same ownership and permissions that you desire in the install. Leaving your username and permissions on the files will lead to your username and permissions being set on any system the deb is installed on.

Now all the files are in their proper spot relative to your system install you are ready to start building the package. To do this:
1) open terminal and cd to ~/deb-files
2) type the command"dpkg-deb --build antix-apps_1.0.0_all"

This will build a package by the name of antix-apps_1.0.0_all.deb in ~/deb-files, from here run dpkg-deb --contents antix-apps_1.0.0_all.deb and verify that all the required files are there. If they are, you are good to install, or send your .deb file out to others

If you would like a bit more function other than a self installing tarball, you can add scripts to do post installation tasks and pre removal task. These scripts are located in ~/deb-files/antix-apps_1.0.0_all/DEBIAN they should be named"postinst" for post installation, and prerm for pre removal. These are shell scripts and can do functions such as restart services to enable new config files that may be in your package, or move files in your package to everyones home directory, without knowing their username.