Skip to content

Add support for detecting a distro from a rootfs even on another OS #161

Closed

Description

@pombredanne

I would be interested to run a distro detection based on some rootfs-like archive for aLinux distro and that on any OS. It could be a a plain pre-imaged rootfs, a container image, a VM image or similar and I would like to detect what it is regardless of which OS distro runs on.

Activity

  1. pombredanne commented on Jan 15, 2017

    @pombredanne
    ContributorAuthor

    So essentially I would modify distro to accept an optional path to the root of a distro FS defaulting to / so the behavior would be the same as today by default and would not attempt to run lsb_release unless the path is the default '/' and the current OS is Linux.

  2. pombredanne commented on Jan 15, 2017

    @pombredanne
    ContributorAuthor

    ... and make a few paths relative to that provide root path rather than absolute.
    Do you have any appetite for including this type of behavior?

  3. nir0s commented on Jan 17, 2017

    @nir0s
    Collaborator

    Well, you're the first one asking for such behavior, so I can't say that I've had any appetite for it just yet. It went through my mind that it would be nice to support remote distro identification in the sense that you could just provide a machine to identify a distribution on. It would be better if you could provide the exact API you'd expect from a feature like that, and, of course, a PR if you're interested.

  4. pombredanne commented on Jan 25, 2017

    @pombredanne
    ContributorAuthor

    perfect. I will consider a PR .

  5. hartwork commented on Feb 18, 2017

    @hartwork
    Contributor

    lsb_release does not seem to support a custom root directory. So for the callto lsb_release -a (https://github.com/nir0s/distro/blob/1a7d01b095f757754b511591ebe428bd57e19d34/distro.py#L917) it seems to me that root permissions and using chroot would be needed. Unless the call to lsb_release can be avoided. I'm curious what you come up with.

  6. pombredanne commented on Feb 19, 2017

    @pombredanne
    ContributorAuthor

    @hartwork What is lsb_release? it depends!

    This is a spec AFAIK. Tool-wise we have many implementations.

    At https://sourceforge.net/projects/lsb and now at http://bzr.linuxfoundation.org/loggerhead/lsb/3.1/si/annotate/head:/lsb_release/src/lsb_release this is a shell script.

    In Debian and Ubuntu this is a Python script:
    https://anonscm.debian.org/cgit/collab-maint/lsb.git/tree/lsb_release.py
    http://packages.ubuntu.com/yakkety/lsb-release

    In Fedora and Red Hat, the lsb shell script is used as a base:
    http://pkgs.fedoraproject.org/repo/extras/redhat-lsb/redhat-lsb-4.1-1.tar.bz2/9c1e474cb81c0ee1941c3129e0e50ea1/

    AFAIK, other distros each use their own minor variations or do not have it at all.

    So the strategy could be:

    1. skip running lsb_release entirely.
    2. OR vendor the major distros scripts and patch them to accept a root path (or something similar such as https://github.com/likema/lsb_release_ex )
    3. OR implement the strategies of every lsb_release for distros supported here (which is essentially what this module does already so it would just be to further this)
  7. nir0s commented on Mar 13, 2017

    @nir0s
    Collaborator

    Assuming that we (we being the world) want to standardize retrieving the linux distrubtion information, I guess that not using lsb_release at all but rather implementing the major distribution's implementation of lsb_release (whatever is not already explicitly implemented in distro) would be great. This would not only force standardization but also remove a known yet arbitrarily implemented dependency on lsb_release.

  8. pombredanne commented on Nov 12, 2019

    @pombredanne
    ContributorAuthor

    I pushed a PR with a fix for this #247

  9. added a commit that references this issue on May 29, 2020
  10. hartwork commented on Jul 10, 2021

    @hartwork
    Contributor

    Is this ready to be closed as fixed by #247?

  11. added this to the 1.6.0 milestone on Jul 10, 2021
  12. HorlogeSkynet commented on Sep 25, 2021

    @HorlogeSkynet
    Member

    Indeed, closing here then 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions