Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by Ben ( 13 years ago )
from sys import argv
import subprocess as subp
 
# number of modules to load
modnumber = 0;
# command to run
command = ['modprobe', '-a']
 
# ignored, required, and loaded modules, respectively
with open(argv[1]) as ignored:
    igmods = list(ignored)
with open(argv[2], mode='w') as modlist, open(argv[3]) as modloaded:
    for line in iter(modloaded):
        modname = line.split(None, 1)[0]
        isignored = False
        for igmod in igmods:
            if modname in igmod:
                isignored = True
                break
        if isignored == False:
            # Print module name into modlist, if not ignored
            print(modname, file=modlist)
            modnumber += 1
 
with open(argv[2]) as modlist:
    # load all required modules who aren't ignored
    command.extend([line[:-1] for line in modlist.readlines()])
    subp.call(command)
    #print(command)
 
# Print the number of listed modules
print("{:,} modules listed".format(modnumber))

 

Revise this Paste

Parent: 67376
Your Name: Code Language: