The Standard Way

Install necessary tools

apt-get install build-essential debhelper devscripts

List files

find ~/packaging/foo/ -type f | sort

/home/swick/packaging/foo/debian/changelog
/home/swick/packaging/foo/debian/control
/home/swick/packaging/foo/debian/install
/home/swick/packaging/foo/debian/rules
/home/swick/packaging/foo/foo

~/packaging/foo/foo

#!/usr/bin/env bash
  
echo "foo"

~/packaging/foo/debian/control

Source: foo
Section: utils
Priority: optional
Maintainer: Sven Wick <sven.wick@gmx.de>
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.6.0
Homepage: https://github.com/foo/
 
Package: foo
Architecture: all
Depends: ${misc:Depends}
Description: short description for foo
 Longer description with more information
 .
 and a second paragraph

~/packaging/foo/debian/rules

#!/usr/bin/make -f
 
%:
    dh $@
  • The rules file is a Makefile and MUST be executable ( chmod +x )
  • The line with dh MUST be indented with a TAB (not spaces)

~/packaging/foo/debian/install

foo    usr/bin

~/packaging/foo/debian/changelog

foo (0.1-1) unstable; urgency=medium

  * Initial release

 -- Sven Wick <sven.wick@gmx.de>  Fri, 17 Dec 2021 00:29:27 +0100

cd ~/packaging/foo
dpkg-buildpackage -uc -us
dpkg-deb -c ~/packaging/foo_0.1-1_all.deb
drwxr-xr-x root/root         0 2021-12-17 00:29 ./
drwxr-xr-x root/root         0 2021-12-17 00:29 ./usr/
drwxr-xr-x root/root         0 2021-12-17 00:29 ./usr/bin/
-rwxr-xr-x root/root        34 2021-12-17 00:29 ./usr/bin/foo
drwxr-xr-x root/root         0 2021-12-17 00:29 ./usr/share/
drwxr-xr-x root/root         0 2021-12-17 00:29 ./usr/share/doc/
drwxr-xr-x root/root         0 2021-12-17 00:29 ./usr/share/doc/foo/
-rw-r--r-- root/root       134 2021-12-17 00:29 ./usr/share/doc/foo/changelog.Debian.gz

dpkg-deb -I ~/packaging/foo_0.1-1_all.deb
 new Debian package, version 2.0.
 size 1172 bytes: control archive=524 bytes.
     281 bytes,    12 lines      control              
     118 bytes,     2 lines      md5sums              
 Package: foo
 Version: 0.1-1
 Architecture: all
 Maintainer: Sven Wick <sven.wick@gmx.de>
 Installed-Size: 9
 Section: utils
 Priority: optional
 Homepage: https://github.com/foo/
 Description: short description for foo
  Longer description with more information
  .
  and a second paragraph