forked from ungleich-public/cdist
add command line handling for pxe generating
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
4fb55b8d92
commit
995e33afc9
1 changed files with 27 additions and 2 deletions
|
@ -56,12 +56,13 @@ class PreOS(object):
|
||||||
"--arch=%s" % self.arch ]
|
"--arch=%s" % self.arch ]
|
||||||
|
|
||||||
self.pxelinux = "/usr/lib/syslinux/pxelinux.0"
|
self.pxelinux = "/usr/lib/syslinux/pxelinux.0"
|
||||||
self.pxelinux-cfg = """
|
self.pxelinux_cfg = """
|
||||||
DEFAULT linux
|
DEFAULT linux
|
||||||
LABEL linux
|
LABEL linux
|
||||||
KERNEL linux
|
KERNEL linux
|
||||||
INITRD initramfs
|
INITRD initramfs
|
||||||
APPEND ro root=/dev/sda1 initrd=initrd.img
|
APPEND ro root=/dev/sda1 initrd=initrd.img
|
||||||
|
"""
|
||||||
|
|
||||||
self._init_helper()
|
self._init_helper()
|
||||||
|
|
||||||
|
@ -153,9 +154,29 @@ cp -L "$src" "$real_dst"
|
||||||
fd.write(val)
|
fd.write(val)
|
||||||
os.chmod(filename, stat.S_IRUSR | stat.S_IXUSR)
|
os.chmod(filename, stat.S_IRUSR | stat.S_IXUSR)
|
||||||
|
|
||||||
def create_pxe(self, base_dir):
|
def create_kernel(self):
|
||||||
|
cmd=[ "cp", '"$(ls boot/vmlinuz-* | tail -n1)"' ]
|
||||||
|
cmd.append
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def create_initramfs(self):
|
||||||
|
base_cmd="find . -print0 | sudo cpio --null -ov --format=newc | gzip -9"
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
def create_iso(self, out_dir):
|
||||||
|
self.out_dir = out_dir
|
||||||
|
|
||||||
|
raise cdist.Error("Generating ISO is not yet supported")
|
||||||
|
|
||||||
|
def create_pxe(self, out_dir):
|
||||||
|
self.out_dir = out_dir
|
||||||
|
|
||||||
|
self.create_kernel()
|
||||||
|
self.create_initramfs()
|
||||||
|
self.create_pxeconfig()
|
||||||
|
|
||||||
def config(self):
|
def config(self):
|
||||||
handle, path = tempfile.mkstemp(prefix='cdist.stdin.')
|
handle, path = tempfile.mkstemp(prefix='cdist.stdin.')
|
||||||
with tempfile.TemporaryDirectory() as tempdir:
|
with tempfile.TemporaryDirectory() as tempdir:
|
||||||
|
@ -186,3 +207,7 @@ cp -L "$src" "$real_dst"
|
||||||
self.bootstrap()
|
self.bootstrap()
|
||||||
if args.config:
|
if args.config:
|
||||||
self.config()
|
self.config()
|
||||||
|
if args.pxe_boot:
|
||||||
|
self.create_pxe(args.pxe_boot)
|
||||||
|
if args.iso_boot:
|
||||||
|
self.create_iso(args.pxe_boot)
|
||||||
|
|
Loading…
Reference in a new issue