Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install scripts to sbin with python's distutils?

Commonly on most unix systems there is a distinction between $PREFIX/bin and $PREFIX/sbin. When installing a piece of software the administrator decides about what $PREFIX is, but the author decides which programs are suitable for regular users and which are not. With Python's distutils a set of scripts can be defined and they are installed to $PREFIX/bin. So how to install a script to the corresponding sbin directory?

Note that in this case solutions targeting only Linux are welcome, because other parts of the software in question depend on iptables.

like image 518
Helmut Grohne Avatar asked Feb 17 '11 11:02

Helmut Grohne


2 Answers

You can specify where files should be installed in the data_files parameter. It should work putting '/sbin' in the directory specification:

setup(...,
      data_files=[('/sbin', ['rootfill']),
                  ('/etc/init.d', ['init-script'])]
     )
like image 87
Lennart Regebro Avatar answered Sep 22 '22 18:09

Lennart Regebro


For distutils, we are working on support to install scripts into prefix/sbin.

like image 30
merwok Avatar answered Sep 21 '22 18:09

merwok