With minimal Tools
- This is the most basic variant with minimal tools involved (
quick-n-dirty). - You can go even more low-level with
arbut that is not pragmatic anymore... - This variant should only be used if all other variants are not possible...
Install necessary tools
apt-get install fakeroot
fakeroot is needed so that the files in the package are owned by "root"
and not by the user who builds the package.root (UID 0) exists on every linux system, but the current user's ID very likely does not
mkdir -p ~/packaging/foo/DEBIAN
This is the only time the DEBIAN folder needs to be in uppercase
since we use some lower level tools which still expect this...Tools like debhelper and others use the lowercase variant.
mkdir -p ~/packaging/foo/usr/bin/
~/packaging/foo/usr/bin/foo
#!/usr/bin/env bash
echo "foo"
chmod +x ~/packaging/foo/usr/bin/foo
~/packaging/foo/DEBIAN/control
Package: foo
Version: 0.1-1
Architecture: all
Maintainer: Sven Wick <sven.wick@gmx.de>
Description: short description for foo
fakeroot dpkg-deb --build ~/packaging/foo/
dpkg-deb -c ~/packaging/foo.deb
drwxr-xr-x root/root 0 2021-12-17 01:01 ./
drwxr-xr-x root/root 0 2021-12-17 01:01 ./usr/
drwxr-xr-x root/root 0 2021-12-17 01:01 ./usr/bin/
-rwxr-xr-x root/root 34 2021-12-17 01:01 ./usr/bin/foo
dpkg-deb -I ~/packaging/foo.deb
new Debian package, version 2.0.
size 740 bytes: control archive=304 bytes.
126 bytes, 5 lines control
Package: foo
Version: 0.1-1
Architecture: all
Maintainer: Sven Wick <sven.wick@gmx.de>
Description: short description for foo