summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-09-02 03:34:56 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2015-09-02 03:34:56 +0200
commit3c8bb775dfc5f4af60ef7a5d2e255e29ab06d079 (patch)
tree172985b6ad00b0ccebe01e50d78ec6d0168fa968
parentc060dc8d10375a409893a98d0661b41daf4f362f (diff)
parent44f8476b056a39fde58a280f784a70ed15eb0c1f (diff)
downloadspline-startup-3c8bb775dfc5f4af60ef7a5d2e255e29ab06d079.tar.gz
spline-startup-3c8bb775dfc5f4af60ef7a5d2e255e29ab06d079.tar.bz2
spline-startup-3c8bb775dfc5f4af60ef7a5d2e255e29ab06d079.zip
Merge branch 'master' into debian
* master: Bump version Do not use su in non-root mode
-rwxr-xr-xspline-startup16
1 files changed, 10 insertions, 6 deletions
diff --git a/spline-startup b/spline-startup
index 2814ab0..22b325f 100755
--- a/spline-startup
+++ b/spline-startup
@@ -10,7 +10,7 @@ from subprocess import Popen, PIPE, STDOUT
from pipes import quote
-VERSION = '1.0'
+VERSION = '1.1'
def is_root():
@@ -84,7 +84,7 @@ class SplineStartup(object):
else:
return 0
- def _run_scripts(self, user, action):
+ def _run_scripts(self, user, action, su=True):
self._pdebug("Running scripts for user '%s'" % user.pw_name)
dir = os.path.join(user.pw_dir, 'etc', 'rc.d')
@@ -95,15 +95,19 @@ class SplineStartup(object):
if not os.path.isdir(dir):
return True
- returnvalue = self._call(['su', '-', user.pw_name,
- '-c', 'run-parts %s -- %s' %
- (' '.join(args), quote(dir))])
+ if su:
+ returnvalue = self._call(['su', '-', user.pw_name,
+ '-c', 'run-parts %s -- %s' %
+ (' '.join(args), quote(dir))])
+ else:
+ returnvalue = self._call(['run-parts'] + args + ['--', dir])
+
return returnvalue == 0
def run(self):
if not is_root():
user = pwd.getpwuid(os.getuid())
- self._run_scripts(user, self.options.action)
+ self._run_scripts(user, self.options.action, False)
return
if self.options.user is not None: