I have been writing a shell script that needs to know if the system one is on is, in fact, Debian-based. Now I have seen this question, but its answers weren't so helpful. I am aware of checking /etc/os-release
and the output of lsb_release
, likewise I know that checking if rpm
or dpkg
commands exist is another way of checking whether one's distribution is Red Hat or Debian-based, respectively. All these methods have flaws though. There are hundreds of different Debian-based distros (including those based on Ubuntu, which is in itself based on Debian) and checking whether the NAME
field in /etc/os-release
, or the Distributor ID
in the output of lsb_release -a
matches any of the hundreds of known Debian-based distributions would take forever. Checking whether the commands dpkg and rpm exist aren't fool-proof either as some people install other distribution's package managers for various different reasons. For example, on my Ubuntu machine I have RPM installed, partly because sometimes I use the Open Build Service's OSC command, which in some cases requires RPM.
So in short I want a simple and fast way of checking (with certainty) whether the distribution my script finds itself on is Debian-based or not. Is this possible?
EDIT: As people seem to be implying, by voting to close this question, that /etc/debian_version is present on all Debian-based systems. Does anyone have proof of this?
/etc/debian_version
so I don't see how this could be a duplicate. – Josh Pinto Nov 06 '16 at 08:30