Пример #1
0
def getKernelList():
    files = glob.glob(os.path.join("/boot/", "initrd.img*"))
    utilities.sort(files)
    returnme = []
    for i in files:
        # Sample kernel version: /boot/initrd.img-3.4.0-3-generic
        #                        0....5....0....5.7
        returnme.append(i[17:])
    return returnme
Пример #2
0
def getKernelList():
    files = glob.glob(os.path.join("/boot/", "initrd.img*"))
    utilities.sort(files)
    returnme = []
    for i in files:
        # Sample kernel version: /boot/initrd.img-3.4.0-3-generic
        #                        0....5....0....5.7
        returnme.append(i[17:])
    return returnme
Пример #3
0
def compressParsedBuffer(buffers):
    returnme = []
    for i in utilities.sort(list(buffers.keys())):
        returnme.append("Section " + i)
        for x in utilities.sort(list(buffers[i].keys())):
            returnme.append("Option " + x)
            for y in sorted(list(buffers[i][x].keys()), key=savePropertySort):
                returnme.append(y + ": " + buffers[i][x][y])
            returnme.append("EndOption")
        returnme.append("EndSection")
    return returnme
Пример #4
0
def compressParsedBuffer(buffers):
    returnme = []
    for i in utilities.sort(list(buffers.keys())):
        returnme.append("Section " + i)
        for x in utilities.sort(list(buffers[i].keys())):
            returnme.append("Option " + x)
            for y in sorted(list(buffers[i][x].keys()), key=savePropertySort):
                returnme.append(y + ": " + buffers[i][x][y])
            returnme.append("EndOption")
        returnme.append("EndSection")
    return returnme
Пример #5
0
def beautify(buffers):
    returnme = []
    #returnme.append("# " + config.product + " Configuration File")
    returnme.append("")
    returnme.append("")
    for i in utilities.sort(getSections(buffers)):
        returnme.append("Section " + i)
        returnme.append("")
        returnme.append("")
        buffer1 = getLinesWithinSection(buffers, i)
        for x in utilities.sort(getOptions(buffer1)):
            returnme.append("  Option " + x)
            returnme.append("")
            opts = getProperties(getLinesWithinOption(buffer1, x))
            for y in sorted(list(opts.keys()), key=savePropertySort):
                returnme.append("    " + y + ": " + opts[y])
            returnme.append("")
            returnme.append("  EndOption")
            returnme.append("")
            returnme.append("")
        returnme.append("EndSection")
        returnme.append("")
        returnme.append("")
    return returnme
Пример #6
0
def beautify(buffers):
    returnme = []
    #returnme.append("# " + config.product + " Configuration File")
    returnme.append("")
    returnme.append("")
    for i in utilities.sort(getSections(buffers)):
        returnme.append("Section " + i)
        returnme.append("")
        returnme.append("")
        buffer1 = getLinesWithinSection(buffers, i)
        for x in utilities.sort(getOptions(buffer1)):
            returnme.append("  Option " + x)
            returnme.append("")
            opts = getProperties(getLinesWithinOption(buffer1, x))
            for y in sorted(list(opts.keys()), key=savePropertySort):
                returnme.append("    " + y + ": " + opts[y])
            returnme.append("")
            returnme.append("  EndOption")
            returnme.append("")
            returnme.append("")
        returnme.append("EndSection")
        returnme.append("")
        returnme.append("")
    return returnme