2016-11-28 02:56:15 -05:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import jinja2
|
2016-11-29 03:16:44 -05:00
|
|
|
import git
|
|
|
|
import patch
|
2016-12-01 07:13:24 -05:00
|
|
|
import OpenSSL
|
2016-12-03 06:07:41 -05:00
|
|
|
import datetime
|
2016-11-28 02:56:15 -05:00
|
|
|
|
|
|
|
|
2016-12-01 07:13:24 -05:00
|
|
|
def sslIPXE(conf):
|
|
|
|
# http://www.pyopenssl.org/en/stable/api/crypto.html#pkey-objects
|
2016-11-29 03:16:44 -05:00
|
|
|
pass
|
|
|
|
|
2016-11-28 02:56:15 -05:00
|
|
|
def buildIPXE(conf):
|
|
|
|
build = conf['build']
|
|
|
|
bdisk = conf['bdisk']
|
|
|
|
ipxe = conf['ipxe']
|
|
|
|
templates_dir = build['basedir'] + '/extra/templates'
|
2016-11-28 13:35:24 -05:00
|
|
|
ipxe_tpl = templates_dir + '/iPXE'
|
|
|
|
patches_dir = ipxe_tpl + '/patches'
|
|
|
|
srcdir = build['srcdir']
|
|
|
|
ipxe_src = srcdir + '/ipxe'
|
2016-11-29 03:16:44 -05:00
|
|
|
ipxe_git_uri = 'git://git.ipxe.org/ipxe.git'
|
|
|
|
patches_git_uri = 'https://github.com/eworm-de/ipxe.git'
|
2016-12-03 06:07:41 -05:00
|
|
|
print('{0}: Building iPXE in {1}. Please wait...'.format(
|
|
|
|
datetime.datetime.now(),
|
|
|
|
ipxe_src))
|
2016-11-29 03:16:44 -05:00
|
|
|
# Get the source and apply some cherrypicks
|
|
|
|
if os.path.isdir(ipxe_src):
|
|
|
|
shutil.rmtree(ipxe_src)
|
|
|
|
ipxe_repo = git.Repo.clone_from(ipxe_git_uri, ipxe_src)
|
|
|
|
patches = ipxe_repo.create_remote('eworm', patches_git_uri)
|
|
|
|
patches.fetch()
|
|
|
|
eiso_commit = '189652b03032305a2db860e76fb58e81e3420c4d'
|
|
|
|
nopie_commit = '58557055e51b2587ad3843af58075de916e5399b'
|
|
|
|
# patch files
|
|
|
|
#cwd = os.getcwd()
|
|
|
|
#os.chdir(ipxe_src + '/src')
|
|
|
|
for p in ('01.git-version.patch.j2', '02.banner.patch.j2'):
|
|
|
|
try:
|
2016-12-01 07:13:24 -05:00
|
|
|
patchfile = patch.fromfile(patches_dir + '/' + p)
|
|
|
|
patchfile.apply(strip = 2, root = ipxe_src + '/src')
|
2016-11-29 03:16:44 -05:00
|
|
|
except:
|
|
|
|
pass
|
|
|
|
#os.chdir(cwd)
|
|
|
|
# Patch using the files before applying the cherrypicks
|
|
|
|
ipxe_repo.git.cherry_pick('-n', eiso_commit)
|
|
|
|
ipxe_repo.git.cherry_pick('-n', nopie_commit)
|