diff options
Diffstat (limited to 'grs')
-rw-r--r-- | grs/RunScript.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/grs/RunScript.py b/grs/RunScript.py index 0e5d48e..33efd72 100644 --- a/grs/RunScript.py +++ b/grs/RunScript.py @@ -6,22 +6,21 @@ from grs.Constants import CONST from grs.Execute import Execute class RunScript(): - """ doc here - more doc - """ + """ Run a script within the chroot. """ - def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE): - """ doc here - more doc - """ + def __init__(self, libdir = CONST.LIBDIR, portage_configroot = CONST.PORTAGE_CONFIGROOT, + logfile = CONST.LOGFILE): self.libdir = libdir self.portage_configroot = portage_configroot self.logfile = logfile def runscript(self, script_name): + # Copy the script form the GRS repo to the system's portage configroot's /tmp. + # Don't add a suffix to the script since we will admit bash, python, etc. script_org = os.path.join(self.libdir, 'scripts/%s' % script_name) script_dst = os.path.join(self.portage_configroot, 'tmp/script') shutil.copy(script_org, script_dst) + # Mark the script as excutable and execute it. os.chmod(script_dst, 0o0755) cmd = 'chroot %s /tmp/script' % self.portage_configroot Execute(cmd, timeout=None, logfile=self.logfile) |