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

« back to all changes in this revision

Viewing changes to setup/build.py

Move trampoline UID configuration out of config.

conf.h is now generated during the build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    parser.add_option("--no-compile",
44
44
        action="store_true", dest="nocompile",
45
45
        help="Don't byte-compile .py files.")
 
46
    parser.add_option("-t", "--trampoline-uids",
 
47
        action="store", dest="tuids", default="33",
 
48
        help="Comma-separated list of UIDs allowed to use trampoline. "
 
49
             "(default: 33)")
46
50
    (options, args) = parser.parse_args(args)
47
51
 
48
52
    # Call the real function
49
 
    return __build(options.dry, options.nocompile)
 
53
    return __build(options.dry, options.nocompile, options.tuids)
50
54
 
51
 
def __build(dry=False, no_compile=None):
 
55
def __build(dry=False, no_compile=None, tuids=None):
52
56
    install_list = util.InstallList()
53
57
 
54
58
    if dry:
55
59
        print "Dry run (no actions will be executed)\n"
56
60
 
 
61
    # Create trampoline configuration.
 
62
    conf_hfile = os.path.join(os.getcwd(), "bin/trampoline/conf.h")
 
63
    conf_h = open(conf_hfile, "w")
 
64
 
 
65
    conf_h.write("""/* IVLE Configuration File
 
66
 * conf.h
 
67
 * Administrator settings required by trampoline.
 
68
 * Note: trampoline will have to be rebuilt in order for changes to this file
 
69
 * to take effect.
 
70
 */
 
71
 
 
72
#define IVLE_AUFS_JAILS
 
73
 
 
74
/* Which user IDs are allowed to run the trampoline.
 
75
 * This list should be limited to the web server user.
 
76
 * (Note that root is an implicit member of this list).
 
77
 */
 
78
static const int allowed_uids[] = { %s };
 
79
""" % tuids)
 
80
    conf_h.close()
 
81
 
57
82
    # Compile the trampoline
58
83
    curdir = os.getcwd()
59
84
    os.chdir('bin/trampoline')