checking in before switching things up
This commit is contained in:
parent
a376bea0e9
commit
9d018be8aa
@ -1,16 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from .. import download # LOCAL # do i need to escalate two levels up?
|
|
||||||
import os
|
import os
|
||||||
from .. import utils
|
from .. import utils # LOCAL # do i need to escalate two levels up?
|
||||||
|
|
||||||
# TODO: can this be trimmed down?
|
|
||||||
prereqs = ['arch-install-scripts', 'archiso', 'bzip2', 'coreutils', 'customizepkg-scripting', 'cronie', 'dhclient',
|
|
||||||
'dhcp', 'dhcpcd', 'dosfstools', 'dropbear', 'efibootmgr', 'efitools', 'efivar', 'file', 'findutils',
|
|
||||||
'iproute2', 'iputils', 'libisoburn', 'localepurge', 'lz4', 'lzo', 'lzop', 'mkinitcpio-nbd',
|
|
||||||
'mkinitcpio-nfs-utils', 'mkinitcpio-utils', 'nbd', 'ms-sys', 'mtools', 'net-tools', 'netctl',
|
|
||||||
'networkmanager', 'pv', 'python', 'python-pyroute2', 'rsync', 'sed', 'shorewall', 'squashfs-tools',
|
|
||||||
'sudo', 'sysfsutils', 'syslinux', 'traceroute', 'vi']
|
|
||||||
|
|
||||||
class Manifest(object):
|
class Manifest(object):
|
||||||
def __init__(self, cfg):
|
def __init__(self, cfg):
|
||||||
@ -23,24 +14,46 @@ class Manifest(object):
|
|||||||
self.gpg_authorities = ['4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC']
|
self.gpg_authorities = ['4AA4767BBC9C4B1D18AE28B77F2D434B9741E8AC']
|
||||||
self.tarball = None
|
self.tarball = None
|
||||||
self.sig = None
|
self.sig = None
|
||||||
|
self.mirror = None
|
||||||
self.checksum = {'sha1': None,
|
self.checksum = {'sha1': None,
|
||||||
'md5': None}
|
'md5': None}
|
||||||
self._get_filename()
|
self.verified = False
|
||||||
|
self.arches = ('x86_64', )
|
||||||
|
self.bootsupport = ('uefi', 'bios', 'pxe', 'ipxe', 'iso')
|
||||||
|
self.kernel = '/boot/vmlinuz-linux'
|
||||||
|
self.initrd = '/boot/initramfs-linux.img'
|
||||||
|
# TODO: can this be trimmed down?
|
||||||
|
self.prereqs = ['arch-install-scripts', 'archiso', 'bzip2', 'coreutils', 'customizepkg-scripting', 'cronie',
|
||||||
|
'dhclient', 'dhcp', 'dhcpcd', 'dosfstools', 'dropbear', 'efibootmgr', 'efitools', 'efivar',
|
||||||
|
'file', 'findutils', 'iproute2', 'iputils', 'libisoburn', 'localepurge', 'lz4', 'lzo',
|
||||||
|
'lzop', 'mkinitcpio-nbd', 'mkinitcpio-nfs-utils', 'mkinitcpio-utils', 'nbd', 'ms-sys',
|
||||||
|
'mtools', 'net-tools', 'netctl', 'networkmanager', 'pv', 'python', 'python-pyroute2',
|
||||||
|
'rsync', 'sed', 'shorewall', 'squashfs-tools', 'sudo', 'sysfsutils', 'syslinux',
|
||||||
|
'traceroute', 'vi']
|
||||||
|
self._get_filenames()
|
||||||
|
|
||||||
def _get_filename(self):
|
def _get_filenames(self):
|
||||||
# TODO: cache this info
|
# TODO: cache this info
|
||||||
webroot = 'iso/latest'
|
webroot = 'iso/latest'
|
||||||
for m in self.cfg['mirrors']:
|
for m in self.cfg['mirrors']:
|
||||||
uri = os.path.join(m, webroot)
|
uri = os.path.join(m, webroot)
|
||||||
try:
|
try:
|
||||||
self.tarball = utils.detect().remote_files(uri, ptrn = ('archlinux-'
|
self.tarball = utils.detect().remote_files(uri, regex = ('archlinux-'
|
||||||
'bootstrap-'
|
'bootstrap-'
|
||||||
'[0-9]{4}\.'
|
'[0-9]{4}\.'
|
||||||
'[0-9]{2}\.'
|
'[0-9]{2}\.'
|
||||||
'[0-9]{2}-'
|
'[0-9]{2}-'
|
||||||
'x86_64\.tar\.gz$'))[0]
|
'x86_64\.tar\.gz$'))[0]
|
||||||
|
self.sig = '{0}.sig'.format(self.tarball)
|
||||||
|
for h in self.checksum:
|
||||||
|
self.checksum[h] = os.path.join(uri, '{0}sums.txt'.format(h))
|
||||||
|
self.mirror = m
|
||||||
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
if not self.tarball:
|
||||||
|
raise ValueError('Could not find the tarball URI. Check your network connection.')
|
||||||
|
return()
|
||||||
|
|
||||||
|
|
||||||
def extern_prep(cfg, cur_arch = 'x86_64'):
|
def extern_prep(cfg, cur_arch = 'x86_64'):
|
||||||
@ -113,17 +126,3 @@ packager = {'pre_check': False,
|
|||||||
'{PACKAGE}']
|
'{PACKAGE}']
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# These are packages *required* to exist on the base guest, no questions asked.
|
|
||||||
# TODO: can this be trimmed down?
|
|
||||||
prereqs = ['arch-install-scripts', 'archiso', 'bzip2', 'coreutils',
|
|
||||||
'customizepkg-scripting', 'cronie', 'dhclient', 'dhcp', 'dhcpcd',
|
|
||||||
'dosfstools', 'dropbear', 'efibootmgr', 'efitools', 'efivar',
|
|
||||||
'file', 'findutils', 'iproute2', 'iputils', 'libisoburn',
|
|
||||||
'localepurge', 'lz4', 'lzo', 'lzop', 'mkinitcpio-nbd',
|
|
||||||
'mkinitcpio-nfs-utils', 'mkinitcpio-utils', 'nbd', 'ms-sys',
|
|
||||||
'mtools', 'net-tools', 'netctl', 'networkmanager', 'pv',
|
|
||||||
'python', 'python-pyroute2', 'rsync', 'sed', 'shorewall',
|
|
||||||
'squashfs-tools', 'sudo', 'sysfsutils',
|
|
||||||
'syslinux', 'traceroute', 'vi']
|
|
||||||
|
|
||||||
|
@ -87,34 +87,33 @@ class detect(object):
|
|||||||
salt = _hash_list[2]
|
salt = _hash_list[2]
|
||||||
return(salt)
|
return(salt)
|
||||||
|
|
||||||
def remote_files(self, url_base, ptrn = None, flags = []):
|
def remote_files(self, url_base, regex = None, sort = False):
|
||||||
soup = BeautifulSoup(Download(url_base, progress = False).fetch().decode('utf-8'),
|
soup = BeautifulSoup(Download(url_base, progress = False).fetch().decode('utf-8'),
|
||||||
'lxml')
|
'lxml')
|
||||||
urls = []
|
urls = []
|
||||||
if 'regex' in flags:
|
if regex:
|
||||||
if not isinstance(ptrn, str):
|
if not isinstance(regex, str):
|
||||||
raise ValueError('"ptrn" must be a regex pattern to match '
|
raise ValueError('"regex" must be a regex pattern to match '
|
||||||
'against')
|
'against')
|
||||||
else:
|
else:
|
||||||
ptrn = re.compile(ptrn)
|
ptrn = re.compile(regex)
|
||||||
for u in soup.find_all('a'):
|
for u in soup.find_all('a'):
|
||||||
if not u.has_attr('href'):
|
if not u.has_attr('href'):
|
||||||
continue
|
continue
|
||||||
if 'regex' in flags:
|
if regex:
|
||||||
if not ptrn.search(u.attrs['href']):
|
if not ptrn.search(u.attrs['href']):
|
||||||
continue
|
continue
|
||||||
if u.has_attr('href'):
|
if u.has_attr('href'):
|
||||||
|
if re.search('/?\.\./?$', u.attrs['href']):
|
||||||
|
continue
|
||||||
urls.append(u.attrs['href'])
|
urls.append(u.attrs['href'])
|
||||||
if not urls:
|
if not urls:
|
||||||
return(None)
|
return(None)
|
||||||
# We certainly can't intelligently parse the printed timestamp since it
|
# We certainly can't intelligently parse the printed timestamp since it
|
||||||
# varies so much and that'd be a nightmare to get consistent...
|
# varies so much and that'd be a nightmare to get consistent...
|
||||||
# But we CAN sort by filename.
|
# But we CAN sort by filename. MOST of the time, though, this will already be sorted.
|
||||||
if 'latest' in flags:
|
if sort:
|
||||||
urls = sorted(list(set(urls)))
|
urls = sorted(list(set(urls)))
|
||||||
# urls = urls[-1]
|
|
||||||
# else:
|
|
||||||
# urls = urls[0]
|
|
||||||
return(urls)
|
return(urls)
|
||||||
|
|
||||||
def gpgkeyID_from_url(self, url):
|
def gpgkeyID_from_url(self, url):
|
||||||
|
Loading…
Reference in New Issue
Block a user