Created
July 11, 2021 21:31
-
-
Save apocalyptech/4445c591824a8d0bbc7f7501ca43226b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: set expandtab tabstop=4 shiftwidth=4: | |
from __future__ import print_function | |
import os | |
import sys | |
import subprocess | |
rpmd_files = set() | |
print('Getting list of installed RPMs...', file=sys.stderr) | |
proc = subprocess.Popen(['/bin/rpm', '-qa'], stdout=subprocess.PIPE) | |
stdout, _ = proc.communicate() | |
for idx, rpm in enumerate(stdout.splitlines()): | |
if idx != 0 and idx % 50 == 0: | |
print('Indexed {} RPMs...'.format(idx), file=sys.stderr) | |
proc = subprocess.Popen(['/bin/rpm', '-ql', rpm], stdout=subprocess.PIPE) | |
stdout, _ = proc.communicate() | |
for filename in stdout.splitlines(): | |
if filename.startswith('/usr/'): | |
rpmd_files.add(filename) | |
for dirpath, _, filenames in os.walk('/usr'): | |
for filename in filenames: | |
full_path = os.path.join(dirpath, filename) | |
if full_path not in rpmd_files: | |
print(full_path) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment