diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-07-14 09:40:55 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-07-14 09:40:55 -0300 |
commit | 65142de0df955db2a67cecd59f40328e956f483c (patch) | |
tree | 47089a584cf14958b802fe6b9659ca13aca37c18 /g_octave | |
parent | Added tag 0.3 for changeset 7700c57be487 (diff) | |
download | g-octave-65142de0df955db2a67cecd59f40328e956f483c.tar.gz g-octave-65142de0df955db2a67cecd59f40328e956f483c.tar.bz2 g-octave-65142de0df955db2a67cecd59f40328e956f483c.zip |
added some stuff to help with the restriction of user groups to run
g-octave
Diffstat (limited to 'g_octave')
-rw-r--r-- | g_octave/package_manager.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/g_octave/package_manager.py b/g_octave/package_manager.py index 360a7b3..0587718 100644 --- a/g_octave/package_manager.py +++ b/g_octave/package_manager.py @@ -17,7 +17,9 @@ __all__ = [ 'Paludis', ] +import grp import os +import pwd import subprocess from g_octave.ebuild import Ebuild @@ -25,6 +27,7 @@ from g_octave.ebuild import Ebuild class Base: _client = '' + _group = None post_install = [] post_uninstall = [] @@ -36,10 +39,23 @@ class Base: for package in packages: Ebuild(package[len('g-octave/'):], pkg_manager=self).create() + def allowed_users(self): + if self._group is None: + return [i.pw_name for i in pwd.getpwall()] + try: + users = grp.getgrnam(self._group).gr_mem + except KeyError: + users = [] + # root is the master!!! :P + if 'root' not in users: + users.append('root') + return users + class Portage(Base): _client = 'emerge' + _group = 'portage' post_uninstall = [ 'You may want to remove the dependencies too, using:', @@ -146,6 +162,7 @@ class Pkgcore(Base): class Paludis(Base): _client = 'paludis' + _group = 'paludisbuild' post_uninstall = [ 'You may want to remove the dependencies too, using:', |