From 41c4400d4b7e7cce9efb7a51665cc92a3795dade Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 2 Sep 2015 03:13:10 +0200 Subject: Do not use su in non-root mode --- spline-startup | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spline-startup b/spline-startup index 2814ab0..d9af438 100755 --- a/spline-startup +++ b/spline-startup @@ -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: -- cgit v1.2.3-1-g7c22