Skip to content

Instantly share code, notes, and snippets.

@crazo7924
Created July 17, 2025 10:16
Show Gist options
  • Select an option

  • Save crazo7924/3dcb28e8bc89b9f0b403eb90403630d1 to your computer and use it in GitHub Desktop.

Select an option

Save crazo7924/3dcb28e8bc89b9f0b403eb90403630d1 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import os
import subprocess
import sys
modlist_file = sys.argv[1]
mod_location = os.getcwd()
modlist = set()
with open(modlist_file) as f:
for mod in f:
result = subprocess.run(
["modinfo", f"{mod_location}/{mod}".replace("\n", "")],
stdout=subprocess.PIPE,
text=True,
)
depends_line = [
x.split(":")[1].strip().split(",")
for x in result.stdout.splitlines()
if "depends" in x
][0]
if len(depends_line) == 1 and depends_line[0] != "":
modlist.update(depends_line)
print(*[x + ".ko" for x in modlist], sep="\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment