Convert any single (or multiple) executable file(s) to .deb package
Project description
ELF2deb
Convert any single (or multiple) executable file(s) to deb-package.
I.e. this is a script to convert AppImage|ELF|executable script to .deb
.
The script will place the binary file(s) in /usr/bin/
.
Setup
You want to set DEBEMAIL
and DEBFULLNAME
for the deb tools to work properly:
$ cat >>~/.bashrc <<EOF
DEBEMAIL="email@example.org"
DEBFULLNAME="John Doe"
export DEBEMAIL DEBFULLNAME
EOF
$ . ~/.bashrc
Then it's as simple as downloading elf2deb.pyz
from releases or download it from PyPi: pip3 install elf2deb
and elf2deb --help
.
Example
In this example I'm first downloading the skaffold binary and packing it as a .deb
file:
# Download ./skaffold binary to empty folder:
$ curl -Lo ./skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
# Run the tool:
$ ./elf2deb.pyz --license apache-2.0 --license_year 2018 --license_holder "The Skaffold Authors" \
> --package_name skaffold --package_version 0.28.0 --homepage "https://skaffold.dev/" ./skaffold
# Fix description and use debuild:
$ cd skaffold-0.28.0/
$ vim debian/control # add description
$ debuild -us -uc
[... lots of debuild output ...]
$ cd ../
# Finally the .deb file is ready to be uploaded, or installed:
$ sudo dpkg -i skaffold_0.28.0_amd64.deb
Arguments
usage: elf2deb [-h] [--version]
--package_name PACKAGE_NAME
--package_version PACKAGE_VERSION
[--homepage HOMEPAGE]
[--dependencies DEPENDENCIES]
[--license {MIT,LGPL-3.0,MPL-2.0,AGPL-3.0,unlicense,apache-2.0,GPL-3.0} | --license_file LICENSE_FILE]
[--license_year LICENSE_YEAR]
[--license_holder LICENSE_HOLDER]
binary_files [binary_files ...]
positional arguments:
binary_files The binaries you want to package.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
package info:
--package_name PACKAGE_NAME
The name of the deb package
--package_version PACKAGE_VERSION
The version of the package
--homepage HOMEPAGE The webpage of the package
--dependencies DEPENDENCIES
Dependencies specified in the deb package
license info:
--license {MIT,LGPL-3.0,MPL-2.0,AGPL-3.0,unlicense,apache-2.0,GPL-3.0}
Select a standard license.
--license_file LICENSE_FILE
... or use a LICENSE text file.
--license_year LICENSE_YEAR
If using a standard license: year
--license_holder LICENSE_HOLDER
If using a standard license: owner
Common warnings
If you are running Ubuntu, you might get E: bad-distribution-in-changes-file unstable
.
In this case edit debian/changelog
and change unstable
to your distributions codename (find it by running lsb_release -c
).
Then run debuild -us -uc
from source directory, to recompile the .deb
.
If you are missing the dch
-tool, then run: sudo apt install --no-install-recommends devscripts libdistro-info-perl
.
You can safely ignore the following warnings from lintian:
-
source-is-missing
-
binary-without-manpage
(you will probably get a longer list of errors and warnings, no worries)
Packaging for other/more formats
If you want to distribute your software in more formats -- or your source isn't a list of binaries -- then consider using a tool like "Effing package management". FPM is a much more mature tool that allows for advanced packaging.
The advantages of ELF2deb is;
-
can be installed using
pip install elf2deb
or used a as a standalone executable./elf2deb.pyz
-
simple, small size (< 10 kB), and few dependencies:
>= python3.5
(+requests
if need to download a license file).debhelper
anddevscripts
(apt install --no-install-recommends debhelper devscripts
).
More examples (interactive!)
In version 1.2.0 a interactive menu was added to ELF2deb:
$ git clone https://github.com/NicolaiSoeborg/ELF2deb.git && cd ELF2deb/
$ make # to make 'elf2deb.pyz' (or use pip to install globally, or carry/copy elf2deb.pyz around)
$ ./elf2deb.pyz elf2deb.pyz # package 'elf2deb.pyz' using elf2deb (very meta!)
Package info:
author_mail: git@xn--sb-lka.org
author_name: Nicolai Søborg
binary_files: ['elf2deb.pyz']
dependencies:
homepage: None
license: None
license_file: <_io.TextIOWrapper name='/.../ELF2deb/LICENSE' mode='r' encoding='UTF-8'>
license_holder: None
license_year: None
package_name: ELF2deb
package_version: 0.0.1
==> Does this look correct? (y/n/q): n
Properties:
[1] author_mail
[2] author_name
[3] binary_files
[4] dependencies
[5] homepage
[6] license
[7] license_file
[8] license_holder
[9] license_year
[10] package_name
[11] package_version
==> Which property to change? (1..11): 4
==> Which value should dependencies be changed to? python3, python3-requests
Package info:
author_mail: git@xn--sb-lka.org
author_name: Nicolai Søborg
binary_files: ['elf2deb.pyz']
dependencies: python3, python3-requests
homepage: None
license: None
license_file: <_io.TextIOWrapper name='/home/nsq/pakker/test/ELF2deb/LICENSE' mode='r' encoding='UTF-8'>
license_holder: None
license_year: None
package_name: ELF2deb
package_version: 0.0.1
==> Does this look correct? (y/n/q): n
[...]
==> Which value should package_version be changed to? 1.2.0
[...]
==> Does this look correct? (y/n/q): y
Copying templates... done!
Copying files... done!
Run:
* cd elf2deb-1.2.0
* vim debian/control # change description, dont add empty lines
* debuild -us -uc # remove -us -uc if you want to sign the deb file
$ cd elf2deb-1.2.0
$ vim debian/control
$ debuild -us -uc
[...]
dpkg-deb: building package 'elf2deb' in '../elf2deb_1.2.0_amd64.deb'.
$ dpkg-deb --info ../elf2deb_1.2.0_amd64.deb
new Debian package, version 2.0.
size 5100 bytes: control archive=624 bytes.
383 bytes, 12 lines control
189 bytes, 3 lines md5sums
Package: elf2deb
Version: 1.2.0
Architecture: amd64
Maintainer: Nicolai Søborg <git@xn--sb-lka.org>
Installed-Size: 20
Depends: python3, python3-requests
Section: misc
Priority: optional
Multi-Arch: foreign
Description: tool to easily package any binary to a deb file
ELF2deb makes it easy to package simple binaries to a deb file
to help deploy files across debian environments.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ELF2deb-1.2.1.tar.gz
.
File metadata
- Download URL: ELF2deb-1.2.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 602a1cdd57e425edf1d1c68db37b9df35af6afe3f8cd287985bf31f0d94d86db |
|
MD5 | 46b9728a5a55b7f17b6fcf2ecd23ce7b |
|
BLAKE2b-256 | 814ab0ce86fb58349b3043b44669895381130144ac90270440580920b35b08b4 |