Skip to content

Instantly share code, notes, and snippets.

@silpol
Forked from deanrather/create-package.md
Created February 3, 2023 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silpol/6f3fabd39b2bc56a3e710c18aea6060d to your computer and use it in GitHub Desktop.
Save silpol/6f3fabd39b2bc56a3e710c18aea6060d to your computer and use it in GitHub Desktop.
Creating a .deb Package

Creating a .deb Package

This creates a package which runs an install.sh which copies a file somewhere the below is entirely incorrect. Hopefully I'll get around to fixing it tip: this would install to the root dir & the relative path to ./install.sh would be wrong

go to project directory

cd /path/to/project

create the file

touch file

create the executable install.sh

#!/bin/bash
echo $(date) >> /tmp/test-install.log
cp file /tmp/

you can test it now

create a debian/DEBIAN/ directory

mkdir -p debian/DEBIAN
cd debian/DEBIAN

create a control file:

Package: test-install
Version: 1.1-1
Architecture: all
Maintainer: Dean Rather <deanrather@gmail.com>
Description: Test Install Package
 This package tests running an install.sh script

create an exexutable postinst file

#!/bin/bash
./install.sh

build it!

cd ../../
dpkg-deb --build debian

install it!

sudo dpkg -i debian.deb

go check your /tmp/ dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment