Adding postinst to debian release

966 views Asked by At

I have a debian package that already has been released but I'm trying to apply a post installation step to it and it's not being performed. My package's upstream repo and release repo are in the links below, respectively: https://github.com/shadow-robot/sr_hand_detector/blob/melodic-devel/scripts/postinst https://github.com/shadow-robot/sr_hand_detector-release

As you can see in the first link, I have a postinst file in the scripts folder. At the release time, I have just had it there, which as I understand now, would not have inserted the script into my debian release. Therefore, just today I made additional changes, i.e. I manually commited and pushed the postinst file to the debian/melodic/sr_hand_detector branch of the release repo, as seen here: https://github.com/shadow-robot/sr_hand_detector-release/tree/debian/melodic/sr_hand_detector/debian

However, I can see that the script is still not applied when I do sudo apt install step. My question therefore is - what additional steps do I have to perform to cleanly make the post installation step work for my debian release. Do I just need to create another version release and make a PR to the rosdistro, do I only need to wait until next sync, or both, or some other step that I am missing here?

Thanks in advance for any advice!

1

There are 1 answers

3
Giacomo Catenazzi On

You can find, if the system installed your script. Check in /var/lib/dpkg/info/<package_name>.postinst. I assume apt/dpkg installed it.

So the problem is in postinst:

<HERE THE ERROR: A EMPTY LINE>
#!/bin/sh
set -e
(...)

the first line is empty. Kernel just check the first bytes: # + ! + ev. a space (which was required on olden times) + a path which should start with /.

Because you had an empty line, kernel fails the check, so he try to execute directly the program (without passing it to /bin/sh), but it is not a valid binary program, so it fail to execute the script.