docsmooth / vmware-bumblebee

Bash Script to start VMware Workstation under Bumblebee Primus/Optimus hybrid drivers
GNU General Public License v2.0
29 stars 10 forks source link

won't determine the ostype correctly if with alien or alike installed #23

Open Lynxiayel opened 7 years ago

Lynxiayel commented 7 years ago

the ostype is determined by the package management tools being used, eg. dpkg for debian, rpm for opensuse etc. But there are package converting tools like alien that exist, in which case there might be two package manage tools co-existing in the system, eg. dpkg and rpm can both exist.

In my case, I'm using openSUSE, which uses rpm, but I have installed alien, so dpkg also exist in my system. But in the determineos function, dpkg is checked first, so the ostype of mine is incorrected detected as deb-based.

Not sure how this case can be elegantly avoided so far, but I think we should be aware of this special situation.

docsmooth commented 4 years ago

Can you run: ls /etc/release cat /etc/release

I'll change to using the releases files to determine OS - it's "right", but requires more code.

Lynxiayel commented 4 years ago

In OpenSUSE, /etc/release does not exist, the equivalent is named os-release, running cat /etc/os-release gives the following:

NAME="openSUSE Tumbleweed"
# VERSION="20200118"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20200118"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20200118"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
LOGO="distributor-logo"

If you want to use the release file to determine the host distro, I think a more usual practice might be using cat /etc/*release, or maybe you could use lsb_release -si