24 Feb
2016
24 Feb
'16
5:09 p.m.
On Wednesday 24 February 2016 20:05:35 Roman Kagan wrote:
On Wed, Feb 24, 2016 at 03:43:40PM +0100, Pino Toscano wrote:
Use /etc/hosts instead of /etc/fstab to detect whether a partition represents the root of a Linux installation; the latter might not exist in smaller/special installations like Docker images.
IMHO /etc/hosts is just as unreliable as /etc/fstab.
I'd rather test for /bin/sh being present and being an ELF executable or shared object.
That won't work with recent Fedora/RHEL/CentOS systems due to the UsrMerge: if /usr is in a separate partition, /bin/sh "exists" there too, and thus that partition would be detected as root. -- Pino Toscano