HorlogeSkynet / archey4

:computer: Maintained fork of the original Archey (Linux) system tool
https://git.io/archey4
GNU General Public License v3.0
295 stars 37 forks source link

[DISTRIBUTIONS] Add support for new (specific) ones #79

Closed HorlogeSkynet closed 4 years ago

HorlogeSkynet commented 4 years ago

Support for Android, CrunchBang (as before v4.6.0) & NixOS.

:warning: Multi-purposes pull request, to be regularly merged.

Description

Sometimes distro does not properly detect the underlying system. This patch brings a wrapper to Distributions.run_detection, allowing us to manually enhance probing with our own logic. It also fixes an inconsistent usage of os.linesep on Windows platforms.

Reason and / or context

See above..

How has this been tested ?

Test cases only. TO DO / On its way : Switch Model and Distro test cases to proper unit testing to DRY and simplify them.

Types of changes :

Checklist :

ingrinder commented 4 years ago

Hello again! Sorry, it's been a while...

I took the liberty to test this on Android, and at the moment on CrunchBang++. I added a small change for Android as you can see 😄

However, the change to re-add CB doesn't actually work in my stock CB++ 10 install (it displays a Debian logo). I noticed we're detecting using a check of the existence of /etc/lsb-release-crunchbang, but this doesn't exist on my system! image As you can see, there isn't much useful here...

About the only thing I can find to distinguish CB++ from Debian is the WM/GTK themes, and the existence of some binaries prefixed cbpp-: image Maybe we could use these?

Anyway, I'll see if I can get SlackWare & NixOS tested on a real install tomorrow. See you until then 👋

Quick addendum: It seems we are not the only tool struggling to detect CB++...! image

HorlogeSkynet commented 4 years ago

Hello again! Sorry, it's been a while...

Hey Michael ! Don't worry, we got plenty of time.

I took the liberty to test this on Android, and at the moment on CrunchBang++. I added a small change for Android as you can see smile

That's really kind, and even a good idea according to what you came up with :fearful:

However, the change to re-add CB doesn't actually work in my stock CB++ 10 install (it displays a Debian logo). I noticed we're detecting using a check of the existence of /etc/lsb-release-crunchbang, but this doesn't exist on my system! As you can see, there isn't much useful here... About the only thing I can find to distinguish CB++ from Debian is the WM/GTK themes, and the existence of some binaries prefixed cbpp-: Quick addendum: It seems we are not the only tool struggling to detect CB++...!

CrunchBang is a PITA to handle as the distro has never honored what the others do, but I thought it would be a good thing to offer a "refugee" implementation for its users anyway. "My bad" I guess then, I run a VM from their latest .ISO, and I think I had noticed something interesting like lsb-release-crunchbang in /etc, as the old CB Statler used to contain back in the past. Maybe I mixed up conclusions between CBPP and Monara (the latter has not been updated for a while).

Anyway, I'll see if I can get SlackWare & NixOS tested on a real install tomorrow. See you until then wave

Good idea too ! See you soon.

ingrinder commented 4 years ago

So, NixOS works perfectly!

Though in my Slackware VM (A/AP/D/E/F/K/KDE/L/N/X/Y), the rpm package manager is installed by default. This means that we end up with a Not detected message since using rpm isn't the proper way to install Slackware packages, so it lists no results and Packages breaks out of its package-manager-searching loop.

There are a few ways we could approach this, but we need to consider:

I've made a change which kinda deals with this; the only issue is if we re-enable apt then packages will be double-counted with apt and dpkg since they use the same back-end... Is this a good enough solution? It does solve the issues on Slackware at least.

HorlogeSkynet commented 4 years ago

So, NixOS works perfectly!

:tada:

Though in my Slackware VM (A/AP/D/E/F/K/KDE/L/N/X/Y), the rpm package manager is installed by default. This means that we end up with a Not detected message since using rpm isn't the proper way to install Slackware packages, so it lists no results and Packages breaks out of its package-manager-searching loop. There are a few ways we could approach this, but we need to consider:

  • Packages can be installed with rpm on Slackware without appearing in /var/log/packages, so it seems we really should include its results.
  • NixOS apparently provide their package manager for other distros. I believe this means that we may have to deal with multiple package managers on other systems too! I've made a change which kinda deals with this; the only issue is if we re-enable apt then packages will be double-counted with apt and dpkg since they use the same back-end... Is this a good enough solution? It does solve the issues on Slackware at least.

You're 100% right. I've noticed a similar situation on Debian, where rpm may be installed too. Currently, by relying on the alphabetical order, it even appears we solve most of them according to the very small number of open issues. Anyway, I'm all good with your patch. Although Packages should be slower to execute, and we are definitely "breaking" the behavior (I've updated to OP).

I let you merge this :ok_hand: