Example #1
0
def distroName():
    """
    Get the name of the distro.
    """
    with quiet():
        lsb = run('/usr/bin/lsb_release --id --short', warn_only=True)
        if lsb.succeeded:
            return lsb.lower()

        distros = [
            ('centos', '/etc/centos-release'),
            ('fedora', '/etc/fedora-release'),
            ('rhel', '/etc/redhat-release'),
            ('debian', '/etc/debian_version'),
        ]
        for distro, sentinel in distros:
            if succeeds('/usr/bin/test -f {}'.format(sentinel)):
                return distro

        os = run('/usr/bin/uname -s', warn_only=True)
        return os.lower()
Example #2
0
def distroName():
    """
    Get the name of the distro.
    """
    with quiet():
        lsb = run('/usr/bin/lsb_release --id --short', warn_only=True)
        if lsb.succeeded:
            return lsb.lower()

        distros = [
                ('centos', '/etc/centos-release'),
                ('fedora', '/etc/fedora-release'),
                ('rhel', '/etc/redhat-release'),
                ('debian', '/etc/debian_version'),
                ]
        for distro, sentinel in distros:
            if succeeds('/usr/bin/test -f {}'.format(sentinel)):
                return distro

        os = run('/usr/bin/uname -s', warn_only=True)
        return os.lower()
Example #3
0
def install(user, file):
    with settings(user=user):
        run('/usr/bin/crontab {}'.format(file))
Example #4
0
def isRoot():
    """
    Check if the current user is root.
    """
    return run('id -u') == '0'
Example #5
0
def arch():
    """
    Get the architechture of the machine.
    """
    return run('/bin/uname --machine')
Example #6
0
def isRoot():
    """
    Check if the current user is root.
    """
    return run('id -u') == '0'
Example #7
0
def arch():
    """
    Get the architechture of the machine.
    """
    return run('/bin/uname --machine')