How to get the deb package located directory in preinst

433 Views Asked by At

I am creating a .deb package that would run a shell script as preinst.

The shell script needs some input files, which would be available at where I have the .deb package, as below.

Package_located_directory $ >
         mydebpackage.deb
         inputfile1
         inputfile2

I would just transfer all the files to the different machine at any location and install it with dpkg -i mydebpackage.deb

I tried using pwd in the preinst to get the current deb file located directory.

So, I can get the path of the inputfiles from the preinst script.

But if I run pwd from preinst , it is giving me / instead of the package located directory.

Also I tried passing pwd from the PIPE to achieve this, as below,

   pwd | dpkg -i mydebpackage.deb

But I do not want to depend on the user input for the path.

Please guide me for getting the current deb package located directory path from inside of preinst script.

1

There are 1 best solutions below

0
On

it's better to use postinst and modify the file on your system. for example : Modify the file /etc/test/test.txt in postinst file