Running a script during Debian Packaging

1k Views Asked by At

I have some source files and one bash script to run during installation in Ubuntu machines.
What is an easy guide to Debian packaging and create packages for own use?

My practice includes:

I made a sample which copies the files in to /usr/bin/ folder using pbuilder environment, but got struck with running a process.sh file which contains:

set -x
cpath=`pwd`
cd /usr/local/
mkdir libexec
cd
cd $cpath
cp askpin /usr/local/libexec/
cp badpin /usr/local/libexec/
cp msg /usr/local/libexec/
ldconfig

Any help is appreciated.

1

There are 1 best solutions below

0
On

Traditionally these scripts go into the debian/DEBIAN directory along with the control file and are called preinst, postinst, prerm and postrm.
They are run when it is appropriate by the installation/removal process.
Include a shebang at the top of these files.
See: https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html

Edit:
Just chased down pbuilder and realised that the above answer probably means nothing to you.
I didn't know pbuilder existed, if I had maybe I would have used it, instead of scratching my debian builds into the bare metal, where the above answer makes sense.