commit: e84beb3237d2e966e3936eaa87e40a1a08a1e176
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 14 23:18:13 2015 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Jul 14 23:18:13 2015 +0000
URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=e84beb32
grs/RunScript.py: add documentation.
grs/RunScript.py | 13 ++++++-------
1 file 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)