Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about post-installation #7

Open
brifordwylie opened this issue Aug 24, 2016 · 3 comments
Open

Question about post-installation #7

brifordwylie opened this issue Aug 24, 2016 · 3 comments

Comments

@brifordwylie
Copy link

brifordwylie commented Aug 24, 2016

I'm trying to add a post installation script with either the py2deb command line or the py2deb python API. I'm looking at the following resources and I'm not quite 'getting it'. My specific use case is I need to add postinst functionality to the debian package (the typical small shell script).... can someone point me in the right direction? :)

Resources I'm looking at so far:

@xolox
Copy link
Member

xolox commented Aug 25, 2016

Hi Brian!

Sorry to disappoint but there's currently no method provided by py2deb for injecting a custom post-installation script. An additional complexity in adding this support is that py2deb already injects a maintainer script into generated packages for internal purposes [1]. My team and I "work around this shortcoming" by generating a package (using the deb-pkg-tools --build command [2]) that has the proper maintainer scripts and pulls in the py2deb generated packages as dependencies.

I have given quite a bit of thought to a usable and backwards compatible (opt-in) way of enabling the injection of maintainer scripts as well as system wide files to install (e.g. to install things in /etc) so this feature is definitely on the radar, but it was never requested by a user before and as such it was low priority, given the relatively easy workaround of generating a wrapper package where you have the freedom to run your own maintainer scripts and install system wide files in arbitrary locations.

Given the sense of urgency in your private email, I'm curious "how soon" (yesterday? :-)) you need this feature. On the one hand I've (kind of) learned not to make promises in open source development [3] but on the other hand it is kind of itching to just implement something instead of taking another six months to come up with "the perfect way" of enabling these features [4].

PS. Unrelated to the topic of your actual question, but manatlan.com/page/py2deb is "a different py2deb" [5].


[1] This "internal" maintainer script is responsible for generating byte code files and initializing namespace packages and it's a Python script, not a shell script, so combining the internal script and a user provided script definitely won't be as simple as "just concatenating two shell scripts".

[2] The deb-pkg-tools package is a dependency of py2deb and as such you will already have it installed.

[3] My private life has a tendency to get in the way of big development :-) and with 40+ open source projects I struggle to load balance between projects.

[4] At the end of the day actual usage is the only way to proof whether a feature is good or not.

[5] A colleague of mine came up with the name py2deb and we liked it so we started using it internally for the project. Several months (if not years, you can check the commit history) later I spent a summer vacation making the project ready to release as open source (this had always been the intention). Before publishing I checked PyPI and ReadTheDocs, saw that the name wasn't taken and put the project online. Later I found out via Reddit that there was an existing project with a similar purpose, although it was never released to PyPI and the last update seems to have been made in 2012. No action was taken by either party since then and here we are with two projects with similar purposes sharing the same name. I'll see if I can add my write up here to the readme / documentation, in an attempt to make things less ambiguous.

@brifordwylie
Copy link
Author

Hi Peter,

Thanks for the amazingly detailed and informative answers. So it looks like we have the following:

  • Current code doesn't support user defined postinst (maintainer scripts)
  • In the short term we can try the 'wrapper-package' approach
  • In the long term maybe py2deb will support it :)

Also thanks a bunch for a great open source tool, I know open source can be thankless at times (I have a few small projects myself)... but anyway we're fans of py2deb, so kudos to you.

@teskje
Copy link
Contributor

teskje commented Dec 12, 2016

I'll second that being able to specify maintainer scripts (in general, not just postinst) would be very useful. (Being able to install system-wide files too, but with a postinst script, those could simply be copied/symlinked after installation.) I would rather avoid the wrapper-package solution as it just doesn't look so nice to have two packages installed for a single program. Might also confuse the users. I admit that this isn't a very strong argument though ;)

You write that simply concatenating the custom postinst script to the maintainer script generated by py2deb is not possible because py2deb's script is Python, not a shell script. But if the custom script was a Python script too, concatenating could work, right? So couldn't we enable Python maintainer scripts this way at least? I'm sure this would be sufficient, as you can easily invoke shell scripts from Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants