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

« back to all changes in this revision

Viewing changes to bin/ivle-buildjail

ivle-buildjail now only copies the system's IVLE files if jail/devmode
is True. It defaults to False.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
    ivle.jailbuilder.debian.apt_upgrade(build_path)
92
92
    ivle.jailbuilder.debian.apt_clean(build_path)
93
93
 
94
 
# Copy all console and operating system files into the jail
95
 
services_path = os.path.join(ivle.conf.share_path, 'services')
96
 
jail_services_path = os.path.join(build_path, services_path[1:])
97
 
if os.path.exists(jail_services_path):
98
 
    shutil.rmtree(jail_services_path)
99
 
shutil.copytree(services_path, jail_services_path)
100
 
 
101
 
# Also copy the IVLE lib directory into the jail
102
 
# This is necessary for running certain services
103
 
ivle_site_packages = os.path.join(ivle.conf.python_site_packages, 'ivle')
104
 
jail_site_packages = os.path.join(build_path, ivle_site_packages[1:])
105
 
if os.path.exists(jail_site_packages):
106
 
    shutil.rmtree(jail_site_packages)
107
 
shutil.copytree(ivle_site_packages, jail_site_packages)
108
 
 
109
 
# IMPORTANT: ivle/conf/conf.py contains details which could compromise security
110
 
# if left in the jail (such as the DB password). We delete it now! It would be
111
 
# shadowed by the per-user conf.py anyway, but it's best to be safe.
112
 
os.unlink(os.path.join(jail_site_packages, 'conf/conf.py'))
113
 
# XXX: Shouldn't copy the compiled files at all, but compile them in the jail!
114
 
os.unlink(os.path.join(jail_site_packages, 'conf/conf.pyc'))
 
94
if conf['jail']['devmode']:
 
95
    # Copy all console and operating system files into the jail
 
96
    services_path = os.path.join(ivle.conf.share_path, 'services')
 
97
    jail_services_path = os.path.join(build_path, services_path[1:])
 
98
    if os.path.exists(jail_services_path):
 
99
        shutil.rmtree(jail_services_path)
 
100
    shutil.copytree(services_path, jail_services_path)
 
101
 
 
102
    # Also copy the IVLE lib directory into the jail
 
103
    # This is necessary for running certain services
 
104
    ivle_site_packages = os.path.join(ivle.conf.python_site_packages, 'ivle')
 
105
    jail_site_packages = os.path.join(build_path, ivle_site_packages[1:])
 
106
    if os.path.exists(jail_site_packages):
 
107
        shutil.rmtree(jail_site_packages)
 
108
    shutil.copytree(ivle_site_packages, jail_site_packages)
 
109
 
 
110
    # IMPORTANT: ivle/conf/conf.py contains details which could compromise security
 
111
    # if left in the jail (such as the DB password). We delete it now! It would be
 
112
    # shadowed by the per-user conf.py anyway, but it's best to be safe.
 
113
    os.unlink(os.path.join(jail_site_packages, 'conf/conf.py'))
 
114
    # XXX: Shouldn't copy the compiled files at all, but compile them in the jail!
 
115
    os.unlink(os.path.join(jail_site_packages, 'conf/conf.pyc'))
115
116
 
116
117
if os.spawnvp(os.P_WAIT, 'rsync', ['rsync', '-a', '--delete',
117
118
              build_path + '/', ivle.conf.jail_system]) != 0: