~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/ivle-buildjail

  • Committer: William Grant
  • Date: 2009-02-26 02:08:28 UTC
  • Revision ID: grantw@unimelb.edu.au-20090226020828-0qrhe3llq9r5olmr
ivle-showenrolment: Swap year and semester, and show the role.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
parser.add_option("-m", "--mirror",
45
45
    action="store", dest="apt_mirror",
46
46
    help="Sets the apt mirror.", default="http://archive.ubuntu.com/ubuntu")
47
 
parser.add_option("--python-site-packages",
48
 
    action="store", dest="python_site_packages",
49
 
    help="Path to Python site packages directory inside the jail.",
50
 
    default=None)
51
47
(options, args) = parser.parse_args(sys.argv)
52
48
 
53
49
if os.geteuid() != 0:
58
54
    print >> sys.stderr, "No jail exists -- please rerun with -r."
59
55
    sys.exit(1)
60
56
 
61
 
if (options.python_site_packages is not None and
62
 
    options.python_site_packages[:1] not in (os.path.sep, os.path.altsep)):
63
 
    print >> sys.stderr, "python-site-packages must be an absolute path."
64
 
    sys.exit(1)
65
 
 
66
57
if options.recreate:
67
58
    options.upgrade = True
68
59
 
119
110
 
120
111
    # Also copy the IVLE lib directory into the jail
121
112
    # This is necessary for running certain services
122
 
 
123
 
    # ivle_site_packages is the IVLE install location outside the jail
124
 
    ivle_site_packages = os.path.dirname(ivle.__file__)
125
 
 
126
 
    if options.python_site_packages is None:
127
 
        # Get the site packages from the IVLE install location *OUTSIDE* the
128
 
        # jail. Warning! This only works if you have the same Python site
129
 
        # packages directory inside and out (ie. same Python version).
130
 
        # If not, you should use --python-site-packages.
131
 
        jail_site_packages = os.path.join(build_path, ivle_site_packages[1:])
132
 
    else:
133
 
        # User-specified site packages
134
 
        jail_site_packages = os.path.join(build_path,
135
 
                                options.python_site_packages[1:], "ivle")
 
113
    ivle_site_packages = os.path.join(ivle.conf.python_site_packages, 'ivle')
 
114
    jail_site_packages = os.path.join(build_path, ivle_site_packages[1:])
136
115
    if os.path.exists(jail_site_packages):
137
116
        shutil.rmtree(jail_site_packages)
138
117
    shutil.copytree(ivle_site_packages, jail_site_packages)
139
118
 
 
119
    # IMPORTANT: ivle/conf/conf.py contains details which could compromise security
 
120
    # if left in the jail (such as the DB password). We delete it now! It would be
 
121
    # shadowed by the per-user conf.py anyway, but it's best to be safe.
 
122
    os.unlink(os.path.join(jail_site_packages, 'conf/conf.py'))
 
123
    # XXX: Shouldn't copy the compiled files at all, but compile them in the jail!
 
124
    os.unlink(os.path.join(jail_site_packages, 'conf/conf.pyc'))
 
125
 
140
126
if os.spawnvp(os.P_WAIT, 'rsync', ['rsync', '-a', '--delete',
141
127
              build_path + '/', ivle.conf.jail_system]) != 0:
142
128
    print >> sys.stderr, "Jail copying failed."