Skip to content

Commit

Permalink
still trying nothing past loading initrd works
Browse files Browse the repository at this point in the history
  • Loading branch information
Esgariot committed Jan 8, 2017
1 parent 620fe25 commit 326d753
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 57 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
*.iso
*.tar
*.gz
tftproot/fedora
tftproot/debian
tftproot/centos
tftproot/opensuse
# Created by https://www.gitignore.io/api/python,linux

### Python ###
Expand Down
65 changes: 13 additions & 52 deletions pykickxe.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,15 @@ def downloadFromURL(args): # TODO: Implement download #p1
# urllib.urlretrieve(distroURL) # TODO: Decide on this or wget #p3
# TODO: Check if file already present #p1
# TODO: Check filesum #p2
return filePath # TODO: return filename from url #p1
return filePath


def unpackImage(args, fileName):
# modify using subprocess
# ISO_PATH = "your_iso_path_here"
# # Mount the ISO in your OS
# os.system("mkdir /media/tmp_iso")
# os.system("mount -o rw,loop %s /media/tmp_iso" % ISO_PATH)
# # Do your Pythonic manipulation here:
# new_file = open("/media/tmp_iso/.config", 'w')
# new_file.write(data)
# new_file.close()
# # Unmount
# os.system("umount /media/tmp_iso")
# os.system("rmdir /media/tmp_iso")
return


def unpackArchive(args, fileName):
return
def copyToTftp():
os.system('cp ./tftproot/. ' + pykickxe_conf.tftpRoot)


def unpackDownloaded(args, fileName):
# TODO: Of cource this is ugly and wrong, use python-magic #p2
if '.iso' in fileName:
unpackImage(args, fileName)
elif '.tar.gz' in fileName:
unpackArchive(args, fileName)
return
def writeToMenu():
menuPath = pykickxe_conf.tftpRoot + 'pxelinux.cfg/autoinstall.menu'


def parseArgs():
Expand All @@ -72,12 +51,16 @@ def parseArgs():
'--list',
help='list some default options',
action='store_true')
parser.add_argument(
'-d',
'--download',
help='Download (not really working)',
action='store_true')
parser.add_argument(
'-v',
'--verbose',
help='print some of what this is doing at any moment',
action='store_true')

parser.add_argument(
'-t',
'--tftp_root',
Expand All @@ -102,28 +85,6 @@ def parseArgs():
args = parseArgs() # TODO: Add sensible options and check exclusivity #p3
if args.list is True:
listConfig()
filePath = downloadFromURL(args)
# TODO: Restructure parser to make sense #p2
# parse_args()

# assign to chosen distro
# assign to tftp-root location
# unpack() (iso or tar)


# modify using subprocess

# ISO_PATH = "your_iso_path_here"

# # Mount the ISO in your OS
# os.system("mkdir /media/tmp_iso")
# os.system("mount -o rw,loop %s /media/tmp_iso" % ISO_PATH)

# # Do your Pythonic manipulation here:
# new_file = open("/media/tmp_iso/.config", 'w')
# new_file.write(data)
# new_file.close()

# # Unmount
# os.system("umount /media/tmp_iso")
# os.system("rmdir /media/tmp_iso")
if args.download is True:
filePath = downloadFromURL(args)
copyToTftp()
Binary file removed tftproot/fedora/initrd.img
Binary file not shown.
Binary file removed tftproot/fedora/vmlinuz
Binary file not shown.
Binary file added tftproot/pxelinux.0
Binary file not shown.
18 changes: 13 additions & 5 deletions tftproot/pxelinux.cfg/default
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@ LABEL autoinstall
KERNEL menu.c32
APPEND pxelinux.cfg/graphics.conf pxelinux.cfg/autoinstall.menu

LABEL debian
KERNEL debian-installer/amd64/linux
APPEND vga=normal initrd=debian-installer/amd64/initrd.gz
LABEL Debian
KERNEL debian/linux
APPEND ftinitrd=debian/initrd.gz

LABEL fedora
LABEL Fedora
KERNEL fedora/vmlinuz
APPEND vga=normal initrd=fedora/initrd.img inst.repo=https://dl.fedoraproject.org/pub/fedora/linux/development/25/Workstation/x86_64/os/
APPEND initrd=fedora/initrd.img inst.repo=https://ftp-stud.hs-esslingen.de/pub/fedora/linux/releases/25/Everything/x86_64/os/

LABEL CentOS
KERNEL centos/vmlinuz
APPEND initrd=centos/initrd.img method=ftp://192.168.0.2/centos/CentOS_ISO/ devfs=nomount ip=dhcp

LABEL OpenSUSE
KERNEL opensuse/?
APPEND ?

0 comments on commit 326d753

Please sign in to comment.