#!/bin/bash
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# SPDX-FileCopyrightText: 2022-2025 KUNBUS GmbH

cm1_detection() {
    grep -m 1 "model name" "$ROOT"/proc/cpuinfo | grep -q v6l
    return $?
}

# Check existance of HAT EEPROM according to document:
# https://gitlab.com/revolutionpi/revpi-hat-eeprom/blob/master/docs/RevPi-HAT-EEPROM-Format.md#custom-atoms
has_hat_eeprom() {
	if [ -e "$ROOT"/proc/device-tree/hat/custom_1 ]; then
		return 0;
	fi
	return 1;
}

user_pi_exists() {
	getent passwd pi >/dev/null
}
