Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions scanpipe/pipes/rootfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ class RootFs:

def __attrs_post_init__(self, *args, **kwargs):
self.distro = Distro.from_rootfs(self.location)
if not self.distro:
os_release_path = os.path.join(self.location, "etc", "os-release")
if os.path.exists(os_release_path):
with open(os_release_path) as f:
data = dict(line.split("=", 1) for line in f if "=" in line)
distro_id = data.get("ID", "").strip('"')
version_id = data.get("VERSION_ID", "").strip('"')
if distro_id in SUPPORTED_DISTROS:
self.distro = Distro(
identifier=distro_id,
version=version_id,
)
logger.info(f"Fallback distro detection: {distro_id}")

@classmethod
def from_project_codebase(cls, project):
Expand Down