EDIT
I just now found the variable operating-system-release
, which (i.c.w. system-type
), I guess, comes closest to what you are looking for. However, it might be handy for you to know its value on different operating systems. Maybe readers can help you out in the comments. It seems to be equal to the output of the uname -r
command, so you could also search the web for its output on different distro's.
I am using Fedora 36 where its value is:
"6.0.7-200.fc36.x86_64"
END EDIT
As you are referring to `/etc/debian_version, I guess you mean that, in addition to knowing which OS is running, you'd also like to know which (GNU/)linux distribution is being used. The available 'system' variables and functions are described in this section of the elisp manual.
The system-type
and system-configuration
variables, will tell you which type of OS is being used. There is no 'system' variable that provides info about the used distribution.
However, on (GNU/)linux, you could probably use the following to obtain a useful alist from /etc/os-release
(or you could process the file in some other way also of course):
(pp
(with-temp-buffer
(insert-file-contents-literally "/etc/os-release")
(replace-string "\"" "")
(let ((lines (split-string (buffer-string) "\n" t)))
(mapcar (lambda (l) (split-string l "=")) lines)))
(pop-to-buffer "*os-release*"))
where you can remove the pp
, which only serves to present a nice view of the result.