ACC SHELL

Path : /usr/share/YaST2/modules/
File Upload :
Current File : //usr/share/YaST2/modules/Distro.ycp

/**
 * File:	modules/Distro.ycp
 * Module:	yast2
 * Summary:	Distinguish between distributions that can run YaST
 * Authors:	Martin Vidner <mvidner@suse.cz>
 *
 * $Id: Distro.ycp 49998 2008-08-12 15:43:35Z mvidner $
 */

{

module "Distro";

textdomain "base";

/**
 * Cache
 */
string _distro = nil;


/**
 * Is it SUSE based? openSUSE, SLES, SLED, ...
 */
global boolean suse () {
    if (_distro == nil)
    {
	if (SCR::Read (.target.size, "/etc/SuSE-release") != -1)
	{
	    _distro = "suse";
	    y2milestone ("Found SUSE");
	}
    }

    return _distro == "suse";
}

/**
 * Is it Fedora based? RHEL, Oracle, ...
 */
global boolean fedora () {
    if (_distro == nil)
    {
	if (SCR::Read (.target.size, "/etc/fedora-release") != -1)
	{
	    _distro = "fedora";
	    y2milestone ("Found Fedora");
	}
    }

    return _distro == "fedora";
}

/**
 * Is it Debian based? Ubuntu, ...
 */
global boolean debian () {
    if (_distro == nil)
    {
	if (SCR::Execute (.target.bash, "grep DISTRIB_ID=Ubuntu /etc/lsb-release") == 0)
	{
	    _distro = "debian";
	    y2milestone ("Found Debian/Ubuntu");
	}
    }

    return _distro == "debian";
}

} // EOF

ACC SHELL 2018