Skip to content

Instantly share code, notes, and snippets.

@deanrather
Last active March 15, 2024 04:55
Show Gist options
  • Save deanrather/6016390 to your computer and use it in GitHub Desktop.
Save deanrather/6016390 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