Shell selection support via ENV

CDIST_LOCAL_SHELL for local scripts
CDIST_REMOTE_SHELL for remote scripts
This commit is contained in:
Daniel Heule 2014-01-20 20:30:37 +01:00
parent 4bd6158260
commit 64f4cff3cb
4 changed files with 13 additions and 10 deletions

View File

@ -188,7 +188,7 @@ class Local(object):
Return the output as a string. Return the output as a string.
""" """
command = ["/bin/sh", "-e"] command = [ os.environ.get('CDIST_LOCAL_SHELL',"/bin/sh") , "-e"]
command.append(script) command.append(script)
return self.run(command=command, env=env, return_output=return_output, message_prefix=message_prefix) return self.run(command=command, env=env, return_output=return_output, message_prefix=message_prefix)

View File

@ -113,7 +113,7 @@ class Remote(object):
""" """
command = ["/bin/sh", "-e"] command = [ os.environ.get('CDIST_REMOTE_SHELL',"/bin/sh") , "-e"]
command.append(script) command.append(script)
return self.run(command, env, return_output) return self.run(command, env, return_output)

View File

@ -45,10 +45,7 @@ class Shell(object):
"""Select shell to execute, if not specified by user""" """Select shell to execute, if not specified by user"""
if not self.shell: if not self.shell:
if 'SHELL' in os.environ: self.shell = os.environ.get('SHELL',"/bin/sh")
self.shell = os.environ['SHELL']
else:
self.shell = "/bin/sh"
def _init_files_dirs(self): def _init_files_dirs(self):
self.local.create_files_dirs() self.local.create_files_dirs()

View File

@ -127,10 +127,16 @@ usage: __git --source SOURCE [--state STATE] [--branch BRANCH]
ENVIRONMENT ENVIRONMENT
----------- -----------
TMPDIR, TEMP, TMP:: TMPDIR, TEMP, TMP::
Setup the base directory for the temporary directory. Setup the base directory for the temporary directory.
See http://docs.python.org/py3k/library/tempfile.html for See http://docs.python.org/py3k/library/tempfile.html for
more information. This is rather useful, if the standard more information. This is rather useful, if the standard
directory used does not allow executables. directory used does not allow executables.
CDIST_LOCAL_SHELL::
Selects shell for local script execution, defaults to /bin/sh
CDIST_REMOTE_SHELL::
Selects shell for remote scirpt execution, defaults to /bin/sh
EXIT STATUS EXIT STATUS