xsos icon indicating copy to clipboard operation
xsos copied to clipboard

Hide RHN,yum in main output when Ubuntu/Debian is detected

Open BryanQuigley opened this issue 7 years ago • 3 comments

I tried to code this so I don't think it will break when used for RHEL, but it seems like there a lot of corner cases.

Figured getting an ack that this is a good direction before doing extensive testing. Thanks!

BryanQuigley avatar Nov 22 '17 22:11 BryanQuigley

Sorry for the delay. Yes this is a good direction.

If you don't want to source os-release then you could grep it. Quick pseudocode sketch to give the idea:

[[ -r "$1/etc/os-release" ]] &&
  if   [[ egrep "ID=\"?(rhel|fedora|centos)" ]]; then
    packaging=rpm
  elif [[ egrep "ID=\"?(ubuntu|debian)" ]]; then
    packaging=deb
  fi

I'd worry more about variables colliding than /etc being used as an attack vector, but perhaps I am not sufficiently paranoid ;)

superjamie avatar Aug 22 '18 07:08 superjamie

Oh, "# I don't like blindly sourcing a file -- that provides a vector to screw with this script..." was already present. I don't mind it, nor do I think it's super likely to mess things up.

We've been using my branch internally at Canonical for Ubuntu as part of ScoutPlane tool for months so the basics still work great.

My biggest worry is that I could have broken some RH/N specific bits that I can't test.

BryanQuigley avatar Aug 22 '18 22:08 BryanQuigley

Looking at this again, I think the order which xsos determines and displays OS release is wrong now.

It was originally written a long time ago to think of RHEL first, but these days Ubuntu should also be a first-class citizen. We could handle other distros which carry recent sosreport packages like AlmaLinux, Debian, Fedora, Mageia.

I'm inclined to close this PR and re-order/rewrite _CHECK_DISTRO to be more distro-agnostic, so still implement the idea of this PR plus end up with an even better result. I will have a think.

superjamie avatar Mar 03 '21 07:03 superjamie