Basic Steps on How to create a deb package:
1. Create a folder [with the name of the package you want for batter understanding.]
a. mkdir hello-amitmund
2. create a directory "DEBIAN" under hello-amitmund
a. mkdir -p hello-amitmund/DEBIAN
3. create the files {on need basic } under the DEBIAN directory.
a. cd hello-amitmund/DEBIAN.
b. control [ hello-amitmund/DEBIAN ] "NOTE: This file is must."
c. conffiles
d. md4sums
e. prerm [ need executable permission ]
f. preinst [ need executable permission ]
g. postinst [ need executable permission ]
h. postrm [ need executable permission ]
4. Create directory structure [ Unix file-system ] under the main directory as per the need. [ e.g. ./usr/bin and so on ... ]
5. Each directory should have the 755 permission at the package:
a. find ./hello-amitmund -type d | xargs chmod 755
6. Now building the package: [ fakeroot dpkg-deb --build hello-amitmund ]
NOTE: you can also use: fakeroot dpkg --build hello-amitmund, but nice to use dpkg-deb ]
a. check for the command fakeroot [ if not there then, install fakeroot ]
b. run a command in an environment faking root privileges for file manipulation
c. Using fakeroot, all our script will be own as root user.
d. [ Because most of us want to have the file should be own by root user. ]
NOTE: your package is completed now. You can install the package.
NOTE: to know the best information about the package you can use:
lintain hello-amitmund.deb.
Summary
Prerequisite files:
one or more binary executable or shell script files
a man page for each executable file
a 'control' file
a 'copyright' file
a 'changelog' and 'changelog.Debian' file
Setup temporary 'debian' directories: (or wherever you plan to place your executable files) [ as per the above example, I have used "hello-amitmund" in place of debian ]
create 'debian/usr/bin' directory (or wherever you plan to place your executable files)
create 'debian/usr/share/man/man1' (or whatever section your man page belongs into)
create 'debian/DEBIAN' directory
create 'debian/usr/share/doc/<package_name>'
1. Create a folder [with the name of the package you want for batter understanding.]
a. mkdir hello-amitmund
2. create a directory "DEBIAN" under hello-amitmund
a. mkdir -p hello-amitmund/DEBIAN
3. create the files {on need basic } under the DEBIAN directory.
a. cd hello-amitmund/DEBIAN.
b. control [ hello-amitmund/DEBIAN ] "NOTE: This file is must."
c. conffiles
d. md4sums
e. prerm [ need executable permission ]
f. preinst [ need executable permission ]
g. postinst [ need executable permission ]
h. postrm [ need executable permission ]
4. Create directory structure [ Unix file-system ] under the main directory as per the need. [ e.g. ./usr/bin and so on ... ]
5. Each directory should have the 755 permission at the package:
a. find ./hello-amitmund -type d | xargs chmod 755
6. Now building the package: [ fakeroot dpkg-deb --build hello-amitmund ]
NOTE: you can also use: fakeroot dpkg --build hello-amitmund, but nice to use dpkg-deb ]
a. check for the command fakeroot [ if not there then, install fakeroot ]
b. run a command in an environment faking root privileges for file manipulation
c. Using fakeroot, all our script will be own as root user.
d. [ Because most of us want to have the file should be own by root user. ]
NOTE: your package is completed now. You can install the package.
NOTE: to know the best information about the package you can use:
lintain hello-amitmund.deb.
Summary
Prerequisite files:
one or more binary executable or shell script files
a man page for each executable file
a 'control' file
a 'copyright' file
a 'changelog' and 'changelog.Debian' file
Setup temporary 'debian' directories: (or wherever you plan to place your executable files) [ as per the above example, I have used "hello-amitmund" in place of debian ]
create 'debian/usr/bin' directory (or wherever you plan to place your executable files)
create 'debian/usr/share/man/man1' (or whatever section your man page belongs into)
create 'debian/DEBIAN' directory
create 'debian/usr/share/doc/<package_name>'
make sure all sub directories of 'debian' have file permission 0755
Copy files into temporary 'debian' tree:
copy executable file into 'debian/usr/bin' directory (or wherever you plan to place your executable files)
copy man page file into 'debian/usr/share/man/man1' directory
copy 'control' file into 'debian/DEBIAN' directory
copy 'copyright', 'changelog', and 'changelog.Debian' files into 'debian/usr/share/doc/<package_name>' [ NOTE: <package_name => hello-amitmund ]
gzip man page, 'copyright', 'changelog', and 'changelog.Debian' files with option '--best' inside the temporary 'debian' tree
Build and check binary Debian package:
invoke 'dpkg-deb --build' using 'fakeroot' on the 'debian' directory
rename resulting 'debian.deb' file to its final package name including version and architecture information
check resulting .deb package file for Debian policy compliance using 'lintian'
Copy files into temporary 'debian' tree:
copy executable file into 'debian/usr/bin' directory (or wherever you plan to place your executable files)
copy man page file into 'debian/usr/share/man/man1' directory
copy 'control' file into 'debian/DEBIAN' directory
copy 'copyright', 'changelog', and 'changelog.Debian' files into 'debian/usr/share/doc/<package_name>' [ NOTE: <package_name => hello-amitmund ]
gzip man page, 'copyright', 'changelog', and 'changelog.Debian' files with option '--best' inside the temporary 'debian' tree
Build and check binary Debian package:
invoke 'dpkg-deb --build' using 'fakeroot' on the 'debian' directory
rename resulting 'debian.deb' file to its final package name including version and architecture information
check resulting .deb package file for Debian policy compliance using 'lintian'
Example:
ls -lR helloWorld-amitmund/
helloWorld-amitmund/:
total 8
drwxrwxr-x 2 amitmund amitmund 4096 Dec 11 00:18 DEBIAN
drwxrwxr-x 3 amitmund amitmund 4096 Dec 10 23:44 usr
helloWorld-amitmund/DEBIAN:
total 4
-rw-rw-r-- 1 amitmund amitmund 230 Dec 11 00:18 control
helloWorld-amitmund/usr:
total 4
drwxrwxr-x 3 amitmund amitmund 4096 Dec 10 23:44 bin
helloWorld-amitmund/usr/bin:
total 8
-rwxrwxr-x 1 amitmund amitmund 60 Dec 10 23:50 helloWorld-amitmund.sh
-rw-rw-r-- 1 amitmund amitmund 75 Dec 11 00:18 README
Sample control file:
cat helloWorld-amitmund/DEBIAN/control
Package: helloWorld-amitmund
Version: 1.0
Section: base
Priority: optional
Architecture: all
Depends:
Maintainer: maintainer@domain.com
Description: HelloWorld by Amit Kumar Mund
This is a test program for creating a hello world!.
helloWorld-amitmund/:
total 8
drwxrwxr-x 2 amitmund amitmund 4096 Dec 11 00:18 DEBIAN
drwxrwxr-x 3 amitmund amitmund 4096 Dec 10 23:44 usr
helloWorld-amitmund/DEBIAN:
total 4
-rw-rw-r-- 1 amitmund amitmund 230 Dec 11 00:18 control
helloWorld-amitmund/usr:
total 4
drwxrwxr-x 3 amitmund amitmund 4096 Dec 10 23:44 bin
helloWorld-amitmund/usr/bin:
total 8
-rwxrwxr-x 1 amitmund amitmund 60 Dec 10 23:50 helloWorld-amitmund.sh
-rw-rw-r-- 1 amitmund amitmund 75 Dec 11 00:18 README
Sample control file:
cat helloWorld-amitmund/DEBIAN/control
Package: helloWorld-amitmund
Version: 1.0
Section: base
Priority: optional
Architecture: all
Depends:
Maintainer: maintainer@domain.com
Description: HelloWorld by Amit Kumar Mund
This is a test program for creating a hello world!.
EXAMPLE (control) file
# Comment
Package: grep
Essential: yes
Priority: required
Section: base
Maintainer: Wichert Akkerman <wakkerma@debian.org>
Architecture: sparc
Version: 2.4-1
Pre-Depends: libc6 (>= 2.0.105)
Provides: rgrep
Conflicts: rgrep
Description: GNU grep, egrep and fgrep.
The GNU family of grep utilities may be the "fastest grep in the west".
GNU grep is based on a fast lazy-state deterministic matcher (about
twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper
search for a fixed string that eliminates impossible text from being
considered by the full regexp matcher without necessarily having to
look at every character. The result is typically many times faster
than Unix grep or egrep. (Regular expressions containing backreferencing
will run more slowly, however).
NOTE:
Don't worry, the 'md5sum' file as well as the 'postinst' , 'postrm' , 'preinst' and 'prerm' files are not mandatory for your first package. But please take a note of their existence, every proper official Debian package has them for good reasons.
'prerm' and 'postinst' seem to take care of removing old documentation files and adding a link from doc to share/doc.
Further information about the control file can be obtained via 'man 5 deb-control'.
More details: https://wiki.ubuntu.com/PackagingGuide/Complete
Packages we need at ubuntu system:
build-essential devscripts ubuntu-dev-tools debhelper dh-make diff patch cdbs quilt gnupg fakeroot lintian pbuilder piuparts
NOTE: you might like to read the following blog too:
Further few more update:
dpkg-buildpackage --help
No comments:
Post a Comment