'Given a directory name where we have a kernel/initrd pair, try to autoname
the distribution (and profile) object based on the contents of that path'

def get_proposed_name(self, dirname, kernel=None):

    if (self.network_root is not None):
        name = self.name
    else:
        name = '-'.join(dirname.split('/')[5:])
    if (kernel is not None):
        if ((kernel.find('PAE') != (-1)) and (name.find('PAE') == (-1))):
            name += '-PAE'
        if ((kernel.find('xen') != (-1)) and (name.find('xen') == (-1))):
            name += '-xen'
    name = name.replace('--', '-')
    for x in ('-netboot', '-ubuntu-installer', '-amd64', '-i386', '-images', '-pxeboot', '-install', '-isolinux', '-boot', '-suseboot', '-loader', '-os', '-tree', 'var-www-cobbler-', 'distro_mirror-'):
        name = name.replace(x, '')
    name = name.replace('chrp', 'ppc64')
    for separator in ['-', '_', '.']:
        for arch in ['i386', 'x86_64', 'ppc64le', 'ppc64el', 'ppc64', 'ppc32', 'ppc', 'x86', '386', 'amd']:
            name = name.replace(('%s%s' % (separator, arch)), '')
    return name
