# Board type related helpers


def _get_board_type():
    with open('/proc/device-tree/model') as f:
        # model ends with a null byte
        return f.readline().strip().strip('\00')


def is_librem5():
    return _get_board_type() == r'Purism Librem 5'


def is_devkit():
    return _get_board_type() == 'Purism Librem 5 devkit'


if __name__ == '__main__':
    print("Board: '{}'".format(_get_board_type()))
    print('devkit: {}'.format(is_devkit()))
    print('librem5: {}'.format(is_librem5()))
