@@ -227,7 +227,7 @@ def getModuleEntries (modulesPath: str) -> dict:
227
227
228
228
return modules
229
229
230
- def signKernel (kernel : str , modules : dict , privateKeyPath : str , publicKeyPath : str ):
230
+ def signKernel (kernel : str , moduleEntries : list , privateKeyPath : str , publicKeyPath : str ):
231
231
'''
232
232
Signs the nvidia kernel modules for a kernel (void).
233
233
@@ -240,15 +240,15 @@ def signKernel (kernel: str, modules: dict, privateKeyPath: str, publicKeyPath:
240
240
'''Path to the sign-file binary used to sign the kernel modules'''
241
241
242
242
BASE_MODULES_PATH = '/usr/lib/modules/' + kernel + '/'
243
- '''Path to modules before the directory provided by the JSON file is appended'''
243
+ '''Path to modules before the directory provided by each module entry is appended'''
244
244
245
245
#Print if the user is not root (uid 0)
246
246
if os .getuid () != 0 :
247
247
print ('%s: Signing kernel modules must be done as root. You may be prompted for your password:' % __title__ )
248
248
print ()
249
249
250
250
#Sign the modules for each entry in the JSON file
251
- for moduleEntry in modules [ ' moduleEntries' ] :
251
+ for moduleEntry in moduleEntries :
252
252
modulesPath = BASE_MODULES_PATH + moduleEntry ['directory' ]
253
253
254
254
moduleFiles = moduleEntry ['moduleFiles' ]
@@ -359,7 +359,7 @@ def getNewKernels (currentKernel: str, installedKernels: list) -> list:
359
359
360
360
return newKernels
361
361
362
- def signNewKernels (newKernels : list , moduleEntries : dict , privateKeyPath : str , publicKeyPath : str ):
362
+ def signNewKernels (newKernels : list , moduleEntries : list , privateKeyPath : str , publicKeyPath : str ):
363
363
'''
364
364
Signs the nvidia kernel modules for every new kernel by calling signKernel () on each (void).
365
365
@@ -397,8 +397,8 @@ def main ():
397
397
print ('%s: Found package manager: %s' % (__title__ , packageManager ))
398
398
print ()
399
399
400
- # currentKernel = getCurrentKernel ()
401
- currentKernel = '4.7.2-200.fc24.x86_64'
400
+ currentKernel = getCurrentKernel ()
401
+
402
402
print ('%s: Found current kernel: %s' % (__title__ , currentKernel ))
403
403
print ()
404
404
@@ -413,10 +413,11 @@ def main ():
413
413
print ('%s: Found new kernels: %s' % (__title__ , newKernels ))
414
414
print ()
415
415
416
- moduleEntries = getModuleEntries (args .modulesFile )
417
-
416
+ modulesFile = getModuleEntries (args .modulesFile )
417
+ moduleEntries = modulesFile ['moduleEntries' ]
418
+
418
419
print ('%s: Signing modules for: ' % __title__ , end = '' )
419
- for moduleEntry in moduleEntries [ 'moduleEntries' ] :
420
+ for moduleEntry in moduleEntries :
420
421
print (moduleEntry ['name' ], end = ', ' )
421
422
print ('\n ' )
422
423
0 commit comments