Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will it be practical to implement deb preinst, postint, etc. scripts in Python, not in sh

I'm interested in what pitfalls can be (except Python is not installed in target system) when using Python for deb package flow control scripts (preinst, postinst, etc.). Will it be practical to implement those scripts in Python, not in sh?

As I understand it's at least possible.

like image 761
Rostyslav Dzinko Avatar asked Jul 05 '12 15:07

Rostyslav Dzinko


1 Answers

The only reason this isn't commonly done, afaik, is that it's not convention, and Python isn't usually more useful or straightforward than plain shell script for the sorts of things that maintainer scripts do. When it is more useful, you can often break out the Python-needing functionality into a separate Python script which is called by the maintainer scripts.

It can help to follow convention in this sort of situation, since there are a lot of helpful tools and scripts (e.g., Lintian, Debhelper) which generally assume that maintainer scripts use bash. If they don't, it's ok, but those tools may not be as useful as they would be otherwise. The only other issue I think you need to be aware of is that if your preinst or postrm scripts need Python, then Python needs to be a pre-dependency (Pre-Depends) of your package instead of just a Depends.

That said, I've found it useful to use Python in a maintainer script before.

like image 56
the paul Avatar answered Oct 25 '22 07:10

the paul