aboutsummaryrefslogtreecommitdiff
path: root/grs
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-07-14 19:18:13 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-07-14 19:18:13 -0400
commite84beb3237d2e966e3936eaa87e40a1a08a1e176 (patch)
treede638a82b14ed1cc5e7a66e67ad9cbeba64fcb31 /grs
parentgrs/Populate.py: add documentation. (diff)
downloadgrss-e84beb3237d2e966e3936eaa87e40a1a08a1e176.tar.gz
grss-e84beb3237d2e966e3936eaa87e40a1a08a1e176.tar.bz2
grss-e84beb3237d2e966e3936eaa87e40a1a08a1e176.zip
grs/RunScript.py: add documentation.
Diffstat (limited to 'grs')
-rw-r--r--grs/RunScript.py13
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)